Ticket T654459
Visible to All Users

Export to PDF creates differently formatted PDF on deployment machine for same report generated by WPF app. (Version 17.2.5)

created 7 years ago

We wish to create a PDF report by generating the header, detail bands and footer at runtime in a class derived from DevExpress.XtraReports.UI.XtraReport, and then calling the ExportToPdf() method. We want to create the PDF report without sending the XtraReport - derived object to the ReportPrintTool for preview, rather just simply create the PDF file directly from a button in the app. This scheme seems to work on the developer's machine properly, but as we all know, software always works as planned in development and after deployment it is another story.

When we deploy the app, the content will not fit within the report paper boundaries and wraps which generates broken detail bands and additional pages.We have tried setting Landscape=true and various flavors of PaperKind (in the XtraReport Designer as well as in the derived class). While this does change the appearance of the PDF report, the content still will not fit, even when using a huge paperkind such as ledger (11X17).

Additionally, we tried sending the populated XtraReport - derived object to the DevExpress.XtraReports.UI.ReportPrintTool for preview and then choosing FitTo from the Scale menu which works fine and even fits the content to a Letter Landscape papersize if you choose. You can then Export To PDF from the menu and it generates a properly formatted PDF.  How can I get these same results by going directly to the ExportToPdf() method in the derived class without using the previewer and fitting the content manually?

Answers approved by DevExpress Support

created 7 years ago (modified 7 years ago)

Hi,

To accomplish this task, set the XtraReport.PrintingSystem.Document.AutoFitToPagesWidth property to 1 to scale the report's document to make it fit the page width. Pay special attention to the fact that this property should be initialized after the report's CreateDocument method is called.

    Comments (2)

      That worked. I missed that property. Thank you for the timely reply.

      Vasily (DevExpress Support) 7 years ago

        You are always welcome! I am happy to hear that my support was helpful.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.