Save Metadata with XMP in C++
Contents
[
Hide
]
Use PdfFileInfo for this task. The examples below retain the original C++ code and API Reference steps.
Save info with XMP
Set subject, title, keywords, and creator and save the updated document information with XMP.
- Create PdfFileInfo with the input PDF path.
- Set subject through PdfFileInfo using the example values.
- Set title through PdfFileInfo using the example values.
- Set keywords through PdfFileInfo using the example values.
- Set creator through PdfFileInfo using the example values.
- Save document information and XMP with PdfFileInfo::SaveNewInfoWithXmp().
- 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 SaveInfoWithXmp(String inputFile, String outputFile)
{
auto pdfInfo = MakeObject<PdfFileInfo>(inputFile);
pdfInfo->set_Subject(u"Aspose PDF for C++");
pdfInfo->set_Title(u"Aspose PDF for C++");
pdfInfo->set_Keywords(u"Aspose, PDF, C++");
pdfInfo->set_Creator(u"Aspose Team");
pdfInfo->SaveNewInfoWithXmp(outputFile);
pdfInfo->Close();
}
} // namespace Facades::Examples::PDF_FileInfo