forked from mspace912/iLogic-Development
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI-LOGIC PDF MAKER.ILOGICVB
More file actions
69 lines (48 loc) · 2.11 KB
/
Copy pathI-LOGIC PDF MAKER.ILOGICVB
File metadata and controls
69 lines (48 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Dim oDocAsDrawingDocument
oDoc=ThisApplication.ActiveDocument
Dim oTitleBlockAsTitleBlock
Dim oTextBoxAsTextBox
Dim oSheetAsSheet
oPath = ThisDoc.Path
oFileName = ThisDoc.FileName(False) 'without extension
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
oOptions.Value("All_Color_AS_Black") = 0
oOptions.Value("Remove_Line_Weights") = 0
oOptions.Value("Vector_Resolution") = 150
'get PDF target folder path
'oFolder = Left(oPath, InStrRev(oPath, "\")) & "PAGES"
'Check for the PDF folder and create it if it does not exist
'If Not System.IO.Directory.Exists(oFolder) Then
' System.IO.Directory.CreateDirectory(oFolder)
'End If
SheetCounter = 0
For Each oSheet In oDoc.Sheets
oTitleBlock = oSheet.TitleBlock
lPos = InStr(oSheet.Name, ":")
sSheetName = Left(oSheet.Name, lPos - 1)
SheetCounter = SheetCounter + 1
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintSheetRange
oOptions.Value("Custom_Begin_Sheet") = SheetCounter
oOptions.Value("Custom_End_Sheet") = SheetCounter
'Set the PDF target file name
oDataMedium.FileName = oPath & "\" & oFileName & _
" " & SheetCounter & " " & sSheetName & ".pdf"
'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
Next
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintSheetRange
oOptions.Value("Custom_Begin_Sheet") = 1
oOptions.Value("Custom_End_Sheet") = SheetCounter
'Set the PDF target file name
oDataMedium.FileName = oPath & "\" & oFileName & _
" MULTIPAGE" & ".pdf"
'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
'i = MessageBox.Show("PDFs exported to " & oPath, "PDFs Exported", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
myparam = InputBox("PDFs exported to", "PDFs Exported", oPath)