[QGIS-Developer] PyQGIS QgsLayoutExporter gives error "QPen::setWidthF: Setting a pen width that is out of range"
rbenet71 at gmail.com
rbenet71 at gmail.com
Sun Dec 3 02:40:07 PST 2023
Hello,
I have a PyQGIS app, that generates a PDFs from an Atlas.
If I generate the PDF directly from QGIS Desktop all PDF generate correctly.
But If I generate the PDF with my PyQGIS app, some PDF don't generate
properly (some elements do not appear) and give error "QPen::setWidthF:
Setting a pen width that is out of range".
The first PDF contains all the elements, the other PDF are parts of first
PDF, so the elements are missing in some PDFs that are in the first.
One year ago, this app works perfect.
I have tried to change all PDF export options, but the error continues.
I make this question in Gis StackExchange, and no one give any answer:
<https://gis.stackexchange.com/questions/469644/pyqgis-qgslayoutexporter-giv
es-error-qpensetwidthf-setting-a-pen-width-that>
https://gis.stackexchange.com/questions/469644/pyqgis-qgslayoutexporter-give
s-error-qpensetwidthf-setting-a-pen-width-that
Here is a part of my code:
# Generate atlas
# Es una QgsLayoutAtlas
myAtlas.beginRender()
myAtlas.next()
for i in range(0, myAtlas.count()):
exporter = QgsLayoutExporter(myAtlas.layout())
file_name=os.path.join(dir_destiny,'Individuals')+'/'+myAtlas.currentFilenam
e()+".pdf"
pdf_settings=QgsLayoutExporter.PdfExportSettings()
pdf_settings.forceVectorOutput=False
pdf_settings.exportMetadata = False
pdf_settings.appendGeoreference = False
#pdf_settings.textRenderFormat =
QgsRenderContext.TextFormatAlwaysOutlines # For "Always Export Text as
Paths"
pdf_settings.textRenderFormat = QgsRenderContext.TextFormatAlwaysText #
For "Always Export Text as Text Objects"
pdf_settings.rasterizeWholeImage = True # For "Disable tiled raster
layer exports" Hace que ocupe menos si es TRUE
pdf_settings.simplifyGeometries = False
exporter.exportToPdf(file_name,pdf_settings)
Thank you In advance for your attention and help.
Kind regards,
Robert Benet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20231203/b0fd001a/attachment-0001.htm>
More information about the QGIS-Developer
mailing list