VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 9
icyzola
2355 Views, 8 Replies

PDF Plot

     I'm trying to plot an open drawing to file as a PDF. I'm using a page setup for the plot with plotter = PostScript Level 2.pc3, scaled to fit, media = 11x17, plot centered. When the plot is saved, I get only half of it. It's scaled correctly for 11x17 but the plot is letter size, leaving off half of the drawing. Below is the code I'm using to experiment. For what to plot I've used extents and also tried a window with the same result.
     Any suggestions would be much appreciated.

Thanks

 

Sub ZZ_PDF_Plot_Ex()
Dim AcDoc As AcadDocument, X As Boolean, Y As String
Set AcDoc = ThisDrawing
Y = "C:\Jim_Temp\0Temp\Temp_PDF"
X = PDF_Plot(AcDoc, Y)
If Not X Then MsgBox "The plot was not successful."
End Sub

Function PDF_Plot(AcD As AcadDocument, PDFNm As String) As Boolean
' Revised 2/8/14 jfm
'
' Function to plot an AutoCAD document to a PDF file
'
'INPUTS:
'AcD - The open AutoCAD document to plot with the desired page setup
' active.
'PDFNm - The name of the new file without extension and including path.
'
'OUTPUTS:
'PDF_Plot is True if the plot is successful and False if not successful.
'
'OTHER REQUIRED MODULES:
'
'NOTES:
'1) A temporary ".ps" file is created during the PDF file creation. The file
' name of the temporary file is the same as the PDF file with a different
' extension. This file is deleted after the PDF file is created.
'
'
Dim PDF_Dst As PdfDistiller, Name_PS As String, Name_PDF As String
Dim AcDPC As AcadPlotConfiguration
Set AcDPC = AcD.PlotConfigurations(zzz)
Set PDF_Dst = New PdfDistiller 'Setup PDF distiller
Name_PS = PDFNm + ".PS"
Name_PDF = PDFNm + ".PDF"

PDF_Plot = AcD.Plot.PlotToFile(Name_PS)
' I've also tried PDF_Plot = AcD.Plot.PlotToFile(Name_PS, "Postscript Level 2.pc3")
On Error Resume Next
PDF_Dst.FileToPDF Name_PS, Name_PDF, ""
If Err Then
PDF_Plot = False
Err.Clear
End If
On Error GoTo 0
'Insert code to delete PS file here.
End Function

8 REPLIES 8
Message 2 of 9
ennorl
in reply to: icyzola

Try setting the print size to "tabloid" instead of "11x17" and see if that helps.

Message 3 of 9
Jedimaster
in reply to: icyzola

Not sure if ths will help, this is what I use in my plot routine.

 

Thisdrawing.ActiveLayout.CanonicalMediaName = "ANSI_B_(17.00_x_11.00_Inches)"

Thisdrawing.ActiveLayout.RefreshPlotDeviceInfo

 

Message 4 of 9
DavidTosh
in reply to: Jedimaster

The media name is printer driver specific- I've seen it change between Windows XP and Windows 7. (I used to support a mixed group of platforms but needed to generate common printing scripts.)

 

---
Tosh
Message 5 of 9
Jedimaster
in reply to: icyzola

The CanonicalMediaName was from PC3 driver made from AutoCAD 2010 DWG To PDF driver.

 

driver_pathname="C:\Program Files\AutoCAD 2010\drv\pdfplot10.hdi
driver_version="1.1-10.0.309.0
driver_tag_line="PDF ePlot - by Autodesk

canonical_model_name="pdf
localized_family_name="Autodesk ePlot (PDF
localized_model_name="DWG To PDF

 

83{
caps_type=4
name="ANSI_B_(17.00_x_11.00_Inches)
localized_name="ANSI B (17.00 x 11.00 Inches)
media_description_name="ANSI_B_Landscape_17.00W_x_11.00H_-_(5,_17)_x_(427,_262)_=103510_MM
media_group=0
landscape_mode=TRUE
}

Message 6 of 9
icyzola
in reply to: Jedimaster

I haven't been able to work on this recently.  Thanks for all the suggestions.  I plan to give them a try at my first opportunity.

Message 7 of 9
icyzola
in reply to: icyzola

I'm back, hitting a lick at PDF plotting again.  I'm getting the PDF plots OK now, but am unable to change the resolution.  I've changed the properties of the PC3 file I'm using from 600DPI to 200DPI, have tried using joboption files with 200DPI settings and multiple variations of both of these.  All PDF's still come out at 600DPI.

 

Thanks

Message 8 of 9
Jedimaster
in reply to: icyzola

I have not tested any of this stuff. There are a few plotting overrides to the resolution. Shaded viewport options.

Shade Plot: As displayed

Qauilty: Presenation

DPI should come out 200

 

Now how to programically set theses I am not sure.

 

Look into

 

AcShadePlot.acShadePlotAsDisplayed
AutoCAD.AcOlePlotQuality.acOPQLowGraphics

Message 9 of 9
icyzola
in reply to: Jedimaster

I'll look into it - Thanks

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

Post to forums  

Autodesk Design & Make Report

”Boost