Skip to content
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

add PdfPageEvent.onBeforePageStart #125

Merged
merged 1 commit into from
Mar 30, 2017
Merged

add PdfPageEvent.onBeforePageStart #125

merged 1 commit into from
Mar 30, 2017

Conversation

gered
Copy link
Contributor

@gered gered commented Mar 30, 2017

This event is useful to do per-page adjustments to page size and margins, etc. These types of page properties cannot be changed in onStartPage or onEndPage for the current page... instead, they would take effect in the next page.

Can be used like other page-events, by using the PdfPageEventHelper class, e.g.:

(proxy [cljpdf.text.pdf.PdfPageEventHelper] []
  (onBeforeStartPage [writer doc]
    ; do stuff here
    ))

One slight oddity, is that this new event will fire before the onOpenDocument event for the first page of the document. onOpenDocument fires too late unfortunately and I was worried about potentially breaking backward-compatibility for anyone that might be making heavy use of page-events with clj-pdf.

@yogthos
Copy link
Collaborator

yogthos commented Mar 30, 2017

👍

@coveralls
Copy link

Coverage Status

Coverage remained the same at 48.842% when pulling 9c27450 on before-start-page-event into 418b34b on master.

@gered gered merged commit 3c19d0f into master Mar 30, 2017
@gered gered deleted the before-start-page-event branch March 30, 2017 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants