All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jhonnymertz.wkhtmltopdf.wrapper.params.Params Maven / Gradle / Ivy

Go to download

A Java based wrapper for the wkhtmltopdf command line tool. As the name implies, it uses WebKit to convert HTML documents to PDFs.

There is a newer version: 1.3.1-RELEASE
Show newest version
package com.github.jhonnymertz.wkhtmltopdf.wrapper.params;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.apache.commons.lang3.StringUtils;

public class Params {

    private Collection params;

    public Params() {
        this.params = new ArrayList();
    }

    public void add(Param param, Param... params) {
        this.params.add(param);
        this.params.addAll( Arrays.asList( params ) );
    }

    public List getParamsAsStringList() {
        List commandLine = new ArrayList();

        for (Param p : params) {
            commandLine.add(p.getKey());

            for (String value : p.getValues()) {
                if (value != null) {
                    commandLine.add(value);
                }
            }
        }

        return commandLine;
    }

    @Override
    public String toString() {
      return StringUtils.join(params, "");
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy