Report Preview fails with Custom Paper size

Posted by: kokosch on 14 September 2017, 10:13 am EST

    • Post Options:
    • Link

    Posted 14 September 2017, 10:13 am EST

    [activereports_archive]Please don’t use windows default printer setting when previewing reports within the designer.

    My System default Printer doesn’t support custom paper size, but the preview should be independent from my current default printer.

    Exception details:

    System.ApplicationException: Failed to open the @Printername printer, System error number: 5

    at GrapeCity.ActiveReports.Extensibility.Printing.DDPaperSize.AddCustomPaperSize(String printerName, String paperName, Single width, Single height)

    at GrapeCity.ActiveReports.Extensibility.Printing.DDPaperSize…ctor(String printerName, String paperName, Single width, Single height)

    at GrapeCity.ActiveReports.SectionReport.#azb()

    at GrapeCity.ActiveReports.SectionReport.#1yb(Boolean bDelayedInit)

    at GrapeCity.ActiveReports.SectionReport.Run(Boolean syncDocument)

    at GrapeCity.ActiveReports.SectionReport.Run(Boolean syncDocument)

    at GrapeCity.ActiveReports.Design.ArDesigner.ReportDesigner.ReportDesignerMain.DesignerTabControllerSelectionChanged(Object sender, EventArgs e)

    Thanks

    Gerald

    [/activereports_archive]

  • Posted 14 September 2017, 10:13 am EST

    [activereports_archive]Hello Gerald,

    As such, setting Custom Paper Size and previewing the reports never fails at my end. Can you please try adding the following line, prior to the rpt.Run() line in your report’s ReportStart event (either in code-behind or in its Script tab) :

    rpt.Document.Printer.PrinterName = “”

    So, your new code would be:

    rptSectionREPORT.Document.Printer.PrinterName = ""
    rptSectionREPORT.Run()    
    

    This forum post seems to be similar to the problem that you’re having - it may be worth taking a look at:

    http://arhelp.grapecity.com/groups/topic/failed-to-open-the-microsoft-xps-writer-printer-system-error-number-5-with-local-xps-writer/

    You may also refer to the topic “The viewer shows the report on the wrong paper size” in the documentation link :

    http://arhelp.grapecity.com/webhelp/AR10/index.html#arRELTroubleshooting.html

    Let me know if I misunderstood your issue by elaborating a bit more on the same.

    Regards,

    Reema[/activereports_archive]

  • Posted 14 September 2017, 10:13 am EST

    [activereports_archive]Actually this doesn’t help.

    Network printer setting depends on privileges set by your network administrator. In business environments most people won’t have this right.

    The use case is: I use the sample GrapeCity Samples\ActiveReports 10\Professional\EndUserDesigner

    Customer opens rpx file with a custom paper size in the designer. Clicks preview -> fails as mentioned.

    I don’t want to put a script in every rpx file. I can’t access the code behind. How to tell the designer control (current loaded report) to use .Printername =“”

    This did not help: on pushing Preview the windows System Default Printer is used again.

    [vb]Private Sub reportDesigner_ReportChanged(sender As Object, e As EventArgs) Handles reportDesigner.ReportChanged

    CType(reportDesigner.Report(), SectionReport).Document.Printer.PrinterName = “”

    CType(reportDesigner.Report(), SectionReport).Document.Printer.PrinterSettings.PrinterName = “”

    End Sub[/vb]

    how to fix it?

    My suggestion is the preview function should be independent from current Windows System Default Printer.

    Thanks

    Gerald[/activereports_archive]

  • Posted 14 September 2017, 10:13 am EST

    [activereports_archive]Hello Gerald,

    As such I am unable to reproduce the mentioned behavior at my end with our latest release AR10 SP2 release available at :

    http://activereports.grapecity.com/downloads/

    Attached is the video depicting the behavior at my end for your reference.

    Can you please confirm the AR build/version you are using ?

    Meanwhile, I am also in discussions with the development team(212722) regarding your issue and will get back to you as/when I get an update from them.

    Regards,

    Reema[/activereports_archive]

    2016/08/CustomPaperBehavior.gif

  • Posted 14 September 2017, 10:13 am EST

    [activereports_archive]Hello Reema,

    This problem depends on the system default printer. (AR10 SP2)

    If the default printer is set to XPS no one on our side has this problem.

    Only network printers with no right to access papersize setting produce the error. But those are the natural default printer, because they are the only printers printing on paper.

    During development it is not problem to switch the default printer but on live systems we can’t .

    Thanks

    Gerald

    [/activereports_archive]

  • Posted 14 September 2017, 10:13 am EST

    [activereports_archive]Hello Gerald,

    Here is an update from the development team :

    “You are suggested to disable the default preview tab in EUD and add own tab/window with WinViewer control. In this case, you will be able to change the report and printer settings before preview.”

    Hope this helps.

    Regards,

    Reema[/activereports_archive]

  • Posted 18 December 2019, 6:45 am EST

    I have customers with the same issue using AR 7 usually changing the default printer to XPS document works, but not all the time, and then of course the user has to remember to change it back. I have set the PrinterName =“” which doesn’t seem to help.

    I am using the ActiveReports.Viewer.WinViewer.Viewer control to preview the report (which I think you are suggesting above), the error happens sometime during the report creation so it never gets to the viewer.

  • Posted 18 December 2019, 5:06 pm EST

    Hello,

    AR7 is out of the maintenance mode now and we do not provide its support.

    However, as per your concern:

    This error message occurs if the user does not have correct permission set to print from the printer or if the printer driver does not support paper size which is being set. If the remote user does not have enough rights to add the custom paper size, the error may occur. Ensure that you provide the necessary permissions on the printer for the remote user.

    Also, your Windows User Account Control settings must be interfering with your printer settings.

    Thanks,

    Esha

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels