Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
La classe PdfFileInfo vous permet de définir des informations spécifiques au fichier d’un fichier PDF. Vous devez créer un objet de la classe PdfFileInfo puis définir différentes propriétés spécifiques au fichier telles que l’auteur, le titre, le mot-clé et le créateur, etc. Enfin, enregistrez le fichier PDF mis à jour en utilisant la méthode SaveNewInfo de l’objet PdfFileInfo.
Le code suivant vous montre comment définir les informations sur le fichier 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");
}
}
La méthode SetMetaInfo vous permet d’ajouter n’importe quelle information. Dans notre exemple, nous avons ajouté un champ. Consultez le code suivant :
// 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.