Question

Is it possible that the PDFPageFormatter recalculate bounds for each input feature?


Badge

The PDFPageFormatter transformers handels as follows when more than one feature enters the input port.

 

"If more than one feature enters the same input port, the scaling and centering will be calculated based on the aggregate bounds of the input features. The features will be written to the PDF in the order they entered the input port."

 

I would like the oposit. Is it possible that the PDFPageFormatter recalculates the bounds of the input feature for each input feature?

 

My workflow:

  1. Reading multiple pdf's with different pdf sizes/ heights and widths
  2. Then merging all those pdf files in a single pdf.

 

I would like that the output PDF contains all the read pdf's and keep the original pdf page sizes for each page. (Reading spatial pdf's as rasterized pdf layers is fine!)

 

Thanks,

Mark


2 replies

Badge

I am now solving the problem with this method.

  1. Sort pdf's by width of height, depending if pdf is portrait or landscape
  2. Calculate total count of incoming features (Statisticscalculator)
  3. Give a count to each feature (Counter, start at 1)
  4. Divide features in 5 groups, based on percentage of total count. (Testfilter)
  5. Make 5 Page objects with the same size in the PDF page formatter and route each group to a page object.

 

The pdfpageformatter now calculates the scaling and centering of 5 groups instead of 1. This ensures that only a small group of pdf's get affected when a big pdf sets the scaling and centering. But still interested to see what others come up with!

Userlevel 2
Badge +17

Hi @markvv​ 

I would suggest not using a PDFPageFormatter. The PDFPageFormatter sets PDF format attributes controlling page size, position on page, etc. Since the origin format is already PDF, you should be able to get these format attribute and values from the PDF reader using the pdf_page_metadata reader feature type.

Attached is a workspace demonstrating this method and I hope it helps.

Reply