I'm trying to write a script to export a report that includes a map in the output pdf. While the script will create the pdf report and a separate .emf file, the script won't include the emf image in the pdf document. I have copy/pasted the example from the Desktop help (search for ExportReport to see to what I am referring to) with only minor edits to the script. See below:
<SPAN class="keyword token">import</SPAN> arcpy<SPAN class="punctuation token">,</SPAN> os
path <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>getcwd<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#a relative path allowing for easy packaging</SPAN>
<SPAN class="comment token">#Create PDF and remove if it already exists</SPAN>
pdfPath <SPAN class="operator token">=</SPAN> path <SPAN class="operator token">+</SPAN> r<SPAN class="string token">"\States_SubRegions.pdf"</SPAN>
<SPAN class="keyword token">if</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>exists<SPAN class="punctuation token">(</SPAN>pdfPath<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
os<SPAN class="punctuation token">.</SPAN>remove<SPAN class="punctuation token">(</SPAN>pdfPath<SPAN class="punctuation token">)</SPAN>
pdfDoc <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>PDFDocumentCreate<SPAN class="punctuation token">(</SPAN>pdfPath<SPAN class="punctuation token">)</SPAN>
subRegionList <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"744"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"760"</SPAN><SPAN class="punctuation token">]</SPAN>
mxd <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>MapDocument<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"CURRENT"</SPAN><SPAN class="punctuation token">)</SPAN>
df <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ListDataFrames<SPAN class="punctuation token">(</SPAN>mxd<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
lyr <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ListLayers<SPAN class="punctuation token">(</SPAN>mxd<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"BuildingSpace_A"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
pageCount <SPAN class="operator token">=</SPAN> <SPAN class="number token">1</SPAN>
<SPAN class="keyword token">for</SPAN> region <SPAN class="keyword token">in</SPAN> subRegionList<SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token">#Generate image for each sub region</SPAN>
<SPAN class="comment token">## whereClause = "facilityID = '" + region + "'"</SPAN>
<SPAN class="comment token">## lyr.definitionQuery = whereClause</SPAN>
<SPAN class="comment token">## arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause)</SPAN>
<SPAN class="comment token">## df.extent = lyr.getSelectedExtent()</SPAN>
<SPAN class="comment token">## arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION"</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ExportToBMP<SPAN class="punctuation token">(</SPAN>mxd<SPAN class="punctuation token">,</SPAN> path <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\RegionalPicture.bmp"</SPAN><SPAN class="punctuation token">,</SPAN> df<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#single file</SPAN>
<SPAN class="comment token">#Generate report</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ExportReport<SPAN class="punctuation token">(</SPAN>report_source<SPAN class="operator token">=</SPAN>lyr<SPAN class="punctuation token">,</SPAN> report_layout_file<SPAN class="operator token">=</SPAN>path <SPAN class="operator token">+</SPAN> r<SPAN class="string token">"\custodial_areas.rlf"</SPAN><SPAN class="punctuation token">,</SPAN> output_file<SPAN class="operator token">=</SPAN>path <SPAN class="operator token">+</SPAN> r<SPAN class="string token">"\temp"</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>pageCount<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">".pdf"</SPAN><SPAN class="punctuation token">,</SPAN> dataset_option<SPAN class="operator token">=</SPAN><SPAN class="string token">"USE_RLF"</SPAN><SPAN class="punctuation token">,</SPAN>starting_page_number<SPAN class="operator token">=</SPAN>pageCount<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#Append pages into final output</SPAN>
pdfDoc<SPAN class="punctuation token">.</SPAN>appendPages<SPAN class="punctuation token">(</SPAN>path <SPAN class="operator token">+</SPAN> r<SPAN class="string token">"\temp"</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>pageCount<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">".pdf"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#os.remove(path + r"\temp.pdf")</SPAN>
pageCount <SPAN class="operator token">=</SPAN> pageCount <SPAN class="operator token">+</SPAN> <SPAN class="number token">1</SPAN>
pdfDoc<SPAN class="punctuation token">.</SPAN>saveAndClose<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">del</SPAN> mxd <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Maybe I don't understand the purpose of the script??
Your help is greatly appreciated and thanks in advance for any help.
Cheers
I'm using v. 10.3.1 for Desktop
32 bit windows with 32 bit ESRI