qgis / pyqgis-api-docs-builder

Sphinx project to build python API documentation for QGIS
https://qgis.org/pyqgis/master/
GNU General Public License v2.0
86 stars 31 forks source link

PyQGIS QgsLayoutExporter gives error "QPen::setWidthF: Setting a pen width that is out of range" #132

Closed rbenet71 closed 11 months ago

rbenet71 commented 11 months ago

I have a PyQGIS app, that generates a PDFs from an Atlas.

If I generate the PDF directly from QGIS 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 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-gives-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.currentFilename()+".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)
DelazJ commented 11 months ago

Hi @rbenet71 I'm afraid this is not the right place to ask for help. This repository is for building the PyQGIS docs and track related issues. You will probably be better served asking on qgis user mailing list (see support channels). Closing... Thanks for understanding.