I'm having a little trouble exporting sheets to DWF.
It wall works except if the sheet being exported does not have the print setup zoon set to 100% before running my addin the sheets will print to DWF scaled to fit or whatever scale factor it set to. I'm therefor trying to make sure the print zoom scale is set to 100% in my code before calling the export dwf method but its not changing the zoom.
This is my code...
Dim ptManager As PrintManager = uidoc.Document.PrintManager Dim ptSetup As PrintSetup = ptManager.PrintSetup Dim ptParameters As PrintParameters = ptSetup.CurrentPrintSetting.PrintParameters ptParameters.ZoomType = ZoomType.Zoom ptParameters.Zoom = 100 Try ptManager.ViewSheetSetting.Save() Catch ex As Exception End Try Try ptManager.PrintSetup.Save() Catch ex As Exception End Try uidoc.Document.Export(sbIssuePath.ToString, sbFile.ToString, views, DWFExpOpt)
Can someone please point me in the right direction?
Thanks
Hi Russ
The PrintManager class is used to configure for print settings and not for DWF export. Using this class, we can setup a printer and accordingly get access to available paper sizes, zoom level etc.
For DWF Export, as you might have noticed from Revit UI, it uses the Revit DWF Exporter and its settings (including Sheet sizes, and other settings, etc) are typically controlled by the DWFExportOptions. Unfortunately, zoom is not part of this as yet. The Development team is aware of how useful this would be and I hope we get to see this ability to set Zoom programmatically for DWF export soon too.
cheers
thanks.
I've got it working now but yes it would be so much cleaner to have zoom as part of the DWF Export Options.
A PDF Export function would be a bit useful as well
Russ
Glad to know that you got the DWF Export piece to work. Thanks for letting me know.
Regarding PDF exports, if you have a PDF Writer Driver installed, we can use the Print Manager API itself and set this driver and export to PDFs.
Hope this helps
yeah well seems to be quite hit and miss printing a sheet to PDF. Trying to print the active view (which would have just been exported to DWG and DWF and sometime the app doesn't think there is a view selected but I can't see why as when I debug and step thjough I always have a view selected.
i'll keep trying
Hi Russ Green.
I'm making a DWF exporter, I have a problem to controls color option and the Zoom function.
It sounds like you've solved it, hope you could help to explain me how you solved it.
Thank you for your time.
Asger Petersen
Start a transaction.
Create and set your print manager / setup.
Then export the DWF.
You have to set your print setup first.
trans.Start() pMgr = thisdoc.PrintManager pMgr.PrintToFile = True Dim ptSetup As PrintSetup = pMgr.PrintSetup Dim ptParameters As PrintParameters = ptSetup.CurrentPrintSetting.PrintParameters ptParameters.ZoomType = ZoomType.Zoom ptParameters.Zoom = 100 ptParameters.PaperPlacement = PaperPlacementType.Center ptParameters.ColorDepth = CType(Me.cboDWFColors.SelectedItem, ColorDepthType) ptParameters.ViewLinksinBlue = Me.chkDWFViewLinksInBlue.Checked ptParameters.HideReforWorkPlanes = Me.chkDWFHideRefWorkPlanes.Checked ptParameters.HideUnreferencedViewTags = Me.chkDWFHideUnreferenceViewTags.Checked ptParameters.HideCropBoundaries = Me.chkDWFHideCropBoundaries.Checked ptParameters.HideScopeBoxes = Me.chkDWFHideScopeBox.Checked ptParameters.HiddenLineViews = HiddenLineViewsType.VectorProcessing ptParameters.RasterQuality = CType(Me.cboDWFRasterQuality.SelectedItem, RasterQualityType) Try pMgr.ViewSheetSetting.SaveAs("transmittal") Catch ex As Exception 'do nothing and move on End Try Try pMgr.PrintSetup.SaveAs("transmittal") Catch ex As Exception 'do nothing and move on End Try Dim DWFExpOpt As DWFExportOptions DWFExpOpt = New DWFExportOptions With DWFExpOpt .ImageFormat = DWFImageFormat.Lossless If Me.rdoDWFDefault.Checked = True Then .ImageQuality = DWFImageQuality.Default If Me.rdoDWFLow.Checked = True Then .ImageQuality = DWFImageQuality.Low If Me.rdoDWFMedium.Checked = True Then .ImageQuality = DWFImageQuality.Medium If Me.rdoDWFHigh.Checked = True Then .ImageQuality = DWFImageQuality.High .ExportingAreas = chkDWFExportAreas.Checked .ExportObjectData = chkDWFObjectData.Checked .PaperFormat = sheetsize End With doc.Export(sIssuePath.ToString, ExportFileName, views, DWFExpOpt) Try pMgr.ViewSheetSetting.Delete() Catch ex As Exception 'do nothing and move on End Try Try pMgr.PrintSetup.Delete() Catch ex As Exception 'do nothing and move on End Try
Hello
there any way to apply the above code without form is this in codio and then perform the export
regards
Can't find what you're looking for? Ask the community or share your knowledge.