Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Sep 26, 2022 1:28 pm

Hello,
we need to modify XmpMetadata in a pdf document.
The tutorials seems to be old and no longer valid.
For example here:
.../forum/writing-metadata-t7720.html

Code: Select all
           
            string path = @"C:\Temp\MyDocument.pdf";
            var pdfDocument = new Spire.Pdf.PdfDocument(path);

            // Why deprecated?
            XmpMetadata meta = pdfDocument.DocumentInformation.GetMetaData();

            System.Xml.XmlNamespaceManager namespaceManager = meta.NamespaceManager;
            System.Xml.XmlDocument doc = meta.XmlData;
            namespaceManager.AddNamespace("zf", "myRandomNamespace");

            var xmlAttachment = new Spire.Pdf.Attachments.PdfAttachment(Context.XmlPath);
            pdfDocument.Attachments.Add(xmlAttachment);

            // this is not what I need
            pdfDocument.DocumentInformation.SetCustomProperty("test", "ABC123");

            // Error: PdfDocument does not contain a definition for 'XmpMetaData'
            pdfDocument.XmpMetaData;

            // Adding a new namespace "zf" do not save it here
            pdfDocument.SaveToFile(path);

a.seibel
 
Posts: 2
Joined: Wed Sep 21, 2022 11:31 am

Tue Sep 27, 2022 9:54 am

Hello,

Thanks for your inquiry.
Now, the XmpMetadata class can set or get the basic information of pdf document (such as author、title etc.), but it can’t add new namespace to the metadata. In addition, the PdfDocumentInformation also can get and set the basic information of pdf document, therefore, our development decided to deprecate the XmpMetadata class. However, our development team will develop more powerful class for metadata of pdf document.
For the function of adding new namespace to metadata, I have logged it as a new function into our product updating system with the ticket number SPIREPDF-5506. Our development team will achieve it when developing the new class for metadata. Once it is achieved, I will inform you in time. Sorry for the inconvenience caused.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Sep 27, 2022 10:43 am

Thank you for you're answer.
Just using the XmlNamespaceManager and XmlDocument would be great enough.
Can you give me an estimated time frame?

a.seibel
 
Posts: 2
Joined: Wed Sep 21, 2022 11:31 am

Wed Sep 28, 2022 7:45 am

Hello,

Thanks for your feedback.
Due to the complexity of the new class for metadata, our development needs some time to achieve it, sorry that I can’t give you an exactly ETA. Once it is achieved, I’ll inform you in time.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Thu Dec 15, 2022 8:19 am

Hello,

Thanks for your patience!
Glad to inform you that we just released Spire.PDF 8.12.5 which achieve the new function with SPIREPDF-5506. And I put the relevant code below for your reference.
Please download the new version from the following links to test.
Website download link: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget download link: https://www.nuget.org/packages/Spire.Pdf/8.12.5
Code: Select all
PdfXmlMetadata.RegisterNamespace("http://myRandomNamespace", "zf");
using(PdfDocument doc = new PdfDocument("input.pdf"))
{
    doc.Metadata.SetPropertyString("http://myRandomNamespace", "test1","my test");
    doc.SaveToFile('result.pdf');
}
PdfXmlMetadata.ResetNamespaces();


Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Sat Feb 04, 2023 5:59 pm

Hallo Spire.pdf,

I need access to xmpdata, modifying customer properties in a special namespace (german healthcare).
Version 8.9.16 is the one it works with, in newer versions (9.2.2) namespace xmp is no more visible. Is the
any other method to get access?
// <ftx:ControlData rdf:parseType='Resource'>
// <control:Anzahl_Zeichen_Titel>0</control:Anzahl_Zeichen_Titel>
// <control:Anzahl_Zeichen_Vorname>0</control:Anzahl_Zeichen_Vorname>
// <control:Anzahl_Zeichen_Namenszusatz>0</control:Anzahl_Zeichen_Namenszusatz>
// <control:Anzahl_Zeichen_Hausnummer>0</control:Anzahl_Zeichen_Hausnummer>
// <control:Anzahl_Zeichen_Postleitzahl>0</control:Anzahl_Zeichen_Postleitzahl>
// <control:Anzahl_Zeichen_Wohnsitzlaendercode>0</control:Anzahl_Zeichen_Wohnsitzlaendercode>
// <control:Auftragsnummer_Einsender>0</control:Auftragsnummer_Einsender>
// <control:Formularnummer>10A</control:Formularnummer>
// <control:Formularversion>07.2017</control:Formularversion>
// </ftx:ControlData>
Kind regards, UE

UweEissing
 
Posts: 3
Joined: Thu Jun 30, 2022 5:28 am

Mon Feb 06, 2023 5:51 am

Hello,

Thanks for your inquiry.
The namespace xmp is abandoned, the new namespace associated with the “metadata” is currently using Spire.Pdf.Interchange.Metadata, and you can use the following code to create a new PdfXmpMetadata object.
Code: Select all
  PdfXmpMetadata xmpMetadata = doc.Metadata;

In addition, for your requirement, do you want to change the basic information of document? If so, you can refer to the following code. If not, please offer the code you used currently and the input Pdf file, you can attach here or send it to us via email (support@e-iceblue.com). And I’ll offer the new code after changing namespace according to your code. Thanks for your assistance in advance.

Code: Select all
      String input = @"..\..\data\result.pdf";
            PdfDocument doc = new PdfDocument();
            // Read a pdf file
            doc.LoadFromFile(input);
            // Get document information
            PdfDocumentInformation docInfo = doc.DocumentInformation;

            docInfo.Author = "abel";

            docInfo.Keywords = "e-iceblue";

            docInfo.Subject = "test";

            docInfo.Title = "This is a test";


Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Fri Mar 29, 2024 1:03 pm

I still need access to the XmlXmpMetaData. The pdfa-Template is attached, also a screenshot. I must be able to modify the XmlXmpMetaData, that's important for further use.

UweEissing
 
Posts: 3
Joined: Thu Jun 30, 2022 5:28 am

Sat Mar 30, 2024 9:27 am

Hi,
another task is that Spire.Pdf.Conversion.PdfStandardsConverteris removing XmpData.
See screenshot below.
Kind regards.

Spire.Pdf.Conversion.PdfStandardsConverter converter = new Spire.Pdf.Conversion.PdfStandardsConverter(m_StrPdf);
converter.ToPdfA1A(m_StrPdf + "_PdfA1A.pdfa");
converter.ToPdfA2A(m_StrPdf + "_PdfA2A.pdfa");
converter.ToPdfA3A(m_StrPdf + "_PdfA3A.pdfa");
converter.ToPdfA1B(m_StrPdf + "_PdfA3B.pdfa");
converter.ToPdfA2B(m_StrPdf + "_PdfA3B.pdfa");
converter.ToPdfA3B(m_StrPdf + "_PdfA3B.pdfa");

UweEissing
 
Posts: 3
Joined: Thu Jun 30, 2022 5:28 am

Mon Apr 01, 2024 9:44 am

UweEissing wrote:I still need access to the XmlXmpMetaData. The pdfa-Template is attached, also a screenshot. I must be able to modify the XmlXmpMetaData, that's important for further use.

Hi,

Thanks for your inquiry.
For how to get the message you mentioned, I need some time to investigate, I’ll give you feedback when there are any informations. Sorry for the inconvenienced caused.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Mon Apr 01, 2024 9:45 am

UweEissing wrote:Hi,
another task is that Spire.Pdf.Conversion.PdfStandardsConverteris removing XmpData.
See screenshot below.
Kind regards.

Spire.Pdf.Conversion.PdfStandardsConverter converter = new Spire.Pdf.Conversion.PdfStandardsConverter(m_StrPdf);
converter.ToPdfA1A(m_StrPdf + "_PdfA1A.pdfa");
converter.ToPdfA2A(m_StrPdf + "_PdfA2A.pdfa");
converter.ToPdfA3A(m_StrPdf + "_PdfA3A.pdfa");
converter.ToPdfA1B(m_StrPdf + "_PdfA3B.pdfa");
converter.ToPdfA2B(m_StrPdf + "_PdfA3B.pdfa");
converter.ToPdfA3B(m_StrPdf + "_PdfA3B.pdfa");

Hi,

I reproduced the metadata loss issue when convert to PDF/A, and I logged it into our bug tracking system with the ticket number SPIREPDF-6642. Our development team will investigate and fix it.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Wed Apr 17, 2024 5:58 am

Abel.He wrote:Hello,

Thanks for your inquiry.
Now, the XmpMetadata class can set or get the basic information of pdf document (such as author、title etc.), but it can’t add new namespace to the metadata. In addition, the PdfDocumentInformation also can get and set the basic information of pdf document, therefore, our development decided to deprecate the XmpMetadata class. However, our development team will develop more powerful class for metadata of pdf document.
For the function of adding new namespace to metadata, I have logged it as a new function into our product updating system with the ticket number SPIREPDF-5506. Our development team will achieve it when developing the new class for metadata. Once it is achieved, I will inform you in time. Sorry for the inconvenience caused.
Enhance your PDF organization with PDF Guru's XmpMetadata feature https://pdfguru.com/organize-pdf Embed comprehensive metadata into your PDF files, enabling efficient categorization and retrieval. With PDF Guru's intuitive interface, managing metadata becomes seamless, allowing for streamlined document organization. Whether for archiving or collaboration, harnessing XmpMetadata through PDF Guru ensures your PDFs are structured and easily accessible, optimizing your workflow.
Sincerely
Abel
E-iceblue support team

thanks its really work

PixelPioneer
 
Posts: 5
Joined: Fri Apr 12, 2024 6:43 am

Return to Spire.PDF