Save a PDF with iLogic

Save a PDF with iLogic

Anonymous
Not applicable
547 Views
1 Reply
Message 1 of 2

Save a PDF with iLogic

Anonymous
Not applicable

Hello,

 

how can I create a PDF file, after saving a drawing file?

i want to save all sheets in this drawing in a single pdf file

 

 

0 Likes
548 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

An excellent example is located at the linked blog.

 

http://blog.ads-sol.com/2014/08/save-as-pdf-dwf-ilogic.html

 

Also, there is an example in the help, but it doesn't seem to explain very well how to save all sheets to a single file.  The example linked above does a great job.

 

Code example from the ads-sol blog.

 

' Testing code excerpt from...
' http://blog.ads-sol.com/2014/08/save-As-pdf-dwf-ilogic.html

dir5 = "c:\temp"
oFileName = "testing"
'------------------- Complex code added to save all sheets    ----------------
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oDWFAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
    oOptions.Value("All_Color_AS_Black") = 1
    oOptions.Value("Remove_Line_Weights") = 1
    oOptions.Value("Vector_Resolution") = 400
    'this publish all doens't work
    oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
    'try a different publish all command
    'oOptions.Value("Publish_All_Sheets") = 1
    'oOptions.Value("Custom_Begin_Sheet") = 2
    'oOptions.Value("Custom_End_Sheet") = 4
End If

 'Set the PDF target file name
oDataMedium.FileName = dir5 & "\" & oFileName & "_Rev" & oRevNum & ".pdf"
'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
i = MessageBox.Show("View the PDF file?", "Title",MessageBoxButtons.YesNo)
If i = vbYes Then : launchviewer = 1 : Else : launchviewer = 0 : End If 
If launchviewer = 1 Then ThisDoc.Launch(oDataMedium.FileName)

' Done for now.

 

 

M.

0 Likes