.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Plot PDF

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
amitnkukanur
1496 Views, 5 Replies

Plot PDF

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

Senior Software Engineer
5 REPLIES 5
Message 2 of 6
fieldguy
in reply to: amitnkukanur

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.

 

 

Message 3 of 6
amitnkukanur
in reply to: fieldguy

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

Senior Software Engineer
Message 4 of 6
fieldguy
in reply to: amitnkukanur

Message 5 of 6
amitnkukanur
in reply to: fieldguy

Hi fieldguy,

 

Thanks for reply, the post helped to solve the problem to certain extent.

 

Thanks for a reply.

 

Cheers,

Amit

Senior Software Engineer
Message 6 of 6
fieldguy
in reply to: amitnkukanur

I'm glad you found the solution.

 

Cheers!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost