Page 1 of 1

How to set Manually the Document Conformance Level for PDF A3

Posted: Fri Apr 26, 2024 3:05 pm
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);
        });

    }

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

Posted: Mon Apr 29, 2024 12:13 pm
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.

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

Posted: Thu May 30, 2024 12:31 pm
by yurilima
Hi, sorry for my delay to reply.
Actually i was giving priority to solve different issue which now seems to be solved.|

Ok, lets break it down.

I have the code as a picture also in case to see much clear:
Basically i use that to set the settings before call the pdf to be printed.
However, i always says after a validation that the conformance level is missing.
Do you have any clue what am i missing to be set in settings?

Code: Select all

	/**
     * @description Set the PDF settings for the report mainly used for pdf A3 Compliance.
     * @param report Stimulsoft.Report.StiReport Optional - Null by default
     */
    setPdfDefaultSettings(report: StimulsoftType.Report.StiReport = null): void {

        // this.settings.imageResolutionMode = Stimulsoft.Report.Export.StiImageResolutionMode.Auto;

        // settings.imageResolution = 100;

        this.settings.imageCompressionMethod = Stimulsoft.Report.Export.StiPdfImageCompressionMethod.Indexed;

        this.settings.allowEditable = Stimulsoft.Report.Export.StiPdfAllowEditable.Yes;

        this.settings.embeddedFonts = true;

        this.settings.pdfComplianceMode = Stimulsoft.Report.Export.StiPdfComplianceMode.A3;

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

        this.settings.ZUGFeRDComplianceMode = Stimulsoft.Report.Export.StiPdfZUGFeRDComplianceMode.V2_1;
        this.settings.ZUGFeRDConformanceLevel = 'Extended'; // Basic, Comfort, Extended.
    }

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

Posted: Fri May 31, 2024 11:20 am
by Lech Kulikowski
Hello,

According to the ZUGFeRD standard:
ZUGFeRD v1 - PDF/A-3a
ZUGFeRD v2 and ZUGFeRD v2.1 - PDF/A-3b

If you select StiPdfZUGFeRDComplianceMode.V2_1 in the settings, you should also check for PDF/A-3b compliance.

Thank you.

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

Posted: Fri May 31, 2024 12:41 pm
by yurilima
Ohhh man.

Thanks you so much. You were right.

That works!!!

Thanks Million!!

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

Posted: Fri May 31, 2024 2:25 pm
by Lech Kulikowski
Hello,

You are welcome.