Opened 5 months ago

Closed 3 months ago

#70269 closed defect (fixed)

GDAL Missing PDF Support (at least when installed as dependency for QGIS3)

Reported by: mhanmore Owned by: Veence (Vincent)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: nilason (Nicklas Larsson), Dave-Allured (Dave Allured), cooljeanius (Eric Gallager)
Port: gdal qgis3

Description (last modified by mhanmore)

The issue The GDAL build via MacPorts as part of qgis3 installation currently lacks support for PDF files, which means qgis3 behaves as though PDF files don't exist.

Expected behavior QGIS ships with PDF support in all other distribution modes. GDAL as a QGIS3 dependency should therefore be built with poppler to enable PDF support.

I was able to fix the problem with sudo port install poppler followed by sudo port install gdal +pdf +poppler

Steps to reproduce

  1. Install GDAL as a qgis3 dependency via MacPorts using sudo port install qgis3.
  2. Attempt to open or georeceference a PDF in Qgis3
  3. Run gdalinfo --formats | grep -i pdf.
  4. Observe that PDF support is not listed.

System Information

  • OS: macOS: Sonoma on M3 Max
  • GDAL Versions: Broken: gdal @3.9.0_0+postgresql16+proj9 Fixed: gdal @3.9.0_0+poppler+postgresql16+proj9

Change History (13)

comment:1 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)

Sounds like you've already found the solution. The gdal port doesn't have pdf support enabled by default and you can enable it by installing it with the +poppler variant. (It does not have a +pdf variant.) gdal has many other variants for optional features that you may want to enable. port variants gdal shows you what they are.

comment:2 Changed 5 months ago by mhanmore

Many thanks. If that is a deliberate GDAL deployment decision then I think there is still a change that needs to be made int he QGIS3 port, which needs to specify gdal +poppler in order to achieve feature parity with the other QGIS distribution options.

comment:3 Changed 5 months ago by mhanmore

Description: modified (diff)

comment:4 Changed 5 months ago by nilason (Nicklas Larsson)

Cc: nilason added

comment:5 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to Veence
Port: gdal qgis3 added
Status: newassigned

MacPorts does not have the capability for a port to declare a dependency on a variant of another port, only to declare a dependency on another port. See #126. The active_variants 1.1 portgroup is a workaround that can be used for this.

If qgis3 absolutely requires gdal's pdf support, then gdal's pdf support should be made always on and the variant should be removed, or gdal's pdf support should be separated out into another port upon which qgis3 can then depend.

comment:6 Changed 5 months ago by mhanmore

I'm only one user and not a dev and not associated with the qgis or gdal projects. But to my mind

1) pdf is a very widely used format for exchange of geospatial information, probably the most widely used for sharing outside of full-time GIS professionals. By way of example, drawings for projects undergoing public scrutiny (new roads, new buildings etc.) are always published as PDF. I don't think it is a leap to say lot of users are likely to receive data as PDF, and

2) gdal is specifically designed to be a translation layer for geospatial data, so inclusion of support for such a widely used format doesn't seem like an unusual default setting.

Given that, including pdf support as standard seems likely to match the expectations of a large group of users.

I note that whilst +Poppler alone seems to have resolved the issues I had struck in qgis3, looking at the GDAL documentation (https://gdal.org/drivers/raster/pdf.html) it looks like full PDF support in GDAL requires additional packages PoDoFo and PDFium so if a change is being made to the default configuration then it looks (to a novice like me) like they should be added too (or maybe +poppler also pulls them in?).

comment:7 Changed 5 months ago by nilason (Nicklas Larsson)

The GDAL pdf-driver isn't required for QGIS core functionality, although you are probably right it is commonly used by QGIS users. However, as Ryan noted, there is no way to solve this other than to add the dependency on Poppler to GDAL by default. The port poppler is however fairly "heavy" port, bringing in a number of dependencies, which for other ports (than QGIS) with GDAL as dependency are not necessarily justified. Therefore I'm very hesitant to start adding dependencies to gdal.

The good new is that with the release of GDAL 3.9, it is possible to build drivers as separate plugins. This open up the possibility to create ports for the drivers, just like the gdal-grass port. I haven't got the time to it yet, but I plan to add new ports replacing some of the current variants. A port like e.g. gdal-pdf can then be added as QGIS dependant.

comment:8 Changed 5 months ago by nilason (Nicklas Larsson)

(The pdf-driver requires one of either Poppler, PoDoFo or PDFium.)

comment:9 Changed 5 months ago by mhanmore

That sounds like a great solution. I've no concept of what is involved so the instinct to help is pretty useless... but huge thanks from me and everyone else who benefits from your efforts!

comment:10 Changed 4 months ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added

comment:11 Changed 4 months ago by nilason (Nicklas Larsson)

In 606f55392f0a9ec3b3c846f70e223d9c2f2989ef/macports-ports (master):

gdal-pdf: new gdal PDF driver port

replaces gdal +poppler variant

See: #70269

comment:12 Changed 4 months ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:13 Changed 3 months ago by nilason (Nicklas Larsson)

Resolution: fixed
Status: assignedclosed

In 6b19b13b2611a27db9a8f494764c0524f9bbd9fe/macports-ports (master):

qgis3{-ltr}: Update to 3.38.1 and 3.34.9 (LTR)

Add gdal-pdf dependency.

Closes #70269.

Note: See TracTickets for help on using tickets.