Adding a page header to PDF output
-
Per usual, I've searched the forum and found ... nothing. 😂
Anyway to add a header to each page of the PDF output? Ideally this would include the client's name, dob, and the page number of the PDF itself... too much to ask? I'm crossing my fingers. (Both client's name and dob are stored in separate files from earlier workflows in the process)
I could do this as an outside process in PDFOffice, but automated in editorial would be waaaAaay better.
TIA!
I just wondered if I could somehow abuse the footnote for this purpose? I'd prefer it at the top starting on p2... but ya know, beggars can't be choosers,,, so I'd be happy with any kind of fix for this.
-
I've taken @ccc's basic approach, and turned it into a complete workflow:
http://www.editorial-workflows.com/workflow/5807752689483776/zRswEIOv3yY
The core of this is a custom (Python) action that takes a PDF (generated by the standard "HTML to PDF" action), and adds header/footer text on every page. The text can include regular workflow variables (client name, date...) and page numbers –
{p}
is automatically replaced by the current page number, and{n}
is replaced by the total number of pages.A couple of other things, like font size, margins etc. are also easily configurable by editing the workflow.
-
Yes, please! And thank you?
I had assumed this was a lost cause.
It'll take me a few days to check this out and implement it.
I'm planning on trying to simplify some of the workflow I've created on the directory as well... In an effort to contribute to the community, FWIW.
The workflows I've put together to write this report have worked well. Albeit with some bugs, but that is to be expected.
Thank you all, again, so much!
-
@omz Congratulations! This custom action is really nicely done! Thanks.
-
This post is deleted!last edited by
-
@NikkiSchwartzVB Did @omz's
PDF with page numbers
workflow do what you wanted? To me, it seemed like all the right stuff...
-
I had a chance to play with it last night. It's fantastic.
There is a weird character that shows up at the end of the header text, a black box. But it's not a deal breaker.
Otherwise, it's perfect.
-
weird character that shows up at the end of the header text, a black box
My bet is that is a carriage return (\n) at the end of your header text.
If your header text ends in a variable then be sure to.rstrip()
the text before putting it into that variable.
In any case, make sure that the last character in the header text field is not \n.
-
I've updated the workflow to remove leading and trailing line breaks from header/footer text, as they are indeed rendered as a black box (multiple lines are not supported at all, sorry).
Depending on how you generate the header text, it might also be easy to avoid having it end with a line break.
-
@omz thanks again! It's overall fan friggin tastic. :)
I'll play with this soon