Skip to main content

I have a workbench which writes individual objects to multi page PDF. The page number is defined using 'count' and assigning a 'group' which is then used after the PDF PageFormatter to specify 'pdf_page_number. However I now need to have 2 objects per page. Can anyone advise how I can group these automatically into groups of 2 to write per page?

Introduce a second number to order the page and us a Sorter before writing to the pdf. Or maybe I understand your question wrong. Do you mean you want to print two pdfpageformatters-pages on one page?


Introduce a second number to order the page and us a Sorter before writing to the pdf. Or maybe I understand your question wrong. Do you mean you want to print two pdfpageformatters-pages on one page?

 

@stalknecht Thanks - No you are correct, only one PDFPagFormatter. The problem is how do I auto number them? I have map and text elements which as they pass through the count are allocated numbers. They are in order so that the relevant text goes with each map.

So you have this sort of scenario

ObjectCountPage one Map0Page one Text1Page two Map2Page two Text3

And want to get to this?

ObjectGroupPage one Map0Page one Text0Page two Map2Page two Text2

If this is the case there are a couple of different options you could try, depending on how confident you are of everything coming through in the correct order.

Simplest would probably be an attribute creator to create the pdf_page_number with a conditional statement that says if number is even set the pdf_page_number to the count, if the number is odd set the pdf_page_number to the count minus 1


So you have this sort of scenario

ObjectCountPage one Map0Page one Text1Page two Map2Page two Text3

And want to get to this?

ObjectGroupPage one Map0Page one Text0Page two Map2Page two Text2

If this is the case there are a couple of different options you could try, depending on how confident you are of everything coming through in the correct order.

Simplest would probably be an attribute creator to create the pdf_page_number with a conditional statement that says if number is even set the pdf_page_number to the count, if the number is odd set the pdf_page_number to the count minus 1

@egomm - not quite -

 

my maps and text are counted

 

separately -

 

 

CountMap 11Map 22Map 33Map 44Map 1 text1Map 2 text2Map 3 text3Map 4 text4So I want to get to -

 

GroupMap 11Map 21Map 32Map 42Map 1 text1Map 2 text1Map 3 text2Map 4 text2

 


@egomm - not quite -

 

my maps and text are counted

 

separately -

 

 

CountMap 11Map 22Map 33Map 44Map 1 text1Map 2 text2Map 3 text3Map 4 text4So I want to get to -

 

GroupMap 11Map 21Map 32Map 42Map 1 text1Map 2 text1Map 3 text2Map 4 text2

 

Ah, just checked and the PDFPageFormatter doesn't have a group by option, so this is not straightforward after all.

 

Vote for this idea https://knowledge.safe.com/idea/76412/add-group-by-support-in-pdfpageformatter.html

 

 


So you have this sort of scenario

ObjectCountPage one Map0Page one Text1Page two Map2Page two Text3

And want to get to this?

ObjectGroupPage one Map0Page one Text0Page two Map2Page two Text2

If this is the case there are a couple of different options you could try, depending on how confident you are of everything coming through in the correct order.

Simplest would probably be an attribute creator to create the pdf_page_number with a conditional statement that says if number is even set the pdf_page_number to the count, if the number is odd set the pdf_page_number to the count minus 1

that sounds like it might work 🙂 but I've no idea how to format a condition to test for 'even or odd'?

 

 


that sounds like it might work 🙂 but I've no idea how to format a condition to test for 'even or odd'?

 

 

The following arithmetic expression returns zero for odd numbers and one for even numbers

 

@fmod(@Value(attribute),2)

 

 


The following arithmetic expression returns zero for odd numbers and one for even numbers

 

@fmod(@Value(attribute),2)

 

 

@egomm

 

yes just found the expression but don't think 'even/odd' solution will work??

 

1= same12-113-1?24-2?25-2?36-3?3
@egomm

 

yes just found the expression but don't think 'even/odd' solution will work??

 

1= same12-113-1?24-2?25-2?36-3?3
It doesn't look like your conditional statement is set up correctly, but if you do have the set up that you posted, where Map 1 has a count value of 1 and Map text 1 has a value of 1 you shouldn't need any of it. You just need to set pdf_page_number to equal count after the pdfpageformatter
It doesn't look like your conditional statement is set up correctly, but if you do have the set up that you posted, where Map 1 has a count value of 1 and Map text 1 has a value of 1 you shouldn't need any of it. You just need to set pdf_page_number to equal count after the pdfpageformatter
@egommNo the table above is just showing an example of what I need, it's not my conditional statement. I was trying to point out that a uniform condition e.g.

 

'if number is even set the pdf_page_number to the count, if the number is odd set the pdf_page_number to the count minus 1' won't work.
It doesn't look like your conditional statement is set up correctly, but if you do have the set up that you posted, where Map 1 has a count value of 1 and Map text 1 has a value of 1 you shouldn't need any of it. You just need to set pdf_page_number to equal count after the pdfpageformatter
Something like @Evaluate(@ceil(@Value(_count)/2)) then?

 

 

Though as I said above, the pdf page formatter doesn't have a group by so depending on the data you have to display, there are additional things you will need to consider to get this working, i.e. correctly setting pdf_world_rectangle attributes

 

 


Solved this by using Grouper (sampling rate 2) then later using Duplicate Filter to pass Group 1s and 2s to desired port on PDFPageFormatter. :-)


Reply