Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
PdfFileInfoクラスを使用すると、PDFファイルのファイル固有の情報を設定できます。PdfFileInfoクラスのオブジェクトを作成し、著者、タイトル、キーワード、作成者などのさまざまなファイル固有のプロパティを設定する必要があります。最後に、PdfFileInfoオブジェクトのSaveNewInfoメソッドを使用して、更新されたPDFファイルを保存します。
次のコードスニペットは、PDFファイル情報を設定する方法を示しています。
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void SetPdfInfo()
{
// Define the directory for input and output files
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Create PdfFileInfo object to work with PDF metadata
using (var fileInfo = new Aspose.Pdf.Facades.PdfFileInfo(dataDir + "sample.pdf"))
{
// Set PDF information
fileInfo.Author = "Aspose";
fileInfo.Title = "Hello World!";
fileInfo.Keywords = "Peace and Development";
fileInfo.Creator = "Aspose";
// Save the PDF with updated information
fileInfo.SaveNewInfo(dataDir + "SetFileInfo_out.pdf");
}
}
SetMetaInfoメソッドを使用すると、任意の情報を追加できます。私たちの例では、フィールドを追加しました。次のコードスニペットを確認してください:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void SetMetaInfo()
{
// Define the directory for input and output files
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Create an instance of the PdfFileInfo object
using (var fileInfo = new Aspose.Pdf.Facades.PdfFileInfo(dataDir + "sample.pdf"))
{
// Set a new custom attribute as meta info
fileInfo.SetMetaInfo("Reviewer", "Aspose.PDF user");
// Save the updated file
fileInfo.SaveNewInfo(dataDir + "SetMetaInfo_out.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.