Remove Author and version info from exported pdf

Due to security reasons, we need to remove author and version info from file properties of the pdf exported using aspose library . but i tried everything, but info is not getting removed
tried several things unsuccessfully :

document.setRemovePersonalInformation(Boolean.TRUE);
document.getBuiltInDocumentProperties().clear()
document.getCustomDocumentProperties().clear();
document.getCustomDocumentProperties().remove("Author");
document.getCustomDocumentProperties().remove("Owner")

am i missing something ?
we are using version 21.9

@foamteam

Please check the following code:

Document doc = new Document();
doc.getInfo().setProducer("");
doc.getInfo().setAuthor("");

After save the document, Producer and Creator should be set to custom values.
If Producer and Creator are not set, then these values should be set to Aspose.PDF for .NET/Java and Aspose, Ltd.

creating document in memory to render as download.

com.aspose.words.Document doc = new com.aspose.words.Document();
doc.setRemovePersonalInformation(Boolean.TRUE);
/**   builder writes .... **/

PdfSaveOptions saveOptions = new PdfSaveOptions();							
saveOptions.setExportDocumentStructure(true);
saveOptions.setUpdateFields(true);
saveOptions.setFontEmbeddingMode(1); 
document.save(documentByteArraySteam, saveOptions);

don’t see any getInfo on the com.aspose.words.Document ?

@foamteam

Sorry for the confusion. It looks like your inquiry is related to Aspose.Words. Therefore, we have moved it to the respective forum category where you will be assisted accordingly.

@foamteam RemovePersonalInformation is equivalent to File -> Options -> Trust Center -> Trust Center Settings -> Privacy Options -> “Remove personal information from file properties on save” in Microsoft Word. This option will not take effect during a save operation made using Aspose.Words. Personal data will be removed from our document with the flag set when we save it manually using Microsoft Word. So this option is not applicable when save document as PDF.

To remove author and version built-in properties, you can use code like the following:

Document doc = new Document("C:\\Temp\\in.docx");

// Reset Author and Version built-in properties
doc.getBuiltInDocumentProperties().setAuthor("");
doc.getBuiltInDocumentProperties().setVersion(0);
        
// Do not export custom document properties to PDF
PdfSaveOptions opt = new PdfSaveOptions();
opt.setCustomPropertiesExport(PdfCustomPropertiesExport.NONE);
        
doc.save("C:\\Temp\\out.pdf", opt);