<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Printing API question in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5517174#M73822</link>
    <description>&lt;P&gt;Hi Russ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, did you solve the problem? &amp;nbsp;If so, it will be helpful for other if you can post the working version here. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Feb 2015 17:57:00 GMT</pubDate>
    <dc:creator>mikako_harada</dc:creator>
    <dc:date>2015-02-23T17:57:00Z</dc:date>
    <item>
      <title>Printing API question</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5510918#M73820</link>
      <description>&lt;P&gt;Having trouble with a bit of printing code if the community would be kind enought to offer some help. I have looked at ViewPrinter sample but A: struggle to read that much C# and B:&amp;nbsp; think its more about replicating the revit UI for each print.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm doing is looking through a list of sheets and exporting to DWG, DWF and hopefully printing to PDF.&amp;nbsp;&amp;nbsp; I want to determine the sheet size at runtime and adjust the print settings to suite.&amp;nbsp; This works well for the DWF method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So here is a snippet.&amp;nbsp; There is a simplified UI (a single page in a wizard) where some print settings are selected.&amp;nbsp; Then for each sheet I call this method.&amp;nbsp; Most things work.&amp;nbsp; My chosen printer is used and the sheet is printed to the correct place but&amp;nbsp; my print settings are not saving so the PDF is generated using the selected driver but with the wrong page size, colour settings, etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    Private Sub ExportPDF(ByVal ExportFileName As String, ByRef thisdoc As Document, ByRef sheet As ViewSheet)
        Try
            'configure filename path for final PDF save location
            Dim sFullPath As String = Path.Combine(sbIssuePath.ToString, ExportFileName)
         
           'get the sizes with from the titleblock instances
           'method called to get these values from sheet

            pMgr = thisdoc.PrintManager
            pMgr.PrintRange = Autodesk.Revit.DB.PrintRange.Select
            pMgr.SelectNewPrintDriver(PDFPRINTERNAME)
            pMgr.PrintToFile = True
            pMgr.PrintToFileName = sFullPath

            pSetup = pMgr.PrintSetup
            pParams = pSetup.CurrentPrintSetting.PrintParameters

            pParams.ZoomType = ZoomType.Zoom
            pParams.Zoom = 100
            If Width &amp;gt; Height Then
                pParams.PageOrientation = PageOrientationType.Landscape
            Else
                pParams.PageOrientation = PageOrientationType.Portrait
            End If
            pParams.PaperPlacement = PaperPlacementType.Center

            pParams.ColorDepth = CType(Me.cboPDFColors.SelectedItem, ColorDepthType)
            pParams.RasterQuality = CType(Me.cboPDFRasterQuality.SelectedItem, RasterQualityType)

            pParams.HiddenLineViews = HiddenLineViewsType.VectorProcessing
            pParams.ViewLinksinBlue = Me.chkPDFViewLinksInBlue.CheckState
            pParams.HideReforWorkPlanes = Me.chkPDFHideRefWorkPlanes.CheckState
            pParams.HideUnreferencedViewTags = Me.chkPDFHideUnreferenceViewTags.CheckState
            pParams.HideCropBoundaries = Me.chkPDFHideCropBoundaries.CheckState
            pParams.HideScopeBoxes = Me.chkPDFHideScopeBox.CheckState
            pParams.ReplaceHalftoneWithThinLines = Me.chkPDFHalftone.CheckState
            pParams.MaskCoincidentLines = Me.chkPDFCoincidentLines.CheckState

            Dim PaperSize As String = GetPapersize(Width, Height)
            For Each ps As Autodesk.Revit.DB.PaperSize In pMgr.PaperSizes
                If ps.Name.Equals(PaperSize) Then
                    pParams.PaperSize = ps
                    Exit For
                End If
            Next

            pMgr.Apply()

            'Try
            '    oPM.ViewSheetSetting.SaveAs("transmittal")
            'Catch ex As Exception
            '    'do nothing and move on
            'End Try
            Try
                pSetup.SaveAs("transmittal")
                'oPM.PrintSetup.SaveAs("transmittal")
            Catch ex As Exception
                'do nothing and move on
            End Try

            pMgr.SubmitPrint(sheet)

            'Try
            '    oPM.ViewSheetSetting.Delete()
            'Catch ex As Exception
            '    'do nothing and move on
            'End Try
            'Try
            '    oPM.PrintSetup.Delete()
            'Catch ex As Exception
            '    'do nothing and move on
            'End Try

        Catch ex As Exception
            TaskDialog.Show("There has been an error generating the PDF file " &amp;amp; ExportFileName &amp;amp; "." &amp;amp; Environment.NewLine &amp;amp; "Please manually print the PDF using the Revit print command." &amp;amp; Environment.NewLine &amp;amp; ex.ToString, MsgBoxStyle.Information, "Error creating PDF")
        Finally

        End Try
    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Feb 2015 10:27:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5510918#M73820</guid>
      <dc:creator>russ.green</dc:creator>
      <dc:date>2015-02-18T10:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Printing API question</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5513931#M73821</link>
      <description>&lt;P&gt;just missed setting the setup for the manager....doh!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2015 07:41:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5513931#M73821</guid>
      <dc:creator>russ.green</dc:creator>
      <dc:date>2015-02-20T07:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Printing API question</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5517174#M73822</link>
      <description>&lt;P&gt;Hi Russ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, did you solve the problem? &amp;nbsp;If so, it will be helpful for other if you can post the working version here. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Feb 2015 17:57:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5517174#M73822</guid>
      <dc:creator>mikako_harada</dc:creator>
      <dc:date>2015-02-23T17:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Printing API question</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5517288#M73823</link>
      <description>&lt;P&gt;Just needed this before configuring the settings&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;pMgr.PrintSetup.CurrentPrintSetting = pMgr.PrintSetup.InSession&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Feb 2015 19:00:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5517288#M73823</guid>
      <dc:creator>russ.green</dc:creator>
      <dc:date>2015-02-23T19:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Printing API question</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5517323#M73824</link>
      <description>&lt;P&gt;Thank you, Russ!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Feb 2015 19:18:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5517323#M73824</guid>
      <dc:creator>mikako_harada</dc:creator>
      <dc:date>2015-02-23T19:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Printing API question</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5716226#M73825</link>
      <description>&lt;P&gt;Hello. I also faced the same problem. Could you post where you put that adding code? Because when I added that code into mine, it still didn't work. Could you please post your final code? Thank you very much.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2015 08:05:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/printing-api-question/m-p/5716226#M73825</guid>
      <dc:creator>18627796338</dc:creator>
      <dc:date>2015-07-13T08:05:40Z</dc:date>
    </item>
  </channel>
</rss>

