Select to view content in your preferred language

Control JS API Produced PDF File

1450
8
01-04-2013 12:04 PM
JK
by
Deactivated User
Using the JS API dojo.require("esri.dijit.Print") functionality to produce a exported PDF file - Is there a way to lock the layer toggle feature within the PDF file (on the left hand side).  I can get the export to PDF to work fine.  I'd like to know if there is a setting on the javascript side or the ArcGIS server side to lock this functionality when the PDF is opened.  I'd like to not allow the user of the document to be able to "turn off" the confidential statement within the PDF.

Any advice would be great.  Thanks.

James.
0 Kudos
8 Replies
JohnGravois
Deactivated User
any properties you can set from within ArcMap for PDF exports will be honored by the 10.1 Print Service when the same template is used.

for example:
.[install location]\ArcGIS\Server\Templates\ExportWebMapTemplates\Letter ANSI A Portrait.mxd

i don't understand exactly what you're talking about, but perhaps File > Export Map > PDF > Advanced > Layers and Attributes: "None" is the property you need to set?

Tutorial: Publishing additional services for printing
http://resources.arcgis.com/en/help/main/10.1/0154/0154000005n1000000.htm
0 Kudos
JK
by
Deactivated User
Thanks for the reply John.  However for some reason the PDF generated by the ArcGIS server overrides the selection of "None." 

For instance, changing the option to "None" and exporting directly from the *.mxd it works properly.  As the PDF file has the toggle layer functionality gone.

But when exporting from the API (IE8) the toggle layer functionality still exists.  Seems like a bug to me.

Any other suggestions would be appreciated.  Thanks!
0 Kudos
JohnGravois
Deactivated User
id have to test to confirm, but that certainly doesn't sound like the correct behavior to me.

it'd be a little more work, but you might try publishing a custom geoprocessing task which calls the two Python functions in succession.

arcpy.mapping.ConvertWebMapToMapDocument
http://resources.arcgis.com/en/help/main/10.1/#/ConvertWebMapToMapDocument/00s30000006n000000/

arcpy.mapping.ExportToPDF (setting layers_attributes property)
http://resources.arcgis.com/en/help/main/10.1/#/ExportToPDF/00s300000027000000/

more general info on custom print workflows here
http://resources.arcgis.com/en/help/main/10.1/index.html#//01540000056t000000
0 Kudos
JK
by
Deactivated User
Yeah.  I make other changes to the textboxes in the layout template just to make sure I see all of the changes saved in the *.mxd file.  When exporting from the API, I see the changes in the layout but the toggle functionality still exists.
0 Kudos
JK
by
Deactivated User
Please test on your end.  I'm curious if you get the same result.  Thanks.
0 Kudos
JohnGravois
Deactivated User
i was able to reproduce the behavior you described.  I even tried logging into the ArcGIS Server machine with the ArcGIS Server account credentials to set the PDF properties (thinking they might be user specific), but the result was the same.
0 Kudos
JeffMoulds
Esri Contributor
You could create your own Print Task based on a Python Script, similar to this tutorial: http://resources.arcgis.com/en/help/main/10.1/index.html#/Tutorial_Basic_high_quality_web_map_printi.... This tutorial focuses on removing service layers for vector layers staged in the template Map Document. However, you dont need that functionality, so you can skip that part. Instead, focus on the line that calls ExportToPDF, http://resources.arcgis.com/en/help/main/10.1/index.html#/ExportToPDF/00s300000027000000/. This function has the layers_attributes paramater, which, when set to "NONE", will disable the layers in the output PDF.
0 Kudos
JK
by
Deactivated User
Thanks Jeff.  I'll look into this.
0 Kudos