With PDF Extractor SDK you can extract pdf document info such as Author, Creator, Producer, Subject, Title, Creation Date, Keywords, Bookmarks and Encrypted info. These sample source codes can be used to extract info from PDF in ASP.NET, C#, and VB.NET.
Also, check the following tutorial: How to extract attachments from PDF.
Select your programming language:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.IO;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Bytescout.PDFExtractor;
namespace ExtractInfo
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// This test file will be copied to the project directory on the pre-build event (see the project properties).
String inputFile = Server.MapPath("sample1.pdf");
// Create Bytescout.PDFExtractor.InfoExtractor instance
InfoExtractor extractor = new InfoExtractor();
extractor.RegistrationName = "demo";
extractor.RegistrationKey = "demo";
// Load sample PDF document
extractor.LoadDocumentFromFile(inputFile);
Response.Clear();
Response.ContentType = "text/html";
Response.Write("Author: " + extractor.Author + "
");
Response.Write("Creator: " + extractor.Creator + "
");
Response.Write("Producer: " + extractor.Producer + "
");
Response.Write("Subject: " + extractor.Subject + "
");
Response.Write("Title: " + extractor.Title + "
");
Response.Write("CreationDate: " + extractor.CreationDate + "
");
Response.Write("Keywords: " + extractor.Keywords + "
");
Response.Write("Bookmarks: " + extractor.Bookmarks + "
");
Response.Write("Encrypted: " + extractor.Encrypted + "
");
Response.End();
}
}
}
using System;
using Bytescout.PDFExtractor;
namespace ExtractInfo
{
class Program
{
static void Main(string[] args)
{
// Create Bytescout.PDFExtractor.InfoExtractor instance
InfoExtractor extractor = new InfoExtractor();
extractor.RegistrationName = "demo";
extractor.RegistrationKey = "demo";
// Load sample PDF document
extractor.LoadDocumentFromFile("sample1.pdf");
Console.WriteLine("Author: " + extractor.Author);
Console.WriteLine("Creator: " + extractor.Creator);
Console.WriteLine("Producer: " + extractor.Producer);
Console.WriteLine("Subject: " + extractor.Subject);
Console.WriteLine("Title: " + extractor.Title);
Console.WriteLine("CreationDate: " + extractor.CreationDate);
Console.WriteLine("Keywords: " + extractor.Keywords);
Console.WriteLine("Bookmarks: " + extractor.Bookmarks);
Console.WriteLine("Encrypted: " + extractor.Encrypted);
Console.WriteLine();
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
}
}
}
Imports Bytescout.PDFExtractor
Class Program
Friend Shared Sub Main(args As String())
' Create Bytescout.PDFExtractor.InfoExtractor instance
Dim extractor As New InfoExtractor()
extractor.RegistrationName = "demo"
extractor.RegistrationKey = "demo"
' Load sample PDF document
extractor.LoadDocumentFromFile("sample1.pdf")
Console.WriteLine("Author: " + extractor.Author)
Console.WriteLine("Creator: " + extractor.Creator)
Console.WriteLine("Producer: " + extractor.Producer)
Console.WriteLine("Subject: " + extractor.Subject)
Console.WriteLine("Title: " + extractor.Title)
Console.WriteLine("CreationDate: " + extractor.CreationDate)
Console.WriteLine("Keywords: " + extractor.Keywords)
Console.WriteLine("Bookmarks: " + extractor.Bookmarks)
Console.WriteLine("Encrypted: " + extractor.Encrypted.ToString)
Console.WriteLine()
Console.WriteLine("Press any key to continue...")
Console.ReadLine()
End Sub
End Class