-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Control of PDPage creation via PDFCreationListener #334
Conversation
Update to Head
Update to head
Added onCreatePage to PDFCreationListener. Added fireOnCreatePage to PdfBoxRenderer - by default this just creates a PDPage and adds it to the PDDocument (old behavior). This allows the user more control over the page that is created and also control when (or if) a page is to be added to the PDDocument.
danfickle#8 Online sandbox now at RC18. [ci skip]
Hi @DSW-PS, Thanks a lot for the PR. I think that allowing the user to control page creation is a good idea. However, I’m not sure that using So I would prefer a specific lambda compatible interface for the callback and the ability to set it from the builder. Maybe What do you think? If you think this is reasonable, I could do it when time permits, or it would be great if this pr or another implemented it! Thanks again, P.S. Anyone have any idea why Travis ci hasn’t picked this pr up? |
|
(See danfickle#334) Based on the suggested by @danfickle, reverted the changes to PDFCreationListener and PdfBoxRenderer, instead a PageSupplier can be set via the PdfRendererBuilder. The PageSupplier.requestPage allows the user to create a new page or supply an existing one where the Html will be printed. PdfRendererBuilder implements PageSupplier and simply creates a new page and adds it to the PDDocument.
…into open-dev-v1
Hi @danfickle, I tried to understand what the shadow-pages are for (or how they are formed) but I can't say I understand. Nevertheless I took your advice and removed the changes to the Tell me what you think, |
Thanks @DSW-PS, Shadow pages are there for cut-off pages. The pr is looking good. Only minor concerns: Page number should be zero based (use |
Added a brief explanation what "shadow-pages" are to the PageSupplier. As @danfickle pointed out, the current-page index (i) should be used as pageNumber argument for PageSupplier in PdfBoxRenderer when building the shadow-pages and not the pdfPageIndex (which at this point has already been upped by one). Also first call to PageSupplier should (for the first page) should be with pageNumber 0, not 1.
Hi @danfickle, thanks for the explanation. I added a brief comment with link to the cut-off pages wiki page to the Now using |
Sensational. Thanks a lot @DSW-PS. |
I'm the worst offender with tabs but they are evil!
Hello,
I think it would be a good idea to give the user more control over how a
PDPage
is created and added to thePDDocument
.I modified the
PdfBoxRenderer
to delegate the page-creation to thePDFCreationListener
(if one is set).(In our case we already have
PDPage
with some data created and now need to print the rest - we could of course just print the html to pdf to import and place the document, but this way it is only a matter of setting where the html is to begin via some styling rules, much more simpler and streamlined)Kind regards
Peter