Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Printing to PDF Ilogic using Printmanager, defining file name

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
jaco011
1426 Views, 4 Replies

Printing to PDF Ilogic using Printmanager, defining file name

Hi,

I'm using ILogic to Print multiple pdf's of one idw file, using printmanager & an PDF printer ('PDF Creator')

Now, he prints the files with the idw document name with "_1", "_2", etc. behind the name.

 

I would like to define in Ilogic the filename he will be using. Anybody know how to define this name?

My PDF printer can use information like 'PrintJobName' als FileName, but I don't know how i can create this information. More options I can use as input for the filename in the PDF printer;

Options PDF printerOptions PDF printer
I know how and that it works with 'Save as' instead of 'print', but printing has other advantages I don't want to lose

 

 

 

My current code below. The part between 'Start & Finish first print' I have 5 times in my code.

InventorVb.DocumentUpdate()
Dim DocExt = ThisDoc.FileName(False)
Dim DocType = DocExt.split("_")
Dim oDocDraw As DrawingDocument
Dim openDoc As Document
Dim docFile As Document
openDoc = ThisDoc.Document
docFile = ThisDoc.ModelDocument
oDocDraw = ThisApplication.ActiveDocument
  
'format model file name for Iproperties model                  
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
Dim docFName As String 
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 

'define the property set
customPropertySet = docFile.PropertySets.Item("Inventor User Defined Properties")

'define printer settings for TPR format
oPrintMgr = ThisApplication.ActiveDocument.PrintManager
oPrintMgr.PrintRange = PrintRangeEnum.kPrintAllSheets
oPrintMgr.Printer = "PDFCreator"
oPrintMgr.PaperSize = kPaperSizeCustom
oPrintMgr.PaperHeight = 25
oPrintMgr.PaperWidth = 9
oPrintMgr.Orientation = PrintOrientationEnum.kPortraitOrientation

Dim sVariant As String
Dim Name1 As String
Dim Name2 As String
Dim Name3 As String
Dim Name4 As String
Dim Name5 As String

'Start first print 'Material = A For Each oView In oDocDraw.ActiveSheet.DrawingViews oView.SetDesignViewRepresentation("Material = A", True) Next If DocType(3) = "DxP" Then sVariant = "DAP" Else If DocType(3) = "LxR" Then sVariant = "LAR" End If Name1="TPR"&"_"&iProperties.Value(docFName,"Summary", "Keywords")&"_"&iProperties.Value(docFName,"Project", "Part Number")&"_"&sVariant oPrintMgr.SubmitPrint 'Finish first print
MessageBox.Show(Name1, "Printed Files")

 

4 REPLIES 4
Message 2 of 5
WCrihfield
in reply to: jaco011

Unfortunately, going the 3rd party PDF printer route, doesn't allow you to specify the file name within the code.

The PDF Creator software itself, may allow you to manually give the PDF a name before saving it to disc, but the iLogic code to submit the print doesn't know how to talk to that other software.

There are a lot of references here on the forum though, that show you how to export PDF's by other means.

So, when you say "Pring multible PDF of one IDW file", do you mean you want to print each page of the IDW file to its own PDF file?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 5

@jaco011,

 

Hoping that suggestions in the below forum link may be helpful.

 

https://forums.autodesk.com/t5/inventor-forum/export-multiple-sheets-to-separate-pdf-s/td-p/8303860

https://forums.autodesk.com/t5/inventor-forum/convert-idw-with-multiple-sheets-to-multiple-pdf-s-inv...

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 4 of 5
jaco011
in reply to: jaco011

Export as PDF unfortunaly creates bad images compared to print as pdf. Therefore I just accept that I have to rename my PDF file names after printer.

He creates now multiple PDF's by calling the PrintJob multiple times, which is possible because the amount and names of views are always the same.

Message 5 of 5
tomasz.sztejka
in reply to: WCrihfield

In 2011 version DisplayName drawing property was sent to a printer as "job name". In 2021 it was fixed and now the file name is sent what is not editable.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report