Forum


Replies: 5   Views: 393
Create pdf/a-3 with xml embeded
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by bilal.app4legal  · 03-06-2024 - 05:42

Hi,
I am using "phpdocx-premium-12.5-ns" and want to create PDF/A-3 and Embed XML with it how to achieve this, note that i try below code but it don't create real pdf/a-3 format and also how to embed the xml on it
 

$docx->transformDocument("file.docx", "file.pdf", 'libreoffice', ['pdfa3' => true]);

 

Thanks

Posted by admin  · 03-06-2024 - 06:29

Hello,

Please note that generating PDF/A-3 documents using the conversion plugin based on LibreOffice is available since the release of phpdocx 14.0 (https://www.phpdocx.com/news/post/phpdocx-v14-release-notes/229). We recommend you update to the latest version available and check the macros-libreoffice folder included the package to know how to add macros to the conversion plugin based on LibreOffice (in this same folder you can find all available macros).

Regards.

Posted by bilal.app4legal  · 03-06-2024 - 07:01

so upgrading to v14 will allow me to generate PDF/A3 with embeded xml file inside it, right?

Thanks

Posted by admin  · 03-06-2024 - 07:13

Hello,

Enabling the pdfa3 option (with the macro included in the package) with phpdocx 14 and newer releases, uses PDF/A-3b (PDF/A, ISO 19005) included in LibreOffice. This adds XML information to the PDF output such as:

<</Type/Metadata/Subtype/XML/Length 5350>>
stream
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about="" xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">
   <pdfaid:part>3</pdfaid:part>
   <pdfaid:conformance>B</pdfaid:conformance>
  </rdf:Description>
  <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
   <dc:format>application/pdf</dc:format>
   <dc:creator>
    <rdf:Seq>
     <rdf:li>dynadocx</rdf:li>
    </rdf:Seq>
   </dc:creator>
  </rdf:Description>
  <rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
   <pdf:Producer>LibreOffice 24.2</pdf:Producer>
   <pdf:PDFVersion>1.7</pdf:PDFVersion>
  </rdf:Description>
  <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">
   <xmp:CreatorTool>Writer</xmp:CreatorTool>
   <xmp:CreateDate>2023-10-17T13:08:00+02:00</xmp:CreateDate>
   <xmp:ModifyDate>2023-10-17T13:08:00+02:00</xmp:ModifyDate>
   <xmp:MetadataDate>2023-10-17T13:08:00+02:00</xmp:MetadataDate>
  </rdf:Description>
 </rdf:RDF>
</x:xmpmeta>

Also note that all macros can be customized when being added to your installation if you want to add extra settings when using it.

Regards.

Posted by bilal.app4legal  · 03-06-2024 - 11:16

i need on call of transformDocument when i set the docx file to transform to set a specific xml file path -i build already- or an xml file content to embed in the created pdf, so on attach different xml file, so in each call of transformDocument i will embed different custom xml with different structure and values.

Posted by admin  · 03-06-2024 - 11:31

Hello,

Sorry, but the current stable version of phpdocx doesn't include any method or option to embed an XML content to a PDF. Using the conversion plugin based on LibreOffice with the pdfa3 option, generates an internal XML into the PDF output, but a custom XML can't be added.

Regards.