Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / How to Create a PDF/A-...
Finance forum
Unanswered

How to Create a PDF/A-3 Document in Dynamics 365 for ZATCA Integration Phase 2

Posted on by 8
Hello everyone,
I’m working on integrating with ZATCA (Zakat, Tax and Customs Authority) Phase 2 requirements, and part of this involves generating PDF/A-3 documents with embedded XML for e-invoicing compliance. I need to create PDF/A-3 files directly within Dynamics 365 Finance and Operations.
I've tried creating the PDF/A-3 externally in C# using a custom DLL and calling it from X++, but I'm running into challenges with D365 not recognizing the PDF library and facing compatibility issues.
 

My Questions:

  • Is there a way to generate PDF/A-3 documents directly in Dynamics 365 FO?
  • Has anyone successfully integrated ZATCA’s Phase 2 requirements for PDF/A-3 within D365, and if so, what approach did you use?
  • Are there any recommended third-party libraries or techniques that work smoothly with D365 for PDF/A-3 creation?
Any insights or guidance on handling PDF/A-3 compliance within Dynamics 365 would be greatly appreciated. Thank you!
 
Regards
Pratik Chakraborty
  • CU30100517-0 Profile Picture
    CU30100517-0 8 on at
    How to Create a PDF/A-3 Document in Dynamics 365 for ZATCA Integration Phase 2
    Hi @Ahmed
    Thnaks for the response, I see you have used both iTextSharp and iText 7 in your mentioned code.
    I have already written the code using iText 7 and is totally working in Console Application but to use it as a dll, we need to change the output type from console Application to Class Library. So, the challenges that I am facing recently is when I am creating the Dll and using it in f&o I am getting an exception in the line.
     
    PdfDocument pdfDocument = new PdfDocument(pdfReader);
     
    where pdfContent is the byte array of the existing pdf.
     
    Exception message : "Method not found: 'Void Microsoft.Extensions.Logging.LoggerExtensions.LogError(Microsoft.Extensions.Logging.ILogger, System.Exception, System.String, System.Object[])'."
     
     
     
  • ShahzaibAhmed52 Profile Picture
    ShahzaibAhmed52 112 on at
    How to Create a PDF/A-3 Document in Dynamics 365 for ZATCA Integration Phase 2
    Have you tried using itextsharp?

    here is the sample code for refrence.
     
    public byte[] ConvertToPDFA3Bytes(string srcPDF, string xmlPath, string xmlFileName)
    	{
    		iTextSharp.text.pdf.PdfReader reader = new iTextSharp.text.pdf.PdfReader(srcPDF);
    		using MemoryStream ms = new MemoryStream();
    		using (PdfStamper stamper = new PdfStamper(reader, ms))
    		{
    			PdfFileSpecification pfs = PdfFileSpecification.FileEmbedded(stamper.Writer, xmlPath, xmlFileName, null);
    			stamper.AddFileAttachment(xmlFileName.Replace(".xml", ""), pfs);
    		}
    		iText.Kernel.Pdf.PdfWriter myPDFWriter = new iText.Kernel.Pdf.PdfWriter(ms);
    		return ms.ToArray();
    	}
     
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,807 Super User 2024 Season 2 on at
    How to Create a PDF/A-3 Document in Dynamics 365 for ZATCA Integration Phase 2
    Hi Pratik,

    Have you checked for possible ISV solutions instead of trying to customize this yourself? There are some solutions listed on AppSource Business Apps – Microsoft AppSource. Also Flick Network seems to offer a solution.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,807 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,135 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans