Message 1 of 10
How to set the papersize through printManager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, everyone!
I'm working on developing a small addin in Revit to print all view sheet to pdf file using just one button. I faced some problems when I tried to set the PaperSize and OrientationType. Though it can print view sheets, the print setting did not work well. So the result can not meet the needs.
PrintManager printManager = activeDoc.PrintManager; printManager.PrintRange = PrintRange.Select; ViewSheetSetting viewSheetSetting = printManager.ViewSheetSetting; printManager.PrintToFile = true; printManager.SelectNewPrintDriver("Adobe PDF"); printManager.PrintSetup.CurrentPrintSetting = printManager.PrintSetup.InSession; PrintSetup pSetup = printManager.PrintSetup; PrintParameters pParams = pSetup.CurrentPrintSetting.PrintParameters; pParams.PageOrientation = PageOrientationType.Portrait; if (!(printManager.PrintSetup.CurrentPrintSetting.PrintParameters.PaperSize.Name == "Screen 640x480 (VGA)")) { foreach (PaperSize ps in printManager.PaperSizes) { if (ps.Name == "Screen 640x480 (VGA)") { pParams.PaperSize = ps; } } } printManager.SubmitPrint(sheet);
Could someone please tell me how to change the code to set the PaperSize and OrientationType?
And, is there anyway to get the real size of the PaperSize? Because I can only get the PaperSizes' Name by PaperSizes.Name. Is there anyway to set my own PaperSize?
Thanks a lot.