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

Set PrinterName and Papersize using AutoCAD 2008 API

1 REPLY 1
Reply
Message 1 of 2
Anonymous
518 Views, 1 Reply

Set PrinterName and Papersize using AutoCAD 2008 API

Hi,

How should we set printername and paper size using AutoCAD 2008 API. I tried this below code but No Luck. The given printer is not set in the document while print the dwg file.
And Don't know how to set the papersize (A1 or A2 or A3 or A4) using APIs

Any information would be valuable to us a lot. Thanks

Dim objPlot As Autodesk.AutoCAD.Interop.AcadPlot
AcadApp = CreateObject("AutoCAD.Application")
AcadApp.Documents.Open("E:\Projects\Autoprint\Files\9755834A.dwg")
AcadDoc = AcadApp.ActiveDocument
objPlot = AcadDoc.Plot
AcadApp.Preferences.Output.DefaultOutputDevice = "\\BWIRPNTSVR\Samsung ML-2150 Series PCL 6"
AcadApp.Preferences.Output.DefaultPlotStyleTable = "monochrome.ctb"
AcadDoc.ActiveLayout.PlotRotation = Autodesk.AutoCAD.Interop.Common.AcPlotRotation.ac90degrees
AcadDoc.Regen(Autodesk.AutoCAD.Interop.Common.AcRegenType.acActiveViewport)
AcadDoc.ActiveLayout.StandardScale = Autodesk.AutoCAD.Interop.Common.AcPlotScale.acScaleToFit
AcadDoc.ActiveLayout.PlotType = Autodesk.AutoCAD.Interop.Common.AcPlotType.acExtents
AcadDoc.SetVariable("BACKGROUNDPLOT", 0)
AcadApp.ActiveDocument.ActiveLayout.RefreshPlotDeviceInfo()
LeftFooterText = "LHS"
RightFooterText = "RHS"
InsertText(LeftFooterText & "" & RightFooterText)
AcadDoc.ActiveLayout.RefreshPlotDeviceInfo()
objPlot.PlotToDevice() ' To print
AcadApp.ActiveDocument.Close(False)
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Dear udhaykv,
below is how you can set your paper size to "predefined" size you wanted.

AcadDoc.ActiveLayout.CanonicalMediaName = "A4"

or you can use below function to get the name of the papersize.
AcadDoc.ActiveLayout.GetCanonicalMediaNames(indexNo)


Because some of the printer might refer A4 as ISO A4. or with different name. Previously when I was doing some AutoCAD integration with barcode when I try to assign "A1" size to the canonicalMediaName it will give me error. So before that you just have to figure out the name.

regards,
sy.

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