Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute table frame, with "allow url to be read as HTML format" has not expected result like hyperlink when output PDF file is maked from “GetPrint” request from QGIS Server #52370

Closed
2 tasks done
respeso opened this issue Mar 24, 2023 · 7 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks Server Related to QGIS server

Comments

@respeso
Copy link

respeso commented Mar 24, 2023

What is the bug or the crash?

I want to create a layout with “Attribute table frame”

image

This “Attribute table frame” has an attribute with URL text values, like it is showed in the following image. And also is checked the “Allow url to be read as html format” check button.

image

When layout is exported to PDF with this extra options (*Text export -> Always export text as text objects):

image

The output PDF file is correct, in other words; the url’s behaviour is like a hyperlink (on click, url is opened in internet navigator).

image

But, if output PDF file is maked from “GetPrint” request from QGIS Server. For example: http://localhost/cgi-bin/qgis_mapserv.fcgi.exe?MAP=home/Test.qgz&SERVICE=WMS&VERSION=1.3.0&FORMAT=pdf&TEMPLATE=ficha&REQUEST=GetPrint&SRS=EPSG%3A25830&map0:EXTENT=-2.009,-2.261,1.756,2.856
The url’s behaviour in “Attribute table frame” are not like a hyperlink (on click, url is not opened).
However if the layout component used is a “label” with “Allow url to be read as html format” checked, the result is as expected in the output PDF file (on click, url is opened).

image

image

What can I do to make it work like a hypelink in “Attribute table frame” case?.

Steps to reproduce the issue

Include files and qgis test project with layout.
TextProject.zip

Versions

Versión de QGIS
3.28.4-Firenze
Revisión del código de QGIS
fd0fb72
Versión Qt
5.15.3
Versión de Python
3.9.5
Versión de GDAL/OGR
3.6.2
Versión de PROJ
9.1.1
Versión del registro de base de datos EPSG
v10.076 (2022-08-31)
Versión de GEOS
3.11.1-CAPI-1.17.1
Versión de SQLite
3.39.4
Versión de PDAL
2.4.3
Versión del cliente de PostgreSQL
unknown
Versión de SpatiaLite
5.0.1
Versión de QWT
6.1.6
Versión de QScintilla2
2.13.1
Versión del SO
Windows 10 Version 1903

Complementos activos de Python
GroupStats
2.2.6
profiletool
4.2.3
db_manager
0.1.20
grassprovider
2.12.99
MetaSearch
0.3.6
processing
2.12.99
sagaprovider
2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

@respeso respeso added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Mar 24, 2023
@agiudiceandrea agiudiceandrea added Server Related to QGIS server Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks labels Mar 27, 2023
@elpaso
Copy link
Contributor

elpaso commented Jun 12, 2023

I had a quick look at the issue, the option that makes the difference here when exporting to PDF is: Qgis::TextRenderFormat::AlwaysText, documented as:

Always render text as text objects. While this mode preserves text objects as text for post-processing in external vector editing applications, it can result in rendering artifacts or poor quality rendering, depending on the text format settings. Even with raster based paint devices, TextFormatAlwaysText can result in inferior rendering quality to TextFormatAlwaysOutlines. When rendering using TextFormatAlwaysText to a vector based device (e.g. PDF or SVG), care must be taken to ensure that the required fonts are available to users when opening the created files, or default fallback fonts will be used to display the output instead. (Although PDF exports MAY automatically embed some fonts when possible, depending on the user's platform).

Now, while in QGIS desktop the user can interactively choose the export options, this is of course not possible in the server context.

I am not sure we should enable it by default, given the warnings documented above.

In theory we could add a new vendor parameter to customize this option but I would turn this into a feature request.

@nyalldawson am I correct about the analysis?

@respeso
Copy link
Author

respeso commented Nov 28, 2023

Although it is not possible to choose this export option dynamically in the server context. Is it possible to set the value of this variable through the environment variables defined in the httpd_qgis.conf file?

@elpaso
Copy link
Contributor

elpaso commented Jan 26, 2024

Although it is not possible to choose this export option dynamically in the server context. Is it possible to set the value of this variable through the environment variables defined in the httpd_qgis.conf file?

no

@elpaso
Copy link
Contributor

elpaso commented Jan 26, 2024

Actually, I checked the code now and the option can be activated by passing FORMAT_OPTIONS=TEXT_RENDER_FORMAT:AlwaysText in the query string.

the documentation here is wrong: https://docs.qgis.org/3.28/en/docs/server_manual/services/wms.html#format-options the FORMAT_OPTIONS also applies to PDF and not all available options are listed.

@elpaso
Copy link
Contributor

elpaso commented Jan 26, 2024

I will open an documentation issue, this one can be closed

@elpaso
Copy link
Contributor

elpaso commented Jan 26, 2024

@respeso
Copy link
Author

respeso commented Jan 29, 2024

It has been some time since I have consulted the solution to this error. Now that I see it solved, I can't stop thanking you. I have tried it and it works perfectly.

@respeso respeso closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks Server Related to QGIS server
Projects
None yet
Development

No branches or pull requests

3 participants