Bug report #7894
QGIS Server - GetPrint request does not respect text boxes size and position if dynamic content passed
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | René-Luc ReLuc | ||
Category: | QGIS Server | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 16767 |
Description
I have set up a simple composer in QGIS (last master, compiled this morning). See attached picture qgis_composer.png
When I export in PDF from QGIS desktop composer, I get the attached pdf qgis_pdf
When I ran the request [1] which is the getprint (proxy done by LizMap-Web-Client to hide the map parameter), I get the attached pdf getprind_pdf Basically I added the parameter truc=MY FOO TITLE <b>BOLD</b> )
When I ran the same request but with a longer "truc" parameter, like &truc=MY FOO TITLE <b>BOLD</b><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque luctus adipiscing fringilla. Fusce eget justo tellus. Maecenas dolor augue, sollicitudin at iaculis et, congue et metus. Aenean tincidunt ipsum sit amet ipsum ornare fermentum. Proin fringilla laoreet hendrerit. Curabitur dui urna, interdum tempus blandit eu,</p>
I get the attached PDF getprint_long_pdf.pdf
So it appears that the dynamic replacement via the GetPrint request does not respect the position and size of my "truc" text box, whereas the desktop composer does.
Or this is a problem with word wrapping perhaps ?
History
#1 Updated by Michael Douchin over 11 years ago
- File dev_print.qgs added
- File polygons.geojson added
Some more description added to be able to reproduce the problem.
Since QWebKit requires a running x-server to be able to render HTML, QGIS composers using HTML blocks or text block rendered as html will make QGIS Server segfault.
As adviced by Marco Hugentobler and Tim Sutton in the thread [1], I describe here the workaroud :
- Create a fake X server
Xvfb :99 -ac -noreset &
- Add the option in the fastcgi , for example
FastCgiConfig -idle-timeout 70 -maxClassProcesses 50 -minProcesses 3 -init-start-delay 3 -restart-delay 20 -startDelay 15 -initial-env DISPLAY=:99
- Restart Apache
service apache2 restart
I also attached a sample project and relative data
[1] http://lists.osgeo.org/pipermail/qgis-developer/2013-May/026228.html
#2 Updated by René-Luc ReLuc over 11 years ago
I have found the code, src/mapserver/qgsconfigparser.cpp:530
//replace label text foreach ( QgsComposerLabel *currentLabel, composerLabels ) { QString title = parameterMap.value( currentLabel->id().toUpper() ); if ( title.isEmpty() ) { //remove exported labels not referenced in the request if ( !currentLabel->id().isEmpty() ) { c->removeItem( currentLabel ); delete currentLabel; } continue; } currentLabel->setText( title ); currentLabel->adjustSizeToText(); }
At the end for each label the size is adjusted to the text, but now every label is HTML.
Other question, why removed label if it was not in parameters ?
#3 Updated by René-Luc ReLuc over 11 years ago
- % Done changed from 0 to 100
- Assignee changed from Marco Hugentobler to René-Luc ReLuc
- Status changed from Open to Closed
Update with the commit fe883246707644df37a0960fba57250226b8f001