Problem ActiveReport.Run(): Printer does not support a4 papersize

Originally Posted 2 February 2004, 8:32 am EST

  • Originally Posted 2 February 2004, 8:32 am EST

    Dear AR lovers,

    I got myself stuck with the following problem:

    At the moment of report creation ActiveReports throws:
    <font size="2">Printer does not support A4 papersize. Please use PaperKind.Custom in your PageSettings or specify a papersize supported by the current printer

    this is the code:
    <font size="2">
    //assume we have a table with data:
    <font size="2">DataTable table = GetData();

    DataDynamics.ActiveReports.ActiveReport rpt = </font><font color="#0000ff" size="2">new</font><font size="2"> DataDynamics.ActiveReports.ActiveReport();
    strm = </font><font color="#0000ff" size="2">new</font><font size="2"> System.IO.MemoryStream(report.TemplateData);
    strm.Position = 0;
    </font></font><font size="2">
    rpt.DataSource = table;
    rpt.Run();</font><font color="#008000" size="2">//blocked mode
    <font color="#000000">...

    <font size="3">Does anyone know why AR is complaining about a printer at this point?
    </font>Is there any way to circumvent this behavior?

    Choosing another default printer on the machine in question doesn't solve the problem.
    Choosing another paper size (eg Letter) doesn't solve the problem.
    I am obsolutely sure that the printers selected were capable of printing at the sizes specified.

    Thanks in advance,

  • Reply

    If you set at designtime A4 as the paper size, the report engine looks at the default printer for the machine (if it's a windows environment) or the default printer that is setup for the ASPNET account, which usually is nothing if this is a web environment.  You can set the Printer's name to a null string ("") to tell ActiveReports to not look for a printer and it will figure out proper page settings on its own.

  • Reply

    I've done the following to my existing code;

       ActiveReport rpt = new ActiveReport();
       rpt.Document.Printer.PrinterName = "";

    But when it gets to rpt.Run() I get the following error;

       An unhandled exception of type 'System.NullReferenceException' occurred in activereports.dll

       Additional information: Object reference not set to an instance of an object.

    At the point just before this error the ((DataDynamics.ActiveReports.Document.Printer)((rpt.Document.Printer))).VisibleBounds value is;
       <error: an exception of type: {System.Drawing.Printing.InvalidPrinterException} occurred>

    Is this related to my error? Am I setting the PrinterName property of the wrong control? When I remove the line that sets this to an empty string the report runs fine on my machine but a colleague overseas has the error described in the previous post.

  • Reply

    The error 2 posts above sounds like a connection issue with the printer.  Setting the printer name to a null string will not cause this error that you are recieving in the above post, I would need to take a closer look at your code to determine why this is happening.  Make sure you are using the latest build of ActiveReports for .NET (Build 2009 I believe is the most current at the moment) and you might try putting the code in a try catch block and write out the stack trace somewhere for review.  This should give us a better idea of where exactly the error is being thrown and if it's within the ActiveReports object or elseware.
  • Reply

    Hi there,
    I have what I think is a similar problem that I'm hoping will have the same solution. I have a report writing "wizard" dll that uses Active Reports. One of my collegues who is using the dll overseas gets an error when previewing any report:

    <font face="Book Antiqua" size="2"><span style="FONT-SIZE: 10pt">Inner Exception: Failed to open the \\xxxxxx\KONICA MINOLTA Di2510 PCL6 printer, System error number: 5</span></font>

    <font face="Book Antiqua" size="2"><span style="FONT-SIZE: 10pt"></span></font> 

    <font face="Book Antiqua" size="2"><span style="FONT-SIZE: 10pt">at DataDynamics.ActiveReports.Document.DDPaperSize.-1(String printerName, String paperName, Single width, Single height)</span></font>

    <font face="Book Antiqua" size="2"><span style="FONT-SIZE: 10pt">   at DataDynamics.ActiveReports.Document.DDPaperSize..ctor(String printerName, String paperName, Single width, Single height)</span></font>

    <font face="Book Antiqua" size="2"><span style="FONT-SIZE: 10pt">   at DataDynamics.ActiveReports.ActiveReport.-dfd()</span></font>

    <font face="Book Antiqua" size="2"><span style="FONT-SIZE: 10pt">   at DataDynamics.ActiveReports.ActiveReport.-dbf(Boolean bDelayedInit)</span></font>

    <font face="Book Antiqua" size="2"><span style="FONT-SIZE: 10pt">   at DataDynamics.ActiveReports.ActiveReport.Run(Boolean syncDocument)</span></font>

    <font face="Book Antiqua" size="2"><span style="FONT-SIZE: 10pt">   at DataDynamics.ActiveReports.ActiveReport.Run()</span></font>

    Do you think this is caused by an invalid paper size for his printer or some other problem with the printer that is connected to his machine?
    As my tool will be used across multiple countries would you recommend disabling the report printer by setting the PrinterName to an empty string so a report designed in A4 in Australia will be able to be viewed (but not printed) in America without throwing an exception?

    Thanks in advance.

  • Reply

    I've found the problem!
    I have been setting some of the PageSettings of the report including the PageSettings.PaperName attribute in a derived class. When I comment out the PaperName assign the preview report runs fine after setting the PrinterName to a null string.
    So now I can release a new version to my overseas colleague. Just to make sure that I am on the right track with this do you think setting the PrinterName attribute to a null string before running a report will bypass the connection issue with the printer which is giving him his error?


  • Reply

    It should as it shouldn't attempt to look for the printer at all now.
  • Reply

    If you set paper size as A4 the engine throws ActiveReports error. Many times I get the same error when I select the size of A4. But when I use PaperKind.Custom in my paper setting than its work properly I get this idea from [url=""] facebook[/url].
Need extra support?

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

Learn More

Forum Channels