Class PDFDocument

  • All Implemented Interfaces:
    Document

    class PDFDocument
    extends SizedDocument
    Represents a Document in the Portable Document Format (PDF).
    • Field Detail

      • MM_IN_UNITS

        private static final double MM_IN_UNITS
        Constant to convert values from millimeters to PostScript®/PDF units (1/72th inch).
        See Also:
        Constant Field Values
      • STROKE_ENDCAPS

        private static final java.util.Map<java.lang.Integer,​java.lang.Integer> STROKE_ENDCAPS
        Mapping of stroke endcap values from Java to PDF.
      • STROKE_LINEJOIN

        private static final java.util.Map<java.lang.Integer,​java.lang.Integer> STROKE_LINEJOIN
        Mapping of line join values for path drawing from Java to PDF.
      • objects

        private final java.util.List<PDFObject> objects
      • crossReferences

        private final java.util.Map<PDFObject,​java.lang.Long> crossReferences
        Cross-reference table ("xref").
      • contents

        private final Stream contents
      • images

        private final java.util.Map<java.lang.Integer,​PDFObject> images
      • transformed

        private boolean transformed
    • Method Detail

      • initPage

        private Stream initPage()
        Initializes the document and returns a Stream representing the contents.
        Returns:
        Stream to which the contents are written.
      • setFont

        private void setFont​(java.lang.String fontId,
                             float fontSize,
                             Stream contents)
      • addObject

        private DefaultPDFObject addObject​(java.util.Map<java.lang.String,​java.lang.Object> dict,
                                           Payload payload)
      • addDictionary

        private DefaultPDFObject addDictionary​(java.util.Map<java.lang.String,​java.lang.Object> dict)
      • writeTo

        public void writeTo​(java.io.OutputStream out)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • getId

        private int getId​(PDFObject object)
      • getVersion

        private int getVersion​(PDFObject object)
        Returns the version of the specified object.
        Parameters:
        object - PDFObject whose version should be determined.
        Returns:
        Version number.
      • toBytes

        private byte[] toBytes​(Resources resources)
      • toBytes

        private byte[] toBytes​(Stream stream)
      • serialize

        protected static byte[] serialize​(Stream stream)
      • serialize

        protected static byte[] serialize​(TrueTypeFont font)
      • toBytes

        public byte[] toBytes​(PDFObject object)
      • serialize

        private byte[] serialize​(java.lang.Object obj)
      • toBytes

        private byte[] toBytes​(Command<?> command)
      • applyStateCommands

        private void applyStateCommands​(java.util.List<Command<?>> commands)
      • getOutput

        private byte[] getOutput​(java.awt.Color color)
      • getOutput

        private byte[] getOutput​(java.awt.Shape s)
      • getOutput

        private byte[] getOutput​(java.awt.Stroke s)
      • getOutput

        private static byte[] getOutput​(java.awt.geom.AffineTransform transform)
      • getOutput

        private static byte[] getOutput​(java.lang.String str,
                                        double x,
                                        double y)
      • getOutput

        private static byte[] getOutput​(java.lang.String str)
      • getOutput

        private static byte[] getOutput​(PDFObject image,
                                        double x,
                                        double y,
                                        double width,
                                        double height,
                                        Resources resources)
      • close

        public void close()