Question

Remove layer from PDF (flatten)


Badge +3

I'm using a geospatial pdf writer to export a map that was styled with a PDFPageFormatter. The PDF opens correctly in Adobe reader, but not in a webbrowser (Chrome/Firefox). After removing the layer by flattening the pdf (using an online tool or Ghostscript) opening the PDF in a webbrowser is possible.

 

Is there a possibility in FME to flatten the PDF, the PDF-writer always demands a layer name... So writing without creating a layer is impossible.


3 replies

Badge +2

Hi @joeri​ 

Are you writing raster or vector features to the PDF? Have you tried enabling the PDF 1.4 compatibility parameter in the writer parameters? The PDF writer should only be writing out a layer for each writer feature type you have on the canvas so it might be helpful to narrow down which layer is causing the issue(s).

I imagine there are no warnings/errors being reported in the log file... but if there are, could you please post the warning message?

Userlevel 4
Badge +25

PDF always needs at least one layer, so you can effectively flatten a PDF by writing everything to the same layer (and relying on the sort order to make sure everything comes up in the correct order).

Badge +3

Writing a combination of raster and vector which I've added to one PDFPageFormatter, so resulting in 1 layer.

When I open the pdf in Acrobat Reader it shows the 1 layer:

1layerSo this opens correct in Acrobat, but opening this pdf in e.g. Firefox is not possible.

 

When I use Ghostscript (or an online tool (search on Flatten PDF Online)), no layers are shwon anymore and opening in a webbrowser becomes possible.

NoLayers

Reply