We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF Metadata is changed after decrypting and saving Aspose.PDF for .NET

I have some pdf’s that have password set for Document Properties.
So I open these pdf’s and remove the encryption using “document.Decrypt()”.
Then I save the pdf using "document.Save(“temp file”).

The resultant pdf’s have different values for “Application” (xmp:CreatorTool) and
PDF Producer (pdf:Producer").

Is there any way to retain the original values intact or overwrite the newly generated values with original values.

@dennisonkslaw,

Thanks for contacting support.

Can you please share source file along with environment details so that we may further investigate to help you out.

DocPropsProtected.pdf (36.3 KB)

Sample code used

private bool RemoveEncryptionFromPdf(string encryptedFile, string decryptedFile, string password)
{
bool processStatus = false;
try
{
using (Document document = new Document(encryptedFile, password))
{
//decrypt if document properties are encrypted
if (document.CryptoAlgorithm != null)
{
document.Decrypt();
}
document.Save(decryptedFile);
processStatus = true;

            }

        }
        catch (Exception e)
        {
            processStatus = false;
        }

        return processStatus;
    }

@dennisonkslaw,

Can you please share generated result along with version details which you are using on your end.

Application - Aspose Ltd.

PDF Producer - Aspose.Pdf for .NET 17.9

@dennisonkslaw,

Can you please try to use Aspose.PDF latest version 19.12 on your end and share feedback with us.

Tried with v 20.1 and still get the same result

@dennisonkslaw,

We have tested the scenario in our environment and were able to notice the issue. We have logged it as PDFNET-47519 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.