Hi All,
We have a custom print service application written for ArcObjects .NET SDK 10.4.1. The application opens up an MXD, selects a bunch of features using Definition Queries, zooms 4 data frames to a specified extent and then does a IActiveView.Output() to export to a PDF, using IExportPDF.
// Prepare for exporting the layout to PDF
IExportPDF exportPDF = new ExportPDFClass();
IExport exporter = (IExport)exportPDF;
exportPDF.EmbedFonts = true;
exportPDF.Compressed = true;
exportPDF.ImageCompression = esriExportImageCompression.esriExportImageCompressionLZW;
((IOutputRasterSettings)exportPDF).ResampleRatio = 1;
// Compute the pixel bounds of the full layout
tagRECT pixelBounds = pageLayoutView.ExportFrame;
IEnvelope pixelBoundsEnvelope = new EnvelopeClass();
pixelBoundsEnvelope.PutCoords(pixelBounds.left * resolution / 96, pixelBounds.top * resolution / 96, pixelBounds.right * resolution / 96, pixelBounds.bottom * resolution / 96);
// Create an export file in the ArcGIS Server's output directory
String exportFileName = String.Format("_ags_{0}.pdf", _instance);
//exporter.ExportFileName = ArcGISServerConfiguration.PhysicalOutputDirectory + "\\" + exportFileName;
exporter.ExportFileName = outputDir+ "\\" + exportFileName;
exporter.Resolution = (short)resolution;
exporter.PixelBounds = pixelBoundsEnvelope;
if (_debug)
DebugMessage(String.Format("ExportPDF('{0}') {{", exportFileName));
// Render the layout to the Exporter's device context
int hDC = exporter.StartExporting();
pageLayoutView.Output(hDC, resolution, ref pixelBounds, null, null);
exporter.FinishExporting();
if (_debug)
{
DebugMessage(String.Format("}} ExportPDF('{0}') finished", exportFileName));
DebugMessage("Cleanup() {");
}
What is happening is; we set this up on an IIS server (running as an asmx service) and users hit the service to print a map. When it is first deployed, everything works nicely and maps are taking around 5-10 secs to print to PDF. Over the course of a few months, that print time starts to get slower and slower, until eventually maps are taking well over 2 minutes to print.Jordan, have you tried refreshing either IIS and/or the application pool in which the service resides?
We have observed somewhat similar behavior with one of our sites previously and now include a server reboot as part of our monthly maintenance tasks.
Good luck, Matthew
Hi Matthew,
Thanks for the reply.
Yes, we have tried restarting IIS application pool and have also restarted the entire Windows Server. When its back up, it goes back to the time it was taking before we restarted.
The only way we've been able to get the times back down to < 20 seconds, is to do a complete new server build and re-deploy of everything. Even if we take a snapshot of the Window Server, when say its taking 50 seconds to print, and re-deploy the snapshot, it goes back to taking 50 seconds.
Cheers,
Jordan