PDA

View Full Version : Problem Plotting wipeouts to PDF


ivan.markov
2007-11-16, 05:34 PM
Hi everyone,

I am having this small really annoying problem. I am trying to plot a drawing to a pdf. The exact process is that I generate an .eps file first and then that file is distilled to a pdf. Now, it all works fine if there are no wipeouts in the drawing, however if I insert a wipeout and try to plot the BeginGenerateGraphics() method in the PlotEngine, errors out and will not finish generating the eps file. The error message that I get is:

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

At the same time the preview command works fine, keeping the configurations the same.
I am using a postscript pc3 file.

Does anyone have any suggestion?

Thanks, I would appreciate any help.


Code excert:
PlotConfigManager.RefreshList(RefreshCode.All);
PlotConfiguration ps = null;
PlotInfo pl = LoadPlotSettings(ref fn, ref ps);
eng = PlotFactory.CreatePublishEngine();
eng.BeginPlot(null, null);
DocumentLock dl = Application.DocumentManager.MdiActiveDocument.LockDocument();
eng.BeginDocument(pl, ps.FullFile, null, 1, toFile, fn); //
eng.BeginPage(new PlotPageInfo(), pl, true, null);
eng.BeginGenerateGraphics(null);
eng.EndGenerateGraphics(null);
eng.EndPage(null);
eng.EndDocument(null);
dl.Dispose();
eng.EndPlot(null);

Info:
PlotInfo is a userdefined class that retrieves the configuration for the current plot from a file and sets up the PlotConfiguration;

ivan.markov
2008-03-26, 04:18 PM
I finally figured out this problem. The reason why it fails to plot wipeouts is because there was no PlotProgressDialog object passed to the BeginPlot method. Apparently the PlotProgressDialog object is required by the method to plot correctly, however the method has no safeguards for not passing in a null for the PlotProgressDialog object. So in other words to fix the problem plotting wipeouts create a new PlotProgressDialog, set its properties and pass it to the BeginPlot method.

Example:


PlotProgressDialog pPlotProgDlg = new PlotProgressDialog(false, 1, true);

pPlotProgDlg.set_PlotMsgString(PlotMessageIndex.DialogTitle, "Plot API Progress");
pPlotProgDlg.set_PlotMsgString(PlotMessageIndex.CancelJobButtonMessage, "Cancel Job");
pPlotProgDlg.set_PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage, "Cancel Sheet");
pPlotProgDlg.set_PlotMsgString(PlotMessageIndex.SheetSetProgressCaption, "Job Progress");
pPlotProgDlg.set_PlotMsgString(PlotMessageIndex.SheetProgressCaption, "Sheet Progress");

pPlotProgDlg.LowerPlotProgressRange = 0;
pPlotProgDlg.UpperPlotProgressRange = 100;
pPlotProgDlg.PlotProgressPos = 0;
pPlotProgDlg.OnBeginPlot();
pPlotProgDlg.IsVisible = (true);
eng.BeginPlot(pPlotProgDlg, null);
PlotPageInfo pageInfo = new PlotPageInfo();

PlotInfo plotInfo = new PlotInfo();
//Set the Layout to Active Layout ID for the current drawing
plotInfo.Layout = (layoutId);// This is required.

// Now, override the layout settings with the plot settings. PlotSet is a global object that was set up somewhere else in the application
plotInfo.OverrideSettings = (plotSet);

//Validate the settings.
PlotInfoValidator validator = new PlotInfoValidator();
validator.MediaMatchingPolicy = (MatchingPolicy.MatchEnabled);
validator.Validate(plotInfo);

// Begin document. ps is a custom object holding some configurations about the desired plot
eng.BeginDocument(plotInfo, ps.FullFile, null, 1, toFile, ps.FileName);

// Follow through sending commands to the engine, and notifications to the progress dialog.
pPlotProgDlg.OnBeginSheet();
pPlotProgDlg.LowerSheetProgressRange = 0;
pPlotProgDlg.UpperSheetProgressRange = 100;
pPlotProgDlg.SheetProgressPos = 0;

eng.BeginPage(pageInfo, plotInfo, true, null);
eng.BeginGenerateGraphics(null);
eng.EndGenerateGraphics(null);
eng.EndPage(null);
pPlotProgDlg.SheetProgressPos = (100);
pPlotProgDlg.OnEndSheet();
pPlotProgDlg.PlotProgressPos = (100);
eng.EndDocument(null);
eng.EndPlot(null);

// Destroy the engine
eng.Destroy();
eng.Dispose();
pPlotProgDlg.Destroy();
pPlotProgDlg.Dispose();

joseguia
2008-04-07, 01:16 AM
ivan,
Thanks for sharing with us the code and how you figured it out.
Great help,
Thanks.