Class PdfSmartCopy

    • Constructor Detail

      • PdfSmartCopy

        public PdfSmartCopy​(Document document,
                            java.io.OutputStream os)
                     throws DocumentException
        Creates a PdfSmartCopy instance.
        Parameters:
        os - the OutputStream
        document - the document
        Throws:
        DocumentException - on error
    • Method Detail

      • copyIndirect

        protected PdfIndirectReference copyIndirect​(PRIndirectReference in)
                                             throws java.io.IOException,
                                                    BadPdfFormatException
        Translate a PRIndirectReference to a PdfIndirectReference In addition, translates the object numbers, and copies the referenced object to the output file if it wasn't available in the cache yet. If it's in the cache, the reference to the already used stream is returned.

        NB: PRIndirectReferences (and PRIndirectObjects) really need to know what file they came from, because each file has its own namespace. The translation we do from their namespace to ours is *at best* heuristic, and guaranteed to fail under some circumstances.

        Overrides:
        copyIndirect in class PdfCopy
        Parameters:
        in - the PRIndirectReference to translate
        Returns:
        the translated PRIndirectReference
        Throws:
        java.io.IOException - on error
        BadPdfFormatException - on error with the Pdf format