Ihor
Ihor

Reputation: 11

Get report from Acumatica as single page PDF

I am trying to get Acumatica report as single page PDF. (Multiple pages works fine regardless is it from report screen or PDF generated by custom code) All reports and groups got "True" in Keep Together setting. I tried this as report screen, or tried to generate PDF with code:

    public PXAction<PX.Objects.AR.ARInvoice> CreatePDF;
    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "Create PDF")]
    protected void createPDF()
    {
        //Report Paramenters
        Dictionary<String, String> parameters = new Dictionary<String, String>();
        parameters["ARInvoice.DocType"] = Base.Document.Current.DocType;
        parameters["ARInvoice.RefNbr"] = Base.Document.Current.RefNbr;
        parameters["DocType"] = Base.Document.Current.DocType;
        parameters["RefNbr"] = Base.Document.Current.RefNbr;
        //Report Processing
        PX.Reports.Controls.Report _report = PX.Data.Reports.PXReportTools.LoadReport("EP301009", null);

        PX.Data.Reports.PXReportTools.InitReportParameters(_report, parameters,
                PX.Reports.SettingsProvider.Instance.Default);
        ReportNode reportNode = ReportProcessor.ProcessReport(_report);
        //Generation PDF
        byte[] data = PX.Reports.Mail.Message.GenerateReport(reportNode, ReportProcessor.FilterHtml).First();
        FileInfo file = new FileInfo("report.html", null, data);
        //Saving report
        UploadFileMaintenance graph = new UploadFileMaintenance();
        graph.SaveFile(file);
        PXNoteAttribute.AttachFile(Base.Document.Cache, Base.Document.Current, file);
        throw new PXRedirectToFileException(file, true);
    }

The only result with single page, that i achieved - Acumatica is showing only first page, when clicking "PDF" button. Others are lost.

Is it possible to override "PDF" button behavior in Acumatica?

Upvotes: 0

Views: 374

Answers (1)

Hugues Beaus&#233;jour
Hugues Beaus&#233;jour

Reputation: 8268

The report engine is page based so you must use pages. There's only a finite amount of data that can fit on a single page of a finite size.

I would recommend to increase the page size to fit more data on a single page. This can be done in the PageSettings properties of the report in Acumatica report designer.

enter image description here

Upvotes: 1

Related Questions