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

Igor Savin commented on PDFBOX-2835:
------------------------------------

There is a couple of problems we are trying to solve:

1) Currently it is implied that the end result of overlaying should be written 
to a File. That is not quite always so - sometimes you only want to get an 
InputStream you pass somewhere down the line, and current code does not allow 
that at all. Obviously an alternate way of solving that would be to have both 
output filename and outputstream being settable, and write to whatever is not 
null, but that is somewhat less clean way to approach that.

2) There is a highly sensitive problem of overlaying a smaller pdf (e. g. an A4 
size watermark) over a larger one (e. g. A3 document). Currently it does not 
get applied nicely to the upper right corner of the document, but gets placed 
somewhere in the center of the original larger document instead, and there is 
absolutely no way to alter that behaviour other than to fork entire PDFBox. 
Obviously other workaround may be attempted, such as scaling the watermark up, 
however PDFBox does not seem to provide a nice and easy way to scale PDF's, the 
only option being convert-to-image-convert-to-pdf-again manipulations that we 
didn't yet manage to get working. If there was a way to affect composition of 
overlaying (e. g. to specify relative coords of watermark to original 
document), that would be enough.

3) You can only define overlaying for the first, last and the others pages, 
which is a satisfying level of granularity, but I see no reason why it cannot 
be taken further and give a way for users themselves to decide what pages are 
being overlayed. It's not that important, though.

> [PATCH] Make Overlay class properly extendable
> ----------------------------------------------
>
>                 Key: PDFBOX-2835
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2835
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.8.9
>            Reporter: Igor Savin
>
> We are trying to implement custom logic for overlaying documents. However, 
> current PDFBox implementation is excessively strictly encapsulated and it's 
> not really possible. What makes things worse, overlay implementation is very 
> strict about the way output gets processed. Please find attached link to the 
> patch that makes overlay logic more flexible by:
> 1) Making some of the methods protected;
> 2) Moving output logic to a method that can be overridden.
> 3) Moving getting list of pages to be processed logic to a method that can be 
> overridden.
> http://kiberion.net/kibertoad/0001-Modify-Overlay-class-for-improved-extensibility.patch
> If there are some adjustments that should be done or a separate version made 
> for trunk - please let me know, I'll get to it immediately.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to