Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Para obtener información específica del archivo de un archivo PDF, necesita crear un objeto de la clase PdfFileInfo. Después de eso, puede obtener los valores de las propiedades individuales como Asunto, Título, Palabras clave y Creador, etc.
El siguiente fragmento de código le muestra cómo obtener información del archivo PDF.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void GetPdfInfo()
{
// Define the directory for input files
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Open PDF document
using (var fileInfo = new Aspose.Pdf.Facades.PdfFileInfo(dataDir + "sample.pdf"))
{
// Get and display PDF information
Console.WriteLine("Subject: {0}", fileInfo.Subject);
Console.WriteLine("Title: {0}", fileInfo.Title);
Console.WriteLine("Keywords: {0}", fileInfo.Keywords);
Console.WriteLine("Creator: {0}", fileInfo.Creator);
Console.WriteLine("Creation Date: {0}", fileInfo.CreationDate);
Console.WriteLine("Modification Date: {0}", fileInfo.ModDate);
// Check if the file is a valid PDF and if it is encrypted
Console.WriteLine("Is Valid PDF: {0}", fileInfo.IsPdfFile);
Console.WriteLine("Is Encrypted: {0}", fileInfo.IsEncrypted);
// Get dimensions of the first page
Console.WriteLine("Page width: {0}", fileInfo.GetPageWidth(1));
Console.WriteLine("Page height: {0}", fileInfo.GetPageHeight(1));
}
}
Para obtener información, utilizamos la propiedad Header. Con ‘Hashtable’ obtenemos todos los valores posibles.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void GetMetaInfo()
{
// Define the directory for input files
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Create an instance of PdfFileInfo object
using (var fileInfo = new Aspose.Pdf.Facades.PdfFileInfo(dataDir + "SetMetaInfo_out.pdf"))
{
// Retrieve all existing custom attributes
var hashTable = new System.Collections.Hashtable(fileInfo.Header);
// Enumerate and display all custom attributes
var enumerator = hashTable.GetEnumerator();
while (enumerator.MoveNext())
{
string output = $"{enumerator.Key} {enumerator.Value}";
Console.WriteLine(output);
}
// Retrieve and display a specific custom attribute
Console.WriteLine("Reviewer: " + fileInfo.GetMetaInfo("Reviewer"));
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.