I am trying to print via iLogic. In my printer driver there is a ARCH D page size that I would like to use. I can get my code to work with Tabloid or Letter size, but not the ARCH D.
Here is what I see in my printer settings.
And this is the code I have so far.
Dim oDrgDoc As DrawingDocument oDrgDoc = ThisApplication.ActiveDocument ' Set reference to drawing print manager' DrawingPrintManager has more options than PrintManager' as it's specific to drawing document Dim oDrgPrintMgr As DrawingPrintManager oDrgPrintMgr = oDrgDoc.PrintManager 'Set the printer name. Either Change this to match the system printer name, or change the system printer to this name '(comment this line to use Default printer Or assign another one). oDrgPrintMgr.Printer = "PDF" oPrintMgr = ThisApplication.ActiveDocument.PrintManager 'oPrintMgr.ColorMode = kPrintGrayScale oPrintMgr.ColorMode = kPrintColorPalette 'oPrintMgr.Orientation = kPortraitOrientation oPrintMgr.Orientation = kLandscapeOrientation oPrintMgr.PaperSize = kPaperSizeArchD 'oPrintMgr.PaperHeight = 36 'oPrintMgr.PaperWidth = 24 oPrintMgr.ScaleMode = Inventor.PrintScaleModeEnum.kPrintBestFitScale oPrintMgr.SubmitPrint
I think the issue is the line
oPrintMgr.PaperSize = kPaperSizeArchD
I just don't know how to tell it to use "ARCH D".
Thanks
modified:
Dim oDrgDoc As DrawingDocument oDrgDoc = ThisApplication.ActiveDocument ' Set reference to drawing print manager' DrawingPrintManager has more options than PrintManager' as it's specific to drawing document Dim oDrgPrintMgr As DrawingPrintManager oDrgPrintMgr = oDrgDoc.PrintManager 'Set the printer name. Either Change this to match the system printer name, or change the system printer to this name '(comment this line to use Default printer Or assign another one). oDrgPrintMgr.Printer = "Microsoft Print to PDF"'"PDF" 'oDrgPrintMgr.PaperSize 'oDrgPrintMgr = ThisApplication.ActiveDocument.PrintManager 'oDrgPrintMgr.ColorMode = kPrintGrayScale oDrgPrintMgr.ColorMode = kPrintColorPalette 'oDrgPrintMgr.Orientation = kPortraitOrientation oDrgPrintMgr.Orientation = kLandscapeOrientation oDrgPrintMgr.PaperSize = Inventor.PaperSizeEnum.kPaperSizeArchD 'oDrgPrintMgr.PaperHeight = 36 'oDrgPrintMgr.PaperWidth = 24 oDrgPrintMgr.ScaleMode = Inventor.PrintScaleModeEnum.kPrintBestFitScale oDrgPrintMgr.SubmitPrint
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-F3166287-12EE-4F7A-B424-AB33E4F81E53
No Arch D in enum.
Might need to use kPaperSizeCustom and set paper size with PaperHeight, PaperWidth.
https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-D44850E3-B0CE-4608-AEA6-02373305804C
I got it to work using kPaperSizeCustom. NOTE: units are in cm.
'Set Paper Size. Height x Width units are in centimeters.
oPrintMgr.PaperSize = kPaperSizeCustom
oPrintMgr.PaperHeight = 91.44
oPrintMgr.PaperWidth = 60.96
Dim oDrgDoc As DrawingDocument oDrgDoc = ThisApplication.ActiveDocument ' Set reference to drawing print manager' DrawingPrintManager has more options than PrintManager' as it's specific to drawing document Dim oDrgPrintMgr As DrawingPrintManager oDrgPrintMgr = oDrgDoc.PrintManager 'Set the printer name. Either Change this to match the system printer name, or change the system printer to this name '(comment this line to use Default printer Or assign another one). oDrgPrintMgr.Printer = "PDF" oPrintMgr = ThisApplication.ActiveDocument.PrintManager 'Set Color Mode 'oPrintMgr.ColorMode = kPrintGrayScale oPrintMgr.ColorMode = kPrintColorPalette 'Set Orientation 'oPrintMgr.Orientation = kPortraitOrientation oPrintMgr.Orientation = kLandscapeOrientation 'Set Paper Size. Height x Width units are in centimeters. oPrintMgr.PaperSize = kPaperSizeCustom oPrintMgr.PaperHeight = 91.44 oPrintMgr.PaperWidth = 60.96 ' Set to print all sheets. oPrintMgr.PrintRange = kPrintAllSheets 'oPrintMgr.PrintRange = kPrintCurrentSheet oPrintMgr.ScaleMode = kPrintBestFitScale oPrintMgr.SubmitPrint
Thanks
I thought I had it figured out, but I have another related question. "What-if" I wanted to print using the Windows default system printer? I thought that I could just comment out the line
'oDrgPrintMgr.Printer = "\\SRV-VM-RUS-DC2\FMI Engineering - BW Ricoh MP C4504EX PCL6"
When I do that, it will use which ever printer was used to print the last file. It might be PDF or a different printer.
I want it to use the printer set as Default in Windows. Is there a way to do that?
Thanks
Part of the problem is Windows.
Default is "last printer".
You might need to hard code the printer.
Now you can setup (copy) a printer and rename it in Windows (like "IV Default").
Use that as "Default" in your code.
You can also add form so user can change default printer and paper size.
I did not use printer to make PDF.
I used IV PDFAddIn.
Public Sub PublishPDF()
' Get the PDF translator Add-In.
Dim PDFAddIn As TranslatorAddIn
Set PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
'Set a reference to the active document (the document to be published).
Dim oDocument As Document
Set oDocument = ThisApplication.ActiveDocument
Dim oContext As TranslationContext
Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Create a DataMedium object
Dim oDataMedium As DataMedium
Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
' Check whether the translator has 'SaveCopyAs' options
If PDFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
' Options for drawings...
oOptions.value("All_Color_AS_Black") = 0
oOptions.value("Remove_Line_Weights") = 0
' Resolutions: 150, 200, 300, 400, 600, 720, 1200, 2400, 4800
oOptions.value("Vector_Resolution") = 1200
oOptions.value("Sheet_Range") = kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2
'oOptions.Value("Custom_End_Sheet") = 4
End If
Dim DrawingName As String
DrawingName = " "
Dim DrawingPath As String
DrawingPath = " "
Dim DrawingFullName As String
DrawingFullName = oDocument.FullFileName
Call SplitPath(DrawingFullName, DrawingPath, DrawingName)
'Check if folder exist, create if not
On Error Resume Next
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.CreateFolder(DrawingPath + "PDF")
'Set the destination file name
oDataMedium.Filename = DrawingPath + "PDF\" + DrawingName + ".pdf"
'Publish document.
Call PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
End Sub
@Frederick_Law wrote:
Part of the problem is Windows.
Default is "last printer".
You might need to hard code the printer.
That's what I was afraid of. I am trying to make a generic Global form for everyone here to use. There are several users that use different printers, so I have to create a iLogic rule that has the name of their "Default" printer in the rule.
If I had a way for them to pick from a list of available printers, that might work too.
This is what my form looks like so far. I have a different rule for each button here.
Can't find what you're looking for? Ask the community or share your knowledge.