Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Kelas PdfFileInfo memungkinkan Anda untuk mengatur informasi spesifik file dari file PDF. Anda perlu membuat objek dari Kelas PdfFileInfo dan kemudian mengatur berbagai properti spesifik file seperti Penulis, Judul, Kata Kunci, dan Pencipta, dll. Akhirnya, simpan file PDF yang diperbarui menggunakan metode SaveNewInfo dari objek PdfFileInfo.
Cuplikan kode berikut menunjukkan kepada Anda cara mengatur informasi file 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");
}
}
Metode SetMetaInfo memungkinkan Anda untuk menambahkan informasi apa pun. Dalam contoh kami, kami menambahkan sebuah field. Periksa cuplikan kode berikut:
// 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.