2

I try to export a webmap in using arcpy into a pdf. This works fine, if there is a Layout available using:

aprx = arcpy.mp.ConvertWebMapToArcGISProject(webmap, None, None, notes_gdb)
aprx.importDocument("C:\\path\\to\\the\\layout.pagx")
layout = aprx.listLayouts()[0]
layout.exportToPDF("C:\\temp\\export.pdf")

Is there a posibility to export the webmap without layout?

There are resolution, scale and extent given in the webmap, so it should be possible. But I have nothing found to export a map directly like what is possible in arcpy.mapping.

4
  • Have you tried just exporting a MapFrame rather than the Layout? That has an exportToPDF method too.
    – PolyGeo
    Dec 5, 2019 at 9:24
  • How do I get the map frame without a layout?
    – scher
    Dec 5, 2019 at 10:28
  • I think you would add the MapFrame to a Layout, but then there is no need to export the Layout just the MapFrame.
    – PolyGeo
    Dec 5, 2019 at 10:43
  • thanks for the hint. I loaded a dummy layout with one map frame, choose the frame and called exportToPDF. The result was a crash of arcgis pro
    – scher
    Dec 5, 2019 at 11:15

1 Answer 1

1

I got a hint from the default esri server printing tool box. This tool box has been in general a source of inspiration, how to handle printing issues.

result = arcpy.mp.ConvertWebMapToArcGISProject(webmap)
mapView = result.ArcGISProject.listMaps()[0].defaultView
dpi = int(result.DPI) #a workaround for now for a bug
mapView.exportToPDF("C:\\temp\\export.pdf", result.outputSizeWidth, result.outputSizeHeight, dpi)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.