XMPBasic data is not cleaned after saving the files


#1

We checked the codes and when we try to delete all XMPBasic data. They will be set to empty before the save method. But after the file is saved, the XMPBasic data is changed back to the previous values.

Here is the pdf file and the data not removed.
pdf.PNG (31.3 KB)
DublinCore-XmpBasic -Code doc.pdf (382.7 KB)


#2

@Glority_Developer,

Thanks for using GroupDocs.Metadata for .NET. Would you please share with us the code snippet that you are using to remove the metadata? Also, please mention the version of the API you are using at your. We’ll be looking forward to your response.


#3

Hi, here is the code. We are using the latest API 17.9.0

format = new PdfFormat(filePath);
if (format == null)
{
return;
}

                    XmpEditableCollection _xmpEditableCollection = ((PdfFormat)format).XmpValues;
                    if (_xmpEditableCollection != null && _xmpEditableCollection.Schemes != null && _xmpEditableCollection.Schemes.XmpBasic != null)
                    {
                        _xmpEditableCollection.Schemes.XmpBasic.BaseUrl = string.Empty;
                    }
                    
                    PdfMetadata metaData = ((PdfFormat)format).DocumentProperties;
                    if (metaData != null)
                    {
                        metaData.Author = string.Empty;
                    }


        format.Save(outPath);

#4

@Glority_Developer,

Thanks for sharing the source code with us. Please use the following code to update XMPBasic data.

    var format = new PdfFormat(inputFilePath);
    if (format == null)
    {
            return;
    }    
    XmpBasicPackage xmpBasicPackage = format.XmpValues.Schemes.XmpBasic;
    xmpBasicPackage.BaseUrl = "abc.com";
    xmpBasicPackage.Nickname = "nickname";

    format.Save(outputFilePath);

Hope it helps.


#5

Thanks for the reply. Your sample codes only try to delete XMPBasic data. so it can remove XMPBasic data.

But our key problem is that when we try to delete PDF and XMPBasic at the same time, the XMPBasic cannot be removed.


#6

@Glority_Developer,

Thanks for your response. We have successfully reproduced your reported issue at our end. We have logged it in our internal Issue Tracking System with ID: METADATANET-1940. We shall further investigate this issue and 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.