DWF PrintParameters in API

DWF PrintParameters in API

navyabasavaraju01
Contributor Contributor
716 Views
3 Replies
Message 1 of 4

DWF PrintParameters in API

navyabasavaraju01
Contributor
Contributor

Experts,

Any idea what's the wrong with below code, still I'm struggling to get grayscale and other setting output in DWF. 

 op.PaperFormat = ExportPaperFormat.ISO_A0; op.ImageQuality = DWFImageQuality.Default;
 doc.PrintManager.PrintSetup.CurrentPrintSetting.PrintParameters.ZoomType = ZoomType.Zoom;
 doc.PrintManager.PrintSetup.CurrentPrintSetting.PrintParameters.Zoom = Convert.ToInt32("100");
 doc.PrintManager.PrintSetup.CurrentPrintSetting.PrintParameters.PaperPlacement = PaperPlacementType.Center;
 doc.PrintManager.PrintSetup.CurrentPrintSetting.PrintParameters.HiddenLineViews = HiddenLineViewsType.VectorProcessing;
 doc.PrintManager.PrintSetup.CurrentPrintSetting.PrintParameters.ColorDepth = ColorDepthType.GrayScale;
 doc.PrintManager.PrintSetup.SaveAs("_DWF"); doc.PrintManager.Apply();

 

 

0 Likes
717 Views
3 Replies
Replies (3)
Message 2 of 4

RPTHOMAS108
Mentor
Mentor

The key thing you need to do is get the PrintManager from the document and assign it to a variable to change it's properties. Every time you call Document.PrintManager you are getting a new instance of the PrintManager not the instance with the properties you updated on the previous line i.e. you are currently getting an object with old settings that overwrite the setting you changed on the previous line.

 

Updates are not applied back to global object until Apply or Print. This is noted in Revit.chm under PrintManager and example code is given on that basis.

0 Likes
Message 3 of 4

navyabasavaraju01
Contributor
Contributor

Hi @RPTHOMA108

 

Thanks for your quick response.

I have tried as you suggested but still my result is same as previous, I am not able to export in grey option.

PrintManager _pm = doc.PrintManager;
op.PaperFormat = ExportPaperFormat.ISO_A0; op.ImageQuality = DWFImageQuality.Default;
_pm.PrintSetup.CurrentPrintSetting.PrintParameters.ZoomType = ZoomType.Zoom;
_pm.PrintSetup.CurrentPrintSetting.PrintParameters.Zoom = Convert.ToInt32("100");
_pm.PrintSetup.CurrentPrintSetting.PrintParameters.PaperPlacement = PaperPlacementType.Center;
_pm.PrintSetup.CurrentPrintSetting.PrintParameters.HiddenLineViews = HiddenLineViewsType.VectorProcessing;
_pm.PrintSetup.CurrentPrintSetting.PrintParameters.ColorDepth = ColorDepthType.GrayScale;
_pm.PrintSetup.SaveAs("_DWF"); doc.PrintManager.Apply();
doc.Export(path_dwf, v.Value, vset, op);
0 Likes
Message 4 of 4

RPTHOMAS108
Mentor
Mentor

PrintManager _pm = doc.PrintManager;
op.PaperFormat = ExportPaperFormat.ISO_A0; op.ImageQuality = DWFImageQuality.Default;
_pm.PrintSetup.CurrentPrintSetting.PrintParameters.ZoomType = ZoomType.Zoom;
_pm.PrintSetup.CurrentPrintSetting.PrintParameters.Zoom = Convert.ToInt32("100");
_pm.PrintSetup.CurrentPrintSetting.PrintParameters.PaperPlacement = PaperPlacementType.Center;
_pm.PrintSetup.CurrentPrintSetting.PrintParameters.HiddenLineViews = HiddenLineViewsType.VectorProcessing;
_pm.PrintSetup.CurrentPrintSetting.PrintParameters.ColorDepth = ColorDepthType.GrayScale;
_pm.PrintSetup.SaveAs("_DWF"); doc.PrintManager.Apply();
doc.Export(path_dwf, v.Value, vset, op);

 

Try _pm.Apply perhaps? Also why are you using Document.Export? You either print using PrintManager.SubmitPrint (PrintManager.IsVirtual = DWFWriter) or you use Export via Document.Export with DWFExportOptions. The two approaches are unrelated I believe. There are no PrintManager related settings in DWFExportOptions unlike in the UI where print manager window is available through Export DWF.

 

Therefore limitations appear to be amoungst other things:

Document.Export approach doesn't support greyscale whilst PrintManager does

PrintManager approach doesn't support DWFx

 

0 Likes