Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Can't set kPrintColorPalette, DrawingPrintManager

Anonymous

Can't set kPrintColorPalette, DrawingPrintManager

Anonymous
Not applicable

Hello,
I'm having trouble setting the ColorMode for DrawingPrintManager.
 Setting the ColorMode to kPrintGrayScale and kPrintDefaultColorMode works fine, the problem is when I'm trying to set the ColorMode to kPrintColorPalette nothing happens. By some strange reason it will always be set to kPrintDefaultColorMode?!? (The AllColorsAsBlack setting is false)

 

        private void PrintDrawing(Application application)
        {
            var document = (DrawingDocument)application.ActiveDocument;
            var printManager = (DrawingPrintManager)document.PrintManager;
            // Printer
            printManager.Printer = PrinterSettings.printer;
            // Papersize
            printManager.PaperSize = PrinterSettings.paperSize;
            if (printManager.PaperSize == PaperSizeEnum.kPaperSizeCustom)
            {
                printManager.PaperHeight = PrinterSettings.customHeight;
                printManager.PaperWidth = PrinterSettings.customWidth;
            }
           
            // Orientation
            printManager.Orientation = PrinterSettings.orientation;
            // Color         
            printManager.ColorMode = PrinterSettings.color;
            printManager.AllColorsAsBlack = PrinterSettings.allColorsBlack;
            // Range
            printManager.PrintRange = PrinterSettings.whatToPlot;
            // Copies
            printManager.NumberOfCopies = PrinterSettings.numberOfCopies;
           
            // Scale
            printManager.ScaleMode = PrinterSettings.scale;
            printManager.Scale = PrinterSettings.customScale;
            // Misc
            printManager.TilingEnabled = PrinterSettings.tiling;
            printManager.RemoveLineWeights = PrinterSettings.lineWeights;
            printManager.SubmitPrint();
        }
0 Likes
Reply
628 Views
7 Replies
Replies (7)

WCrihfield
Mentor
Mentor

This sounds exacly like another post.  See link below.

https://forums.autodesk.com/t5/inventor-customization/drawingprintmanager-colormode-will-not-be-set-... 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

Anonymous
Not applicable
Thank you WCrihfield for answering my post. It might look like the same issue/post.(I've read your answer to that post) But the problem I'm having is that I can't set the value even before I Submit the print to the printer. I.e. DrawingPrintManager printManager = new DrawingPrintManager() printManager.ColorMode = PrintColorModeEnum.kPrintGrayScale(sets the value to kPrintGrayScale) printManager.ColorMode = PrintColorModeEnum.kPrintDefaultColorMode(sets the value to kPrintDefaultColorMode) printManager.ColorMode = PrintColorModeEnum.kPrintColorPalette(sets the value to kPrintDefaultColorMode) If I wasn't able to set the value depending on selected printer, I would expect some kind of response from the Inventor API informing me of the fact. Searching the internet, almost all examples given(even the Autodesk Inventor 2020 API help) of setting the color mode uses kPrintColorPalette and not kPrintDefaultColorMode , which makes me belive that it is possible regardless of printer.
0 Likes

jjstr8
Collaborator
Collaborator

What is PrinterSettings in your original post?  That's a class in System.Drawing.Printing and doesn't have any of the properties you're referencing.  I haven't had any issues using kPrintGreyScale or kPrintColorPalette in 2017 (IDWs printed to the Microsoft PDF driver or Adobe PDF driver).  You may have shown an abbreviated version in your latest post, but you don't create a new DrawingPrintManager object.  You have to refer to the DrawingPrintManager for a specific drawing.

0 Likes

Anonymous
Not applicable

Hello jjstr8,
PrinterSettings is not(in this case) a class in System.Drawing.Printing. It's a class I use for Reading and setting values from a user config file.

The DrawingPrintManager is references as it's shown in my original post
    var document = (DrawingDocument)application.ActiveDocument;
    var printManager = (DrawingPrintManager)document.PrintManager;

0 Likes

jjstr8
Collaborator
Collaborator

I just ran my printing code in debug and checked ColorMode after setting is to kPrintColorPalette.  It comes back as kPrintDefaultColorMode.  I guess the issue still exists.  It doesn't seem to cause an issue.  It still lets me choose between color and greyscale.  I also found out that the Microsoft Print to PDF driver is ignoring the ColorMode setting.  It doesn't appear to be an option in its Printing Preferences.  At least using AllColorsAsBlack does something, just not to shaded views.

0 Likes

Anonymous
Not applicable

So it's not just me having the problem. Thank you for your input.
Hopefully someone at the forum reading this post have experienced the same problem and have an solution(if any exists)

0 Likes

^_^clovis^_^
Advocate
Advocate

Issue with Inventor 2024 is still present... can't change .ColorMode to kPrintColorPalette.

0 Likes