Exporting Layouts as pdfs in Pro Using a gp Service

1012
2
11-10-2020 01:13 PM
Aaron
by
New Contributor II

What I want to do seems pretty basic: Export a map series layout (or even a single page layout) in Portal using a gp service created in Pro (i.e. Share As > Web Tool) using the original data sources.

Since I can't use network file shares as a data store (security issue I am told), I simply let it copy the aprx to the server. This exports the current state of the feature service data in the map to a file gdb and copies it up. Whenever I run the tool, it obviously uses the local file gdb.

First of all, would this even respect the original data sources if I had access to network file shares?

My partial workaround is to replace that aprx with my original aprx that has the connections to the feature services. Works fine... if I set the permissions of the feature service to Everyone.

Otherwise it still exports the pdf only with no data. Interestingly I get no errors (even at debug level) and it still pulls the legend fine.

I have looked into editing the manifest.json but no idea of the syntax… possible to change credentials? Somehow create a token and pass it?

I know you can rename the msd file to zip to see the contents… I see nothing helpful.

Setting the aprx to CURRENT results in an error after publishing.

Hopefully I am making this more complicated than it is. Any insight or suggestions are appreciated!

import sys, os, arcpy
outFile = arcpy.GetParameterAsText(0)
aprx= r"C:\projects\prettymaps.aprx"
layout = aprx.listLayouts("Layout")[0]
layout.exportToPDF(outFile)
Tags (2)
0 Kudos
2 Replies
DavidPike
MVP Frequent Contributor

There's functionality to reference a Print service within a print widget in Portal.

Print widget—Portal for ArcGIS | Documentation for ArcGIS Enterprise 

Configure your own custom template to be consumed as a print service:

Publish a print service with custom layouts from ArcMap—ArcGIS Server | Documentation for ArcGIS Ent... 

0 Kudos
Aaron
by
New Contributor II

Problem is you can't use a map series with that and I am modifying other elements on the layout. It seems to be working now... I added the arcpy.SignInToPortal function and it now pulls in the layers. I'm sure I'll run into more problems.

0 Kudos