com.lowagie.text.pdf

Class PdfSmartCopy

public class PdfSmartCopy extends PdfCopy

PdfSmartCopy has the same functionality as PdfCopy, but when resources (such as fonts, images,...) are encountered, a reference to these resources is saved in a cache, so that they can be reused. This requires more memory, but reduces the file size of the resulting PDF document.
Nested Class Summary
static classPdfSmartCopy.ByteStore
Field Summary
HashMapstreamMap
the cache with the streams and references.
Constructor Summary
PdfSmartCopy(Document document, OutputStream os)
Creates a PdfSmartCopy instance.
Method Summary
protected PdfIndirectReferencecopyIndirect(PRIndirectReference in)
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.

Field Detail

streamMap

private HashMap streamMap
the cache with the streams and references.

Constructor Detail

PdfSmartCopy

public PdfSmartCopy(Document document, OutputStream os)
Creates a PdfSmartCopy instance.

Method Detail

copyIndirect

protected PdfIndirectReference copyIndirect(PRIndirectReference in)
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.