[ 
https://issues.apache.org/jira/browse/PDFBOX-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16682437#comment-16682437
 ] 

Wiktor Kwapisiewicz commented on PDFBOX-4375:
---------------------------------------------

Hi Tilman,

Yes, Overlay is riddled with Strings that are paths. Unfortunately I need to 
specify different overlays per different pages. I'm using the {{overlay}} 
method (that takes a {{Map<Integer, String>}} where Integer points to a page 
number and String is a File path).

Maybe a different solution would be an overload that takes a {{Map<Integer, 
PDDocument>s}} (or a {{List<PDDocument>}} where {{null}} means no overlay for 
that page).

Changing the visibility to {{protected}} was a smallest backwards-compatible 
change that allowed me to use inputs that are not Files per page, making 
{{String}} objects identifiers (as you point out).

What do you think would be the best approach here?

Thank you for your time!

Kind regards,

Wiktor

> Change visibility of Overlay#loadPDF to protected
> -------------------------------------------------
>
>                 Key: PDFBOX-4375
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4375
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 2.0.12
>            Reporter: Wiktor Kwapisiewicz
>            Priority: Minor
>              Labels: Overlay
>         Attachments: 
> 0001-Change-visibility-of-Overlay-loadPDF-to-protected.patch
>
>
> Overriding loadPDF allows subclasses to load overlays from sources different 
> than File objects, for example from InputStreams or byte arrays (mostly 
> through PDDocument.load overloads).
> For example:
> {code:java}
> Overlay overlay = new Overlay() {
>     @Override
>     protected PDDocument loadPDF(String pdfName) throws IOException {
>         return PDDocument.load(overlayStreams.get(pdfName));
>     }
> };
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to