1

I understand that you have to re-orient the XY/min/max to fit a tagRECT but I'm still getting an "Invalid pixel bound value(s)" error. I have also tried setting Ymin/Ymax = bottom/top but I get the same error.

IMxDocument mxdoc = ArcMap.Application.Document as IMxDocument;
IActiveView actView = mxdoc.ActiveView;

IExport exporter = new ExportPDFClass();
exporter.ExportFileName = @"U:\FILEPATH\topoexport.pdf";
exporter.Resolution = 300;

IEnvelope pixBounds = new EnvelopeClass();
int hdc = exporter.StartExporting();
pixBounds.XMin = actView.ExportFrame.left;
pixBounds.XMax = actView.ExportFrame.right;
pixBounds.YMin = actView.ExportFrame.top;
pixBounds.YMax = actView.ExportFrame.bottom;
exporter.PixelBounds = pixBounds;
tagRECT rectangle = actView.ExportFrame;

actView.Output(hdc, (int)exporter.Resolution, ref rectangle, null, null);
exporter.FinishExporting();
exporter.Cleanup();
2

You need to move

int hdc = exporter.StartExporting();

to AFTER you have set up the frame to be exported.

int hdc = exporter.StartExporting();
actView.Output(hdc, (int)exporter.Resolution, ref rectangle, null, null);
exporter.FinishExporting();

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.