Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PrinterManager PrintSetup do not apply settings

Message 1 of 8
3366 Views, 7 Replies

PrinterManager PrintSetup do not apply settings



I creatint Revit Addin and need print pdf files. I Use PDFCreator virtual printer. And faced with problem when i set parameters to print manager, for example :

printer.PrintToFileName = sPath+fileName;
printer.PrintSetup.CurrentPrintSetting.PrintParameters.PaperSize = a4Ps;
printer.PrintSetup.CurrentPrintSetting.PrintParameters.PageOrientation = PageOrientationType.Landscape;
printer.PrintSetup.InSession.PrintParameters.PageOrientation = PageOrientationType.Landscape;

 when i call SubmitPrint a get pdf with Portrait orientation. All parameters get from print dialog. If i print from print dialog (Ctrl+P) and check Landscape orientation,scale 100% and Center position. Everythig printed correct. And after that i can use ,y PDFCreator from code and they printed correct too. 

I suppese that Apply() method didn't work correctly. My PArameters didn't save and passed to PDFCreator from macros.

Does anybody get such problems?


Thanks in advance.


P.S.Sorry for bad english.


Message 2 of 8
in reply to: Anonymous



We did have some other API user mention that the Print API settings did not affect the output. We had brought this behavior to the Dev Team's attention then. Your post here seems to mention the same behavior as well.


Saikat Bhattacharya
Senior Manager - Technology Consulting
Message 3 of 8
in reply to: saikat

Is there any workaround? I need to print correct from macros.

Message 4 of 8
in reply to: Anonymous

You can use PrintSetup.Save() or SaveAs() method this case like code below.(See also attached jpg) They can be called to make Revit remembering the print setup changes.


If the current Print setup is “In-Session”, this cannot be saved by Save().

You can save it to your own print setup, or save as to a new print setup.



namespace RevitAddin1



    public class Command : IExternalCommand


        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, 

            ref string message, Autodesk.Revit.DB.ElementSet elements)


            // Filter all printable views in current document and print them,

            // the print will raise events registered in controlled application.

            // After run this external command please refer to log files under folder of this assembly.

            Document document = commandData.Application.ActiveUIDocument.Document;

            UIDocument uidocument = commandData.Application.ActiveUIDocument;


            using (Transaction tx = new Transaction(document))


                tx.Start("Transaction Name");


                PrintManager pm = document.PrintManager;

                pm.SelectNewPrintDriver("CutePDF writer");

                pm.PrintRange = PrintRange.Current;

                pm.CombinedFile = true;

                pm.PrintToFile = true;

                pm.PrintSetup.CurrentPrintSetting.PrintParameters.PageOrientation = PageOrientationType.Portrait;








            // return succeed by default

            return Autodesk.Revit.UI.Result.Succeeded;






Hope this helps,

Akira Kudo

Developer Technical Services

Autodesk Developer Network

Message 5 of 8
in reply to: akira.kudo

This seems to still be the case with Revit 2015.


The only way you can save your In-Session print settings, e.g., so that it could be accessible via the normal Revit print dialog, is to do a saveas. This has to be one, out of many, of the least intuitive things in the printmanager.


Note that once you have done the saveas, you can then delete the newly saved printsetup.

Message 6 of 8
in reply to: akira.kudo

@akira.kudo Revit 2017, are there any fixes? This code does not work: set to shades of gray, printed as color. The same bug in the SDK Sample ViewPrinter (if you select "setup - <in-session>" and "black lines", color is printed anyway). "Save" or "save as" is not suitable, because I want to print without opening a transaction.

public void StartPrint()
	Document doc = this.ActiveUIDocument.Document;
	List<ViewSheet> sheets = new FilteredElementCollector(doc)

	foreach (ViewSheet sheet in sheets)
		Document curDoc = sheet.Document;
		PrintManager pManager = curDoc.PrintManager;
		pManager.PrintRange = PrintRange.Current;

		pManager.PrintSetup.CurrentPrintSetting = pManager.PrintSetup.InSession;
		PrintParameters pps = pManager.PrintSetup.CurrentPrintSetting.PrintParameters;
		pps.PaperPlacement = PaperPlacementType.Center;
		pps.ZoomType = ZoomType.FitToPage;
		pps.ColorDepth = ColorDepthType.GrayScale;

		pManager.SubmitPrint(sheet); //print in colors, no grayscales

Alexander Zuev
In BIM we trust
Facebook | Linkedin | Telegram

Message 7 of 8

The SDK example (viewprinter) is suppose to mimic the Print Dialog but it does not work when it comes to the color properties. It works fine in regards of the other properties.


This looks like a bug in the API and should be addressed by Autodesk. 


Does anybody has a workaround to produce greyscale prints?

Luis Santos

archi systems as

Message 8 of 8
in reply to: Anonymous

printManager.PrintSetup.Save();        //it works

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

Post to forums  

Autodesk Customer Advisory Groups

Rail Community