"XMPInfo.PdfPackage.Keywords" property and the "XMPInfo.PdfPackage.Producer" property cannot be cleared


#1

We find that the keyword and producer are not changed after we use GroupDocs.Metadata API to remove metadata. We checked the codes and find “XMPInfo.PdfPackage.Keywords” property and the “XMPInfo.PdfPackage.Producer” property are set empty before the save method. But after Aspose API saves the pdf files, they are revert to the original values.
Here is the screenshot and pdf file
pdf_fields.PNG (3.0 KB)
all-1.05MB.doc.PDF (1.2 MB)


#2

@Glority_Developer,

Thanks for sharing your concerns with us. In order to investigate the issue at our end, we would require you to please share the code snippet and the version of the API that you are using to update the metadata. We’ll be looking forward to your response.


#3

We are using the latest API 17.9.0. Here is the code:
///


/// Updates XMP Data of Pdf file
///

public static void UpdateXMPProperties()
{
try
{
//ExStart:UpdateXMPPropertiesPdfFormat
// initialize Pdfformat
PdfFormat pdfFormat = new PdfFormat(Common.MapSourceFilePath(filePath));

                // get pdf schema
                PdfPackage pdfPackage = pdfFormat.XmpValues.Schemes.Pdf;

                // update keywords
                pdfPackage.Keywords = "literature, programming";

                // update pdf version
                pdfPackage.PdfVersion = "1.0";

                // pdf:Producer could not be updated
                //pdfPackage.Producer="";

                //save output file...
                pdfFormat.Save(Common.MapDestinationFilePath(filePath));
                //ExEnd:UpdateXMPPropertiesPdfFormat
            }

#4

@Glority_Developer,

Thanks for providing the sample code. We are sorry to inform you that, due to the company policy, we can’t allow updating the Producer property. However, we are able to clear Keywords property of your provided PDF document without any issue (see results). Please download this sample application to run the test at your end. Hope it helps.


#5

Thanks for the reply.You sample codes can delete the keywords. But the key problem of our issue is that when we try to delete keywords and author at the same time, the keywords cannot be deleted.

See our codes and comments
private static void CleanMetadata()
{
try
{
// initialize Pdfformat
PdfFormat pdfFormat = new PdfFormat(inputFilePath);

            // get pdf schema
            PdfPackage pdfPackage = pdfFormat.XmpValues.Schemes.Pdf;

            //// update keywords
            pdfPackage.Keywords = "";

            //update DocumentProperties.Author
            pdfFormat.DocumentProperties.Author = "";

            //after set author value, keywords can not be removed but author is removed

            //save output file...
            pdfFormat.Save(outputFilePath);
        }
        catch (Exception exp)
        {
            Console.WriteLine(exp.Message);
        }
    }

#6

@Glority_Developer,

Thanks for providing the source code. We did investigation and found that the issue occurs when we update XMP metadata and Document Properties (PDF metadata) at the same time. We have logged the issue in our internal Issue Tracking System (ID: METADATANET-1940). In case of any updates, we’ll notify you here.


#7

@Glority_Developer

The issue you have found earlier (filed as METADATANET-1940) has been fixed in this update.