Example usage for com.lowagie.text.pdf PdfBoolean PDFFALSE

List of usage examples for com.lowagie.text.pdf PdfBoolean PDFFALSE

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfBoolean PDFFALSE.

Prototype

PdfBoolean PDFFALSE

To view the source code for com.lowagie.text.pdf PdfBoolean PDFFALSE.

Click Source Link

Usage

From source file:org.jrimum.bopepo.pdf.PdfDocMix.java

License:Apache License

/**
 * Inicializa os principais objetos para a escrita dos dados do documento no
 * template PDF: {@code stamper}, {@code reader} e {@code outputStream}.
 * /*w  ww .j  a v  a2s  . com*/
 * @since 0.2
 */
private void init() {

    try {

        reader = new PdfReader(getTemplate());

        outputStream = new ByteArrayOutputStream();

        stamper = new PdfStamper(reader, outputStream);

        final String JRIMUM = "jrimum.org/bopepo";

        String creator = docInfo.creator();

        if (isBlank(creator)) {
            withCreator(JRIMUM);
        } else {
            withCreator(creator + " by (" + JRIMUM + ")");
        }

        if (isNull(docInfo.creation())) {
            docInfo.creation(Calendar.getInstance());
        }

        stamper.setMoreInfo((HashMap<?, ?>) docInfo.toMap());

        if (isNotNull(displayDocTitle)) {
            stamper.addViewerPreference(PdfName.DISPLAYDOCTITLE,
                    displayDocTitle ? PdfBoolean.PDFTRUE : PdfBoolean.PDFFALSE);
        }

        form = stamper.getAcroFields();

    } catch (Exception e) {

        Exceptions.throwIllegalStateException(e);
    }
}

From source file:org.sejda.impl.itext.ViewerPreferencesTask.java

License:Apache License

/**
 * /*from w  w  w .j  av  a  2  s.  c  o  m*/
 * @param parameters
 * @return a map of preferences with corresponding value to be set on the documents
 */
private Map<PdfName, PdfObject> getConfiguredViewerPreferencesMap(ViewerPreferencesParameters parameters) {
    Map<PdfName, PdfObject> confPreferences = new HashMap<PdfName, PdfObject>();
    if (parameters.getDirection() != null) {
        confPreferences.put(PdfName.DIRECTION, ViewerPreferencesUtils.getDirection(parameters.getDirection()));
    }
    if (parameters.getDuplex() != null) {
        confPreferences.put(PdfName.DUPLEX, ViewerPreferencesUtils.getDuplex(parameters.getDuplex()));
    }
    if (parameters.getPrintScaling() != null) {
        confPreferences.put(PdfName.PRINTSCALING,
                ViewerPreferencesUtils.getPrintScaling(parameters.getPrintScaling()));
    }
    confPreferences.put(PdfName.NONFULLSCREENPAGEMODE,
            ViewerPreferencesUtils.getNFSMode(parameters.getNfsMode()));

    Set<PdfBooleanPreference> activePref = parameters.getEnabledPreferences();
    for (PdfBooleanPreference boolPref : PdfBooleanPreference.values()) {
        if (activePref.contains(boolPref)) {
            confPreferences.put(ViewerPreferencesUtils.getBooleanPreference(boolPref), PdfBoolean.PDFTRUE);
        } else {
            confPreferences.put(ViewerPreferencesUtils.getBooleanPreference(boolPref), PdfBoolean.PDFFALSE);
        }
    }
    return confPreferences;
}