Clear PDF Metadata in C++

Use PdfFileInfo for this task. The examples below retain the original C++ code and API Reference steps.

Clear PDF metadata

Clear document information, save the output, and close PdfFileInfo.

  1. Create PdfFileInfo with the input PDF path.
  2. Clear document information with PdfFileInfo::ClearInfo().
  3. Save the resulting PDF with PdfFileInfo::Save().
  4. Close the facade with PdfFileInfo::Close().
#include <Aspose.PDF.Cpp/Facades/PdfFileInfo.h>
#include <system/string.h>

namespace Facades::Examples::PDF_FileInfo
{
	using namespace System;
	using namespace Aspose::Pdf;
	using namespace Aspose::Pdf::Facades;

	void ClearPdfMetadata(String inputFile, String outputFile)
	{
		auto pdfInfo = MakeObject<PdfFileInfo>(inputFile);
		pdfInfo->ClearInfo();
		pdfInfo->Save(outputFile);
		pdfInfo->Close();
	}
} // namespace Facades::Examples::PDF_FileInfo