[
https://issues.apache.org/jira/browse/PDFBOX-1263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Lehmkühler closed PDFBOX-1263.
--------------------------------------
Resolution: Won't Fix
Assignee: Andreas Lehmkühler
This is no longer needed as the new overlayer (o.a.p.tools.OverlayPDF) uses
FormXObjects to overlay pages.
> [PATCH] Rewrite Overlay.java's stream rewriting and rsrc dict renaming to use
> PDFStreamProcessor
> ------------------------------------------------------------------------------------------------
>
> Key: PDFBOX-1263
> URL: https://issues.apache.org/jira/browse/PDFBOX-1263
> Project: PDFBox
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.7.0
> Environment: N/A
> Reporter: Craig Ringer
> Assignee: Andreas Lehmkühler
> Priority: Minor
> Labels: newbie, overlay, patch, refactoring
> Attachments:
> 0003-Major-rework-of-Overlay.java-to-use-PDFStreamProcess.patch
>
>
> The attached patch reworks the handling of content stream rewriting for
> resource dictionary clash avoidance in Overlay.java .
> Prior to this patch, Overlay appends "overlay" to all names in the Font,
> XObject and ExGState resource dictionaries, then rewrites content stream(s)
> in the overlay PDF to reference those new names using a simple hand-rolled
> content-stream find-and-replace process. It doesn't check for over-length
> names, and it doesn't check to make sure that the newly generated name(s)
> don't clash. Because PDFs often use the same names for objects, this quickly
> becomes a problem when you're doing multiple overlays - something that
> becomes more likely with https://issues.apache.org/jira/browse/PDFBOX-1255
> but is already useful to do with stock PDFBox.
> This patch alters Overlay so that it only renames objects from the overlay
> PDF when there is a conflict with the PDF being overlaid upon. It also uses a
> name generation strategy that checks for conflicts and for over-length names,
> so multiple overlays will work much better. The patch uses the
> PDFStreamProcessor (a simplified base extracted from PDFStreamEngine by
> https://issues.apache.org/jira/browse/PDFBOX-1256) to copy each stream from
> the PDF to overlay to a ContentStreamWriter. It checks for names that
> reference renamed resources and substitutes the new name before writing each
> operator and its arguments to the output stream.
> The main benefit of this patch is that it enables multiple overlays without
> name clashes.
> A secondary benefit of this patch is that it eliminates Overlay.java
> -specific code in favour of using facilities provided by the rest of PDFBox.
> That makes Overlay a better example, helps it test the rest of PDFBox better,
> and makes it benefit from improvements in PDFBox's stream processor and
> writer.
> Depends on prior patches in series:
> https://issues.apache.org/jira/browse/PDFBOX-1256
> https://issues.apache.org/jira/browse/PDFBOX-1255
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)