Skip to main content
Solved

Write multiple pages to one pdf-file using only one PdfPageFormatter

  • November 29, 2016
  • 9 replies
  • 270 views

peteralstorp
Contributor
Forum|alt.badge.img+7

Hi gurus.

Problem again. I have a varying amount of objects and I want to use only one PpdfPageFormatter to write these into separate pages of ONE pdf-file. I'm assigning every object a unique pdf_page_number and thought this would do the trick, but it doesn't.

Reading the documentation it seems like I need a new PdfPageFormatter for every new page. Can this really be correct? Or am I doing something stupid again?

Peter

Best answer by takashi

Hi @peteralstorp, how about overwriting pdf_page_number with appropriate page number after the PDFPageFormater?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

9 replies

fmelizard
Safer
Forum|alt.badge.img+21
  • Safer
  • November 29, 2016

I made a custom transformer maybe can help you

https://hub.safe.com/transformers/pdfmultipageset


takashi
Celebrity
  • Best Answer
  • November 29, 2016

Hi @peteralstorp, how about overwriting pdf_page_number with appropriate page number after the PDFPageFormater?


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • November 29, 2016

@peteralstorp

Create groups (create a group_id)from the attributes, set a counter (start count = 1) grouped by your group_id to them.

Use pdfpageformater, with default pagenumber = 1

After pdfpageformatter create attribute pdf_page_number = _count.

(like Takashi said, create pdf_page_number after the pdfpageformatter)

Just make sure to group the objects by a counter (starting at 1)


peteralstorp
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • November 29, 2016

I made a custom transformer maybe can help you

https://hub.safe.com/transformers/pdfmultipageset

Thank you, Corrado, I will look into this when I have more time!

 

 


peteralstorp
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • November 29, 2016

Hi @peteralstorp, how about overwriting pdf_page_number with appropriate page number after the PDFPageFormater?

I knew it, I WAS doing something stupid! You're absolutely right, Takashi. THANKS!

 

 


peteralstorp
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • November 29, 2016

@peteralstorp

Create groups (create a group_id)from the attributes, set a counter (start count = 1) grouped by your group_id to them.

Use pdfpageformater, with default pagenumber = 1

After pdfpageformatter create attribute pdf_page_number = _count.

(like Takashi said, create pdf_page_number after the pdfpageformatter)

Just make sure to group the objects by a counter (starting at 1)

Thanks for being thorough, Gio, I sometimes need that! Will have a go at this now!

 

 


peteralstorp
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • November 29, 2016

@peteralstorp

Create groups (create a group_id)from the attributes, set a counter (start count = 1) grouped by your group_id to them.

Use pdfpageformater, with default pagenumber = 1

After pdfpageformatter create attribute pdf_page_number = _count.

(like Takashi said, create pdf_page_number after the pdfpageformatter)

Just make sure to group the objects by a counter (starting at 1)

My question was correctly answered by T. I wish I could mark both answers as CORRECT, but it's not possible. Thanks again. Peter

 

 


redgeographics
Celebrity
Forum|alt.badge.img+62

The right answer has already been given, but I would like to add this:

Make sure you don't leave any gaps in your page numbering. E.g. if you supply page numbers 1, 2, 3 and 5 the PDF Writer will make an empty page 4.


peteralstorp
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • November 30, 2016

Good, thanks!