[Qgis-developer] Multilayer PDF ?

Vincent Mora vincent.mora at oslandia.com
Fri Feb 7 00:05:26 PST 2014


On 06/02/2014 19:31, Larry Shaffer wrote:
> Hi Hugo,
>
> On Thu, Feb 6, 2014 at 6:24 AM, Hugo Mercier 
> <hugo.mercier at oslandia.com <mailto:hugo.mercier at oslandia.com>> wrote:
>
>     Hi,
>
>     I am investigating how multilayer PDF export could be handled
>     through QGIS.
>     This is a feature of the PDF format (called Optional Content Groups)
>     that would allow to keep "layered" representation of a GIS map when
>     exported to a PDF.
>
>     Something similar has been recently done with the SVG format (
>     https://github.com/qgis/QGIS/pull/1092)
>
>     As far as I know :
>     - QPrinter/QPainter is not able to deal with this concept of layer
>     - OGR/GDAL has a driver for Geospatial PDF writing that does support
>     multi layers, but has a very limited support for styling, so it would
>     require to rasterize each layer and put them into the PDF
>     - only a few third-party PDF libraries support writing and OCG,
>     probably
>     poppler is the best option.
>
>     Does anyone see other easier options ?
>
>
> What about generating individual PDF outputs for each 'layer' (i.e. a 
> layer or group of layers in layer legend) first, then combining them 
> into a PDF as layers?
>

The code to generate multi-layered svg can be used for that. What the 
code does is to hide all/show one composer items or map layer at a time 
and render it to a stream, the stream is then post-process (in case of 
svg it's an xml structure) to create the final output.

It would be a nice refactoring to have the same (templated?) function to 
do both.

> This is totally untested, but when using GDAL to generate a 
> geospatial, layered PDF, could the individual 'layer' PDF outputs be 
> piped back into GDAL as DATASOURCEs for individual layers? There seems 
> to be a set order for generating the layers, e.g. raster on bottom 
> with vector layers over top, instead of random instertion, e.g. raster 
> on bottom, then vector, then raster. You might want to ask Mr. 
> Warmerdam about how flexible the PDF layer writing process is, and 
> whether external PDF content can be streamed through to layered output 
> (instead of having any geometries read and styled). There is the 
> EXTRA_STREAM=content creation option, but I don't know if it can be 
> used multiple times to insert external PDFs as layers.
>
> Also, I think the blending modes of individual layers/groups would 
> have to be migrated to PDF-specific (Postcript?) definitions, since 
> each will be rendered separately. Surely standard blending modes for 
> layers can be defined in PDFs (?).
>
> I think this is a *very* important export feature to add to QGIS, and 
> will ultimately help with its adoption in enterprise, institutional 
> and government settings, since such an output fulfills many mandates 
> for publicly releasing a functional representation of data.
>
> Regards,
>
> Larry
>
>     Thanks !
>     --
>     Hugo Mercier
>     Oslandia
>     _______________________________________________
>     Qgis-developer mailing list
>     Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140207/1aa8d823/attachment.html>


More information about the Qgis-developer mailing list