the report loads the xml file but delivers the pdf blank

Stimulsoft Reports.JS discussion
Post Reply
manuel.leonor
Posts: 2
Joined: Tue Aug 22, 2023 10:19 pm

the report loads the xml file but delivers the pdf blank

Post by manuel.leonor »

Hi guys, I'm updating my stimulsoft environment to the latest version: 2023.3.2
The previous version that the project had was 2023.1.5, when we updated to the latest version it no longer worked

I have a function to generate a pdf report with xml but when the report is generated it comes out empty.

Code: Select all


  const base64ToString = Buffer.from(data.Template, "base64").toString();

    const Stimulsoft = window.Stimulsoft;
    Stimulsoft.Base.StiLicense.key = ReportingAuthCode
    // Creating a new report object
    const report = Stimulsoft.Report.StiReport.createNewReport();

    // Loading a report template (MRT) into the report object
    report.load(base64ToString);

    // Carga del xml
    const blob = new Blob([data.XML], { type: 'text/xml' });
    const url = URL.createObjectURL(blob);
    const dbCFDi = report.dictionary.databases.getByName("CFDi");
    dbCFDi.pathSchema = "";
    dbCFDi.pathData = url;

    // Variables del reporte
    let variable = report.dictionary.variables.getByName('OriginalString');

    if (variable)
        variable.value = data.OriginalString;

    variable = report.dictionary.variables.getByName('OriginalStringSAT');

    if (variable)
        variable.value = data.OriginalStringSAT;
        
         report.renderAsync(() => {

                                // Exporting the report to PDF
                                report.exportDocumentAsync((pdfData) => {
                                    const fileName = `${data.StampUUID.toUpperCase()}.pdf`
                                    window.Stimulsoft.System.StiObject.saveAs(pdfData, fileName, 'application/pdf');

                                }, window.Stimulsoft.Report.StiExportFormat.Pdf);
                            });

Does anyone know how to fix it, I'm using MRT JSON reports
Attachments
Captura de pantalla 2023-08-22 162543.png
Captura de pantalla 2023-08-22 162543.png (71.82 KiB) Viewed 2527 times
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: the report loads the xml file but delivers the pdf blank

Post by Lech Kulikowski »

Hello,

Please send us a sample project that reproduces the issue for analysis on support@stimulsoft.com

Thank you.
Post Reply