Hello,
I am trying to plot a PDF using COM Component and these below are the code which i used
acDoc = acApp.Documents.Open(item.SubItems[1].Text + "\\" + item.SubItems[0].Text, Type.Missing, Type.Missing);
acApp.Visible = true;
acApp.ZoomExtents();
foreach (AcadLayout layout in acDoc.Layouts)
{
layout.StyleSheet = "monochrome.ctb";
}
PtObj = acDoc.Plot;
PtConfigs = acDoc.PlotConfigurations;
PtConfigs.Add("PDF", true);
PlotConfig = PtConfigs.Item("PDF");
PlotConfig.CenterPlot = true;
PlotConfig.StandardScale = AcPlotScale.acScaleToFit;
PlotConfig.PlotType = AcPlotType.acExtents;
PlotConfig.ConfigName = "DWG To PDF.pc3";
PlotConfig.StyleSheet = "monochrome.ctb";
PlotConfig.CanonicalMediaName = "ANSI_A_(8.50_x_11.00_Inches)";
PlotConfig.PlotViewportBorders = false;
PlotConfig.PlotWithLineweights = true;
PlotConfig.PlotWithPlotStyles = true;
PlotConfig.ScaleLineweights = false;
PlotConfig.GetPlotStyleTableNames();
PlotConfig.PlotRotation = AcPlotRotation.ac90degrees;
BackPlot = acDoc.GetVariable("BACKGROUNDPLOT");
acDoc.SetVariable("BACKGROUNDPLOT", 0);
PlotConfig.RefreshPlotDeviceInfo();
if (PtObj.PlotToFile(acDoc.FullName.Replace("dwg", "pdf"), PlotConfig.ConfigName))
{
//Do Nothing
}
else
{
using (StreamWriter sr = newStreamWriter(FileName, true))
{
sr.WriteLine(acDoc.FullName.Trim());
}
}
//If you wish you can delete th plot configuration you created
//programmatically, and set the 'BACKGROUNDPLOT' system variable
//to its original status.
PtConfigs.Item("PDF").Delete();
PlotConfig = null;
acDoc.SetVariable("BACKGROUNDPLOT", BackPlot);
Even though after Giving these settings the Output PDF is not covering full sheet of paper, instead its taking a portion of paper.
Is there any way where i can solve this.
Rgds
Amit
Solved! Go to Solution.
Solved by amitnkukanur. Go to Solution.
Solved by fieldguy. Go to Solution.
Using the managed API (2010) my plot creator has "psv.SetUseStandardScale(ps, True)" and "psv.SetStdScaleType(ps, StdScaleType.ScaleToFit)".
ps is PlotSettings and psv is PlotSettingsValidator. Try SetUseStandardScale(??, true) before acscaletofit.
Hello FieldGuy,
Thanks for replying. Where and how will i find My Plot Creator because i am hearing it first time. If you could share a sample with me if you have.
Thanks
Amit
My plot creator is an application I developed to plot pdfs. I created it by doing hours of research and testing - if you search this forum for "plot to pdf" you will see several replies. You have to do the work yourself - there are plenty of samples available.
Almost everything is available from Kean Walmsley (the 2nd link below). Check these links:
http://forums.autodesk.com/t5/NET/using-com-intero-to-plot-layouts/m-p/4777711/highlight/true#M38885
http://through-the-interface.typepad.com/through_the_interface/2007/09/driving-a-basic.html
http://adndevblog.typepad.com/autocad/2012/05/named-view-plotting.html
http://forums.autodesk.com/t5/NET/Reg-Plotting-To-PDF/m-p/4848873/highlight/true#M39414
Hi fieldguy,
Thanks for reply, the post helped to solve the problem to certain extent.
Thanks for a reply.
Cheers,
Amit