Clear PDF Metadata

Clear PDF metadata

Use this workflow when you need to remove stored document information before sharing or archiving a PDF.

Steps

  1. Create a PdfFileInfo object for the input PDF.
  2. Call clearInfo() to remove document metadata.
  3. Save the result to a new file with save().
  4. Close the PdfFileInfo instance.

Java example

public static void clearPdfMetadata(Path inputFile, Path outputFile) {
    PdfFileInfo pdfInfo = new PdfFileInfo(inputFile.toString());
    pdfInfo.clearInfo();
    pdfInfo.save(outputFile.toString());
    pdfInfo.close();
}