<div dir="ltr">Hi, <div>the internal c++ API is not intended for use by external applications, only by frontends. So, if you want a stable API, you should be using either of the frontends. There is a cpp frontend that should be fare more stable. </div><div><br></div><div>Regards</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 10, 2017 at 10:41 AM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div style="font-family:'monospace';font-size:9pt;font-weight:400;font-style:normal">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Hi,</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">I'm one of the developper of the GDAL library (<a href="http://gdal.org" target="_blank">http://gdal.org</a>) that reads various raster & vector formats, mostly geospatial, including PDF and its georeferencing extensions (either expressed wtih Adobe Supplement to ISO 32000 or with Open Geospatial Consortium Best Practice:</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><a href="https://portal.opengeospatial.org/files/?artifact_id=40537" target="_blank">https://portal.opengeospatial.<wbr>org/files/?artifact_id=40537</a> )</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Currently we use the Poppler internal C++ API and regularly must adjust for changes in it. Recently we had to do adjustments to accomodate for Poppler 0.58 changes. Supporting multiple Poppler versions begin to make our code ugly. So I and packagers from Linux distribution are wondering if there would be a way to access a more stable C++ API</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Besides rendering as image, we need really low-level access to PDF objects, to be able to parse georeferencing objects, retrieve layers, turn on/off OCG, or even access streams to decode drawing instructions so as to build vector objects</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">I've tried to summarize below our current use of Poppler C++ API. I probably missed a few calls, but you should get the overall picture:</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- Object class: getType(), getTypeName(), getBool(), getInt(), getReal(), getString(), getName(), getStream(), getArray()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- Dict class: lookupNF(), lookup(), getLength(), getKey()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- Array class: getLength(), getNF(), get()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- Stream class: getDict(), reset(), getChar(), fillGooString()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- Catalog class: getPage(), getPageRef(), readMetadata()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- GooString: getCString(), getLength()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- Ref class: access to num and gen</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- PDFDoc class: isOk(), displayPageSlice(), getCatalog(), getOptContentConfig(), getNumPages(), getDocInfo(), getErrorCode(), str private member(accessed through a ugly "#define private public" before including poppler! we need to access it to be able to delete it with our heap since we allocated a stream object provided to PDFDoc() constructor. this is to avoid potential problems on Windows with cross-heap issues)</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- Page class: isOk(), pageObj private member (accessed through a ugly "#define private public" before including poppler!), getMediaBox()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- OCGs class: isOk(), getOCGs()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- GooList class: getLength(), get()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- OptionalContentGroup class: setState()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- SplashBitmap class: getBitmap(), getWidth(), getHeigh(), getDataPtr(), getAlphaPtr(), getAlphaRowSize(), getRowSize()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- SplashOutputDev class: we subclass this class and override all/most virtual methods to be able to turn on/off rendering of various elements as we offer options to render selectively vector, raster and/or text elements (so basically just a conditional test to decide whether to return as a no-op or call the base implementation)</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- BaseStream class: we subclass this class to use GDAL own I/O abstraction layer (which beyond regular files can read in .zip files, in-memory files, files available through HTTP, etc...). So we implement copy(), makeSubStream(), getPos(), getStart(), setPos(), moveStart(), getKind(), getFileName(), getChar(), makeSubStream(), lookChar(), reset(), unfilteredReset(), close(), hasGetChars(), getChars()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- GlobalParams class: setPrintCommands()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">- setErrorCallback() function</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">If you want to glance at the code, the most relevant files are:</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><a href="https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/pdf/pdfobject.cpp" target="_blank">https://github.com/OSGeo/gdal/<wbr>blob/trunk/gdal/frmts/pdf/<wbr>pdfobject.cpp</a></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><a href="https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/pdf/pdfio.cpp" target="_blank">https://github.com/OSGeo/gdal/<wbr>blob/trunk/gdal/frmts/pdf/<wbr>pdfio.cpp</a></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><a href="https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/pdf/pdfdataset.cpp" target="_blank">https://github.com/OSGeo/gdal/<wbr>blob/trunk/gdal/frmts/pdf/<wbr>pdfdataset.cpp</a></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">I'm not clear if that would be feasible for Poppler to provide a more stable API for our use. At least, this makes you aware of external users of this API.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Best regards,</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Even</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">-- </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Spatialys - Geospatial professional services</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a></p></div><br>______________________________<wbr>_________________<br>
poppler mailing list<br>
<a href="mailto:poppler@lists.freedesktop.org">poppler@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/poppler" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/poppler</a><br>
<br></blockquote></div><br></div>