I have a small function that exports a map document to a pdf. The function works in the fact that it does export a pdf. However, regardless of what I set pdfExport.ExportPDFLayersAndFeatureAttributes to, all of the layers are grouped into a single layer 'Image' in the output pdf. In the code snippet below, I would expect the map layers to be toggle-able layers in the output pdf. What am I doing wrong?

BTW - this is at ArcGIS 9.3.1

int OUTPUT_RES = 300;
IExport export = null;

IExportPDF2 pdfExport = new ExportPDFClass();
pdfExport.ExportPDFLayersAndFeatureAttributes = esriExportPDFLayerOptions.esriExportPDFLayerOptionsLayersAndFeatureAttributes;

export = (IExport)pdfExport;
export.Resolution = OUTPUT_RES;
export.ExportFileName = outputFile;

tagRECT exportFrame = map.ActiveView.ExportFrame;
IEnvelope exportEnvelope = new EnvelopeClass();
exportEnvelope.PutCoords(exportFrame.left, exportFrame.top, exportFrame.right, exportFrame.bottom);
export.PixelBounds = exportEnvelope;

int hdc = export.StartExporting();
map.ActiveView.Output(hdc, OUTPUT_RES,exportFrame,null,null);
  • 2
    If i remember correctly the layers may need to be grouped, then each group becomes a layer in the PDF. Or something like that. Also, if you have a raster layer in there, every layer bellow the raster will be rasterized. Transparencies also don't play well with the PDF renderer - might need to turn those off as well. – Jakub Sisak GeoGraphics Oct 17 '11 at 19:22
  • Perhaps I should have first asked if you've tried this using the default PDF exporter and whether that yielded the expected result... – Jakub Sisak GeoGraphics Oct 17 '11 at 19:27
  • Can you get the results you want interactively using the export command in arcmap? – Kirk Kuykendall Oct 17 '11 at 19:36
  • Exporting manually from ArcMap produces expected result; pdf with same layer groupings as in map document. – user890 Oct 17 '11 at 23:47

Your Answer

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

Browse other questions tagged or ask your own question.