×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

PRINT TO PDF MACRO QUESTION?

PRINT TO PDF MACRO QUESTION?

PRINT TO PDF MACRO QUESTION?

(OP)
I created a macro that will print to pdf. How do you stop the adobe distiller from asking for a save location or how do you automatically fill out the save location dialog box?

thanks in advance

RE: PRINT TO PDF MACRO QUESTION?

Hard to say without seeing your code.  Can you post it?

RE: PRINT TO PDF MACRO QUESTION?

(OP)
Heres is the code. I am also having trouble setting the page size. For 34 x 22


Option Explicit
Dim swApp As SldWorks.SldWorks
Dim Model As ModelDoc2
Dim stDprinter As String
Sub main()

Set swApp = CreateObject("SldWorks.Application")
Set Model = swApp.ActiveDoc

Dim ps As PageSetup

Set ps = Model.PageSetup

ps.Orientation = 2   ' 1=Portrait  '2 = Landscape



ps.PrinterPaperLength = 34 / 0.01
ps.PrinterPaperWidth = 22 / 0.01
ps.ScaleToFit = True


stDprinter = "Adobe PDF"
 

Dim pageArray(0) As Long

pageArray(0) = 0

 

Dim vPageArray As Variant

vPageArray = pageArray

 

Dim copies As Long

copies = 1

Dim collate As Boolean

collate = True

 

' Print to default printer

Model.Extension.PrintOut2 vPageArray, copies, collate, "stdprinter", ""

End Sub

RE: PRINT TO PDF MACRO QUESTION?

It looks like you are using a printer-emulating Adobe distiller.  SolidWorks thinks you are printing to a printer.  Therefore, you can't pass a filename to the distiller.  If you want the macro to specify the filename you will need to look into doing a "Save As" PDF.  If you'll do a Google search of this forum/the web I'm sure you can find some examples of how to do this.

RE: PRINT TO PDF MACRO QUESTION?

(OP)
THAT STINKS. What about the paper size how would i go about specifing 34 x 22.

RE: PRINT TO PDF MACRO QUESTION?

(OP)
never mind i figured it out thanks for all the help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources