How to set Manually the Document Conformance Level for PDF A3

Stimulsoft Reports.JS discussion
Post Reply
yurilima
Posts: 12
Joined: Wed Oct 11, 2023 10:11 am

How to set Manually the Document Conformance Level for PDF A3

Post by yurilima »

At the moment that is how i am trying to set the PDF A3 Complice mode, however i am still getting errors. I attached a pic where it shows the error from a validator website. https://avepdf.com/pdfa-validation

Could you please tell me where am doing the mistake ?

Code: Select all

async getReportPDFAsBuffer(report: StimulsoftType.Report.StiReport): Promise<number[]> {

        // Create an PDF settings instance. You can change export settings.
        var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
        // 1.
        // settings.imageResolutionMode = Stimulsoft.Report.Export.StiImageResolutionMode.Exactly;
        // 2.
        // settings.imageResolution = 100;
        // 3.
        settings.imageCompressionMethod = Stimulsoft.Report.Export.StiPdfImageCompressionMethod.Flate;
        // 4.
        settings.allowEditable = Stimulsoft.Report.Export.StiPdfAllowEditable.No;
        // 5.
        settings.embeddedFonts = true;
        // 6.
        settings.pdfComplianceMode = Stimulsoft.Report.Export.StiPdfComplianceMode.A3;

        settings.pdfACompliance = true;
        settings.compressed = true;
        // settings.standardPdfFonts = true;

        // settings.autoPrintMode = Stimulsoft.Report.Export.StiPdfAutoPrintMode.None;


        settings.ZUGFeRDComplianceMode = Stimulsoft.Report.Export.StiPdfZUGFeRDComplianceMode.V2;
        // settings.ZUGFeRDConformanceLevel = 'PDF/A-3';

        // report.getFonts().forEach((font: StimulsoftType.System.Drawing.Font) => {
        //     console.log("Font", font.name);
        // });

        // Create an PDF service instance.
        var service = new Stimulsoft.Report.Export.StiPdfExportService();

        // Create a MemoryStream object.
        var stream = new Stimulsoft.System.IO.MemoryStream();

        // return new Promise((resolve, reject) => {
        //     report.exportDocumentAsync((event) => {
        //         console.log("Exporting", event);
        //         resolve(event);
        //     }, Stimulsoft.Report.StiExportFormat.Pdf, service, settings);
        // });

        // return new Promise((resolve, reject) => {
        //     report.exportDocument(Stimulsoft.Report.StiExportFormat.Pdf, service, settings, (event) => {
        //         console.log("Exporting", event);
        //         resolve(event);
        //     });
        // });



        // return new Promise((resolve, reject) => {
        //     service.exportPdf(report, stream, settings);
        //     const data = stream.toArray();
        //     resolve(data);
        // });

        // return new Promise((resolve, reject) => {
        //     service.exportTo2(report, stream, settings).then(() => {
        //         const data = stream.toArray();
        //         resolve(data);
        //     });
        // });

        // Export to PDF asynchronously
        return new Promise((resolve, reject) => {
            service.exportToAsync(async () => {
                const data = stream.toArray();
                resolve(data);

            }, report, stream, settings);
        });

    }
Attachments
Screenshot 2024-04-26 at 15.59.57.png
Screenshot 2024-04-26 at 15.59.57.png (47.1 KiB) Viewed 85 times
Lech Kulikowski
Posts: 6311
Joined: Tue Mar 20, 2018 5:34 am

Re: How to set Manually the Document Conformance Level for PDF A3

Post by Lech Kulikowski »

Hello,

Can't see what the problem is from the screenshot.
At first glance - most often the problem in JS is with fonts, you need to have all the necessary fonts loaded in StiFontCollection.
If it doesn't help, send an example report and the resulting pdf file for analysis.

Thank you.
Post Reply