Hello Team,
I’m using the following code snippet to remove PDF more info about the Authors, Content Creator, and Encoding software details: Aspose.PDF but no effect. Please see the image below and the code:
using var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(htmlContent));
HtmlLoadOptions options = new();
Document pdfDocument = new(memoryStream, options);
using var outputMemoryStream = new MemoryStream();
pdfDocument.RemoveMetadata();
pdfDocument.Info.Clear();
pdfDocument.Info.ClearCustomData();
var pdfInfo = new DocumentInfo(pdfDocument) {
Author = string.Empty,
Title = string.Empty
};
pdfDocument.Save(outputMemoryStream);
return outputMemoryStream.ToArray();
image.png (11.2 KB)
@awais.ilyas
Are you seeing these values in Document properties? Can you please share how you are checking this Meta Data info at your end? If possible, please share your sample PDF with us so that we can further proceed with testing and address the issue accordingly.
Please see the attached PDF file and check the properties of file with More Info (on mac)
IL-24-11 2.pdf (87.5 KB)
@awais.ilyas
Is it final output? Because we are seeing Aspose.PDF in its properties as PDF Creator? If not, can you please share the output PDF that you obtained using the code snippet you shared earlier.
yes, this is the final PDF generated with creator info using Aspose.PDF library which I’m trying to clear and remove.
@awais.ilyas
Please check what we obtained using the below code snippet and 24.1 version of the API in our environment:
image.png (13.2 KB)
using (var pdfDocument = new Document(stream))
{
pdfDocument.Info.Keywords = "Sample Keyword";
pdfDocument.Info.Creator = "Custom Creator";
pdfDocument.Info.Producer = "Custom Producer";
pdfDocument.Save();
}
IL-24-11 2.pdf (88.0 KB)
@asad.ali yeah this works fine now. Thank you for your support
@awais.ilyas
It is nice to know that your issue has been resolved. Please keep using the API and feel free to create a new topic in case you need further assistance.