Thank you for the Registry Solution.
Can I set the Plot Stamp Option when I am plotting using the following code. I was thinking can I set the plot stamp using PlotSettings, PlotConfig, PlotInfo or PlotInfoValidator Object.
PlotSettings defaultPlotSetting = (PlotSettings)sourcePlotSettingsDict.GetAt(printingConfiguration.PageSetupName).GetObject(OpenMode.ForRead);
string defaultDeviceName = defaultPlotSetting.PlotConfigurationName;
//defaultPlotSetting.
LayoutManager layMgr = LayoutManager.Current;
DBDictionary layouts = tr.GetObject(db.LayoutDictionaryId, OpenMode.ForRead) as DBDictionary;
foreach (DBDictionaryEntry item in layouts)
{
Layout theLayout = (Layout)layMgr.GetLayoutId(item.Key).GetObject(OpenMode.ForWrite);
LayoutManager.Current.CurrentLayout = item.Key;
if (item.Key != "Model")
{
ed.SwitchToPaperSpace();
// PlotSettingsValidator psVal = Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.Current;
theLayout.CopyFrom(defaultPlotSetting);
theLayout.UpgradeOpen();
PlotConfigManager.RefreshList(RefreshCode.All);
var s = PlotConfigManager.SetCurrentConfig(defaultDeviceName);//DWG To PDF-300.pc3
PlotConfig tds = PlotConfigManager.CurrentConfig;
string plotFile = null;
plotFile = pdfDirectory + FormatDrawingName(drawingFileNameWithoutExtension) + item.Key + ".pdf";
ed.WriteMessage("\nPlotting to {0}\n", plotFile);
if (System.IO.File.Exists(plotFile))
{
File.Delete(plotFile);
}
PlotInfo plotInfo = new PlotInfo();
plotInfo.Layout = theLayout.ObjectId;
plotInfo.OverrideSettings = defaultPlotSetting;
plotInfo.DeviceOverride = tds;
PlotInfoValidator validator = new PlotInfoValidator();
//int itIs = validator.IsCustomPossible(plotInfo);
validator.MediaMatchingPolicy = Autodesk.AutoCAD.PlottingServices.MatchingPolicy.MatchEnabledCustom;
int itIs = validator.IsCustomPossible(plotInfo);
validator.Validate(plotInfo);
PlotEngine plotEngine = PlotFactory.CreatePublishEngine();
plotEngine.BeginPlot(null, null);
plotEngine.BeginDocument(plotInfo, Application.DocumentManager.MdiActiveDocument.Database.Filename, null, 1, true, plotFile);
PlotPageInfo pageInfo = new PlotPageInfo();
ed.WriteMessage("\nPlotting {0} Entities, {1} ", pageInfo.EntityCount, pageInfo.RasterCount);
plotEngine.BeginPage(pageInfo, plotInfo, true, null);
plotEngine.BeginGenerateGraphics(null);
plotEngine.EndGenerateGraphics(null);
plotEngine.EndPage(null);
plotEngine.EndDocument(null);
plotEngine.EndPlot(null);
plotEngine.Destroy();
}
}