Select to view content in your preferred language

Exporting a layout to pdf without point layer symbology and labeling

250
4
08-09-2024 03:48 PM
MohamedHassan17
Emerging Contributor

I have developed a Python script using Arcpy to query certain values and append them to a layout.

The script includes the application of symbology, labeling, and a definition query. While the script executes correctly, I encounter an issue where the symbology and labeling do not appear in the exported PDF.

However, when I zoom in or out of the layout in ArcGIS Pro, the symbology and labeling are displayed correctly.

 

The first image shows the map in ArcGIS Pro with the labeling and symbology present.

MohamedHassan17_0-1723243185184.png

 

 

 

 

The second image shows the exported PDF where the labeling and symbology are absent.

MohamedHassan17_1-1723243185175.png

@DanPatterson

@JeffBarrette

 

4 Replies
DanPatterson
MVP Esteemed Contributor

not other posts with the same problem and only 2 hits on the support site.

BUG-000142871 for ArcGIS Pro (esri.com)

may apply, if your script parameters meet the conditions


... sort of retired...
0 Kudos
JeffBarrette
Esri Regular Contributor

@MohamedHassan17 , are you using applySymbologyFromLayer by chance?  If so, there are some alternative solutions.  If not, we would need a reproducible case.

Jeff

0 Kudos
MohamedHassan17
Emerging Contributor

No I don't use applySymbologyFromLayer

0 Kudos
MohamedHassan17
Emerging Contributor

this is my function 


def export_layout_to_pdf(layout, code😞

    if not os.path.exists(output_folder😞
        os.makedirs(output_folder)

    pdf_filename = os.path.join(output_folder, f"{code}.pdf")
    layout.exportToPDF(pdf_filename)
    arcpy.AddMessage(f"Report exported to {pdf_filename}")

    if os.path.exists(pdf_filename😞
            os.startfile(pdf_filename)
    else:
        add_error_message("Failed to export the report.")
 
mf.camera.setExtent(mf.camera.getExtent())
 
        time.sleep(4)
        file = export_layout_to_pdf(lyt, code)
       
     
 arcpy.AddMessage(f"The report exported successfully ^_^")
0 Kudos