- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
See code below, anyone know why I am not getting B&W output???
See code below, anyone know why I am not getting B&W output???
'[
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
pdfname = ThisDoc.FileName(False)
filePath = ThisDoc.Path
' Set the printer name' comment this line to use default printer or assign another one
oDrgPrintMgr.Printer = "Microsoft Print to PDF"
'Set the paper size , scale and orientation
oDrgPrintMgr.ScaleMode = kCustomScale
oDrgPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
'oDrgPrintMgr.PaperSize = PaperSizeEnum.kPaperSizeLedger
oDrgPrintMgr.PaperSize = kPaperSizeTabloid
'oDrgPrintMgr.PaperSize = 14338
oDrgPrintMgr.PrintRange = 14082 'kPrintAllSheets
oDrgPrintMgr.Orientation = kLandscapeOrientation
'oDrgPrintMgr.PaperSource = 2
oDrgPrintMgr.AllColorsAsBlack = True
Dim doc = ThisDoc.Document
doc.SaveAs(filePath + "\" + pdfname + ".pdf", True)
'oDrgPrintMgr.SubmitPrint
']
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Try this iLogic code.
Public Sub main
' Get the PDF translator Add-In.
Dim PDFAddIn As TranslatorAddIn
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
oDocument = ThisApplication.ActiveDocument
Dim oContext As TranslationContext
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Create a DataMedium object
Dim oDataMedium As DataMedium
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") = 1
'oOptions.Value("Remove_Line_Weights") = 0
'oOptions.Value("Vector_Resolution") = 400
'oOptions.Value("Sheet_Range") = kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2
'oOptions.Value("Custom_End_Sheet") = 4
End If
'Set the destination file name
oDataMedium.FileName = "c:\temp\test.pdf"
'Publish document.
PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
End Sub
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@chandra.shekar.g Thanks for the reply but the code you supplied also outputs in color instead of b&w.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
To illustrate black and white pdf export through previous iLogic code, a screencast video is prepared and uploaded to below link.
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@chandra.shekar.g This does not work on my system, I have copied the above code as is and I can switch "All Colors As Black" back and forth from 1 to 0 and all prints come out in color.
Sorry this is not a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can you please demonstrate the scenario with video record using non confidential data?
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@chandra.shekar.g There's really nothing to demonstrate, I took your code above and printed, it only outputs in color.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Could you please provide non confidential drawing data to test the behavior?
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
You can use any of the sample projects that come default with Inventor and a default template. These still output in color, so I know it has nothing to do with our data.