/** * Sets the Viewport for the next page. * @param vp an array consisting of Viewport dictionaries. * @since 5.1.0 */ public void setPageViewport(final PdfArray vp) { addPageDictEntry(PdfName.VP, vp); }
/** * Sets the Viewport for the next page. * @param vp an array consisting of Viewport dictionaries. * @since 5.1.0 */ public void setPageViewport(final PdfArray vp) { addPageDictEntry(PdfName.VP, vp); }
public class RotateEvent extends PdfPageEventHelper { public void onStartPage(PdfWriter writer, Document document) { writer.addPageDictEntry(PdfName.ROTATE, PdfPage.SEASCAPE); } }
public class Rotate extends PdfPageEventHelper { protected PdfNumber rotation = PdfPage.PORTRAIT; public void setRotation(PdfNumber rotation) { this.rotation = rotation; } public void onEndPage(PdfWriter writer, Document document) { writer.addPageDictEntry(PdfName.ROTATE, rotation); } }
/** * Sets the display duration for the page (for presentations) * @param seconds the number of seconds to display the page */ void setDuration(final int seconds) { if (seconds > 0) writer.addPageDictEntry(PdfName.DUR, new PdfNumber(seconds)); }
/** * Sets the display duration for the page (for presentations) * @param seconds the number of seconds to display the page */ void setDuration(final int seconds) { if (seconds > 0) writer.addPageDictEntry(PdfName.DUR, new PdfNumber(seconds)); }
/** * Sets the transition for the page * @param transition the PdfTransition object */ void setTransition(final PdfTransition transition) { writer.addPageDictEntry(PdfName.TRANS, transition.getTransitionDictionary()); }
/** * Sets the transition for the page * @param transition the PdfTransition object */ void setTransition(final PdfTransition transition) { writer.addPageDictEntry(PdfName.TRANS, transition.getTransitionDictionary()); }
void setThumbnail(final Image image) throws PdfException, DocumentException { writer.addPageDictEntry(PdfName.THUMB, writer.getImageReference(writer.addDirectImageSimple(image))); }
void setThumbnail(final Image image) throws PdfException, DocumentException { writer.addPageDictEntry(PdfName.THUMB, writer.getImageReference(writer.addDirectImageSimple(image))); }
/** * Use this method to set the user unit. * A UserUnit is a value that defines the default user space unit. * The minimum UserUnit is 1 (1 unit = 1/72 inch). * The maximum UserUnit is 75,000. * Note that this userunit only works starting with PDF1.6! * @param userunit The userunit to set. * @throws DocumentException on error */ public void setUserunit(final float userunit) throws DocumentException { if (userunit < 1f || userunit > 75000f) throw new DocumentException(MessageLocalization.getComposedMessage("userunit.should.be.a.value.between.1.and.75000")); addPageDictEntry(PdfName.USERUNIT, new PdfNumber(userunit)); setAtLeastPdfVersion(VERSION_1_6); }
/** * Use this method to set the user unit. * A UserUnit is a value that defines the default user space unit. * The minimum UserUnit is 1 (1 unit = 1/72 inch). * The maximum UserUnit is 75,000. * Note that this userunit only works starting with PDF1.6! * @param userunit The userunit to set. * @throws DocumentException on error */ public void setUserunit(final float userunit) throws DocumentException { if (userunit < 1f || userunit > 75000f) throw new DocumentException(MessageLocalization.getComposedMessage("userunit.should.be.a.value.between.1.and.75000")); addPageDictEntry(PdfName.USERUNIT, new PdfNumber(userunit)); setAtLeastPdfVersion(VERSION_1_6); }
/** * Use this method to set the XMP Metadata. * @param xmpMetadata The xmpMetadata to set. * @throws IOException */ public void setXmpMetadata(final byte[] xmpMetadata) throws IOException { PdfStream xmp = new PdfStream(xmpMetadata); xmp.put(PdfName.TYPE, PdfName.METADATA); xmp.put(PdfName.SUBTYPE, PdfName.XML); PdfEncryption crypto = writer.getEncryption(); if (crypto != null && !crypto.isMetadataEncrypted()) { PdfArray ar = new PdfArray(); ar.add(PdfName.CRYPT); xmp.put(PdfName.FILTER, ar); } writer.addPageDictEntry(PdfName.METADATA, writer.addToBody(xmp).getIndirectReference()); }
/** * Use this method to set the XMP Metadata. * @param xmpMetadata The xmpMetadata to set. * @throws IOException */ public void setXmpMetadata(final byte[] xmpMetadata) throws IOException { PdfStream xmp = new PdfStream(xmpMetadata); xmp.put(PdfName.TYPE, PdfName.METADATA); xmp.put(PdfName.SUBTYPE, PdfName.XML); PdfEncryption crypto = writer.getEncryption(); if (crypto != null && !crypto.isMetadataEncrypted()) { PdfArray ar = new PdfArray(); ar.add(PdfName.CRYPT); xmp.put(PdfName.FILTER, ar); } writer.addPageDictEntry(PdfName.METADATA, writer.addToBody(xmp).getIndirectReference()); }
public void createPdf(String dest) throws IOException, DocumentException { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest)); document.open(); document.add(new Paragraph("Page 1")); document.newPage(); document.add(new Paragraph("Page 2")); document.newPage(); document.add(new Paragraph("Page 3")); document.newPage(); document.add(new Paragraph("Page 4")); writer.addPageDictEntry(new PdfName("ITXT_PageMarker"), new PdfString("Marker for page 4")); document.newPage(); document.add(new Paragraph("Page 5")); document.newPage(); document.add(new Paragraph("Page 6")); writer.addPageDictEntry(new PdfName("ITXT_PageMarker"), new PdfName("PageMarker")); document.newPage(); document.add(new Paragraph("Page 7")); writer.addPageDictEntry(new PdfName("ITXT_PageMarker"), new PdfNumber(7)); document.newPage(); document.add(new Paragraph("Page 8")); document.close(); }