Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
A classe PdfFileInfo permite que você defina informações específicas do arquivo de um arquivo PDF. Você precisa criar um objeto da classe PdfFileInfo e, em seguida, definir diferentes propriedades específicas do arquivo, como Autor, Título, Palavra-chave e Criador, etc. Por fim, salve o arquivo PDF atualizado usando o método SaveNewInfo do objeto PdfFileInfo.
O seguinte trecho de código mostra como definir informações do arquivo 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");
}
}
O método SetMetaInfo permite que você adicione qualquer informação. No nosso exemplo, adicionamos um campo. Confira o próximo trecho de código:
// 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.