PDF Metadata VB.NET Library
How to Read and Write PDF Metadata in VB.NET
Enable VB.NET Users to Read, Write, Edit, Delete and Update PDF Document Metadata in Visual Basic .NET
In this VB.NET tutorial, you learn how to read, view, edit, modify PDF document metadata information in the VB.NET Windows Forms applications.
- Support PDF document metadata
- Support PDF XMP (Extensible Metadata Platform)
- No Acrobat software installed. Not using 3rd party software.
How to read, view, modify, edit, remove PDF metadata information using VB.NET
- Professional VB.NET PDF SDK for editing metadata in Visual Studio .NET
- View C# tutorial page at how to edit PDF properties using C#
- Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
- Varieties of functionalities to edit and update PDF metadata in both .NET WinForms and ASP.NET project
- Read and view PDF metadata without any adobe viewer components in VB.NET
- Add permanent metadata to PDF document in VB .NET framework program
- Remove and delete metadata content from PDF file in Visual Basic .NET application
- Search and extract existing PDF metadata based on certain key words
- Batch processing PDF metadata in VB.NET class
-
asp.net core mvc view pdf,
asp.net pdf viewer component,
asp.net tiff viewer control,
how to add header and footer in pdf using itextsharp in asp.net,
asp.net core pdf editor,
pdf preview in asp net c# example,
asp.net core image view.
- Free VB.NET PDF document SDK library compatible with Windows operating system
- Online sources codes easy to be integrated to VB.NET project
Metadata, known as data about meta, is often used to provide additional information for source PDF document file. For example, you can encode the author information or PDF document publication date or copyright into the PDF document metadata.
RasterEdge VB.NET PDF document metadata processing control SDK is a professional and standalone VB.NET solution, which is designed to provide easy to use APIs for programmers to read, search, add, delete and edit PDF document metadata in VB.NET application.
About PDF Document Metadata and XMP
PDF document Metadata includes information about the document and its contents, such as the author's name, keywords, and copyright information,
that can be used by search utilities. You can view more information at PDF metadata information using C#.
The Extensible Metadata Platform (XMP) is an ISO standard, originally created by Adobe Systems Inc.,
for the creation, processing and interchange of standardized and custom metadata for digital documents and data sets.
You can view more information at PDF XMP using C#.
How to read, view PDF document metadata information using VB.NET
You can read the PDF metadata from an existing PDF file through class PDFDocument.
You will get a PDFMetadata object from PDFDocument, and PDFMetadata object contains all the PDF metadata information.
Dim inputFilePath As String = "C:\2.pdf"
Dim doc As PDFDocument = New PDFDocument(inputFilePath)
Dim metadata As PDFMetadata = doc.GetDescription()
Console.WriteLine("Title: " + metadata.Title)
Console.WriteLine("Author: " + metadata.Author)
Console.WriteLine("Subject: " + metadata.Subject)
Console.WriteLine("Keywords: " + metadata.Keywords)
Console.WriteLine("Creator: " + metadata.Creator)
Console.WriteLine("Producer: " + metadata.Producer)
Console.WriteLine("Create Date: " + metadata.CreatedDate.ToString())
Console.WriteLine("Modified Date: " + metadata.ModifiedDate.ToString())
How to modify, update PDF metadata information using VB.NET
The VB.NET example source code below explains how to modify, update existing PDF file metadata information, such as keywords, producer, document title in VB.NET code.
Dim metadata As PDFMetadata = New PDFMetadata()
metadata.Title = "Title"
metadata.Author = "Qi"
metadata.Subject = "None"
metadata.Keywords = "University, Public, etc."
metadata.Creator = "MS Office Word"
metadata.Producer = "RE"
metadata.CreatedDate = New DateTime(2014, 11, 21, 10, 45, 12)
metadata.ModifiedDate = New DateTime(2015, 11, 21, 10, 45, 12)
Dim inputFilePath As String = "C:\1.pdf"
Dim outputFilePath As String = "C:\1_new.pdf"
Dim doc As PDFDocument = New PDFDocument(inputFilePath)
doc.SetDescription(metadata)
doc.Save(outputFilePath)
How to read, view PDF XMP advanced metadata information in VB.NET code
The following Visual Basic .NET example code explains how to read XMP metadata in String from PDF file in VB.NET code:
Dim inputFilePath As String = "C:\1.pdf"
' Get document's metadata content in String format.
Dim xmpDataBytes As String = PDFMetadataHandler.GetMatadata(inputFilePath)
If Not String.IsNullOrEmpty(xmpDataBytes) Then
Console.WriteLine(xmpDataBytes)
Else
Console.WriteLine("No document metadata in the file.")
End If
Read XMP metadata information from PDF Stream object in VB.NET code:
Using inStream As FileStream = File.Open("C:\1.pdf", FileMode.Open, FileAccess.Read, FileShare.Read)
' Get document's metadata content in String format.
Dim xmpDataBytes As String = PDFMetadataHandler.GetMatadata(inStream)
' …
End Using
How to read and process PDF XMP in VB.NET
Below are the steps and VB.NET example source code to open and read PDF XMP metadata in XML document.
- Get PDF XMP string data using PDFMetadataHandler.GetMatadata() method
- Create a XmlDocument object from the XMP string data
- Read XMP data information through XML node list
- Save XMP xml data into an xml file
Dim inputFilePath As String = "C:\1.pdf"
' Get document's metadata content in String format.
Dim xmpDataBytes As String = PDFMetadataHandler.GetMatadata(inputFilePath)
' Load metadata content to a XmlDocument object.
Dim xmlDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument()
xmlDoc.LoadXml(xmpDataBytes)
' Retreive an exist tag <pdfProducer>
Dim nodes As System.Xml.XmlNodeList = xmlDoc.GetElementsByTagName("pdf:Producer")
For Each node As System.Xml.XmlNode In nodes
Console.WriteLine("{0}: ‘{1}’", node.Name, node.InnerText)
Next
' …
Edit the advanced metadata in VB.NET code:
Dim inputFilePath As String = "C:\1.pdf"
' Get document's metadata content in String format.
Dim xmpDataBytes As String = PDFMetadataHandler.GetMatadata(inputFilePath)
' Load metadata content to a XmlDocument object.
Dim xmlDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument()
xmlDoc.LoadXml(xmpDataBytes)
' Edit exist tag <pdfProducer>, change inner text to "Generated by Raster Edge"
Dim Nodes As System.Xml.XmlNodeList = xmlDoc.GetElementsByTagName("pdf:Producer")
For Each node As System.Xml.XmlNode In Nodes
node.InnerText = "Generated by Raster Edge"
Next
' Save the modified metadata content to a file.
xmlDoc.Save("C:\metadata.xml")
How to update PDF XMP in VB.NET
Below are the steps and vb.net example source code to update PDF XMP metadata.
- Read xmp byte array data from a xml file
- Use PDFMetadataHandler.SetMetadata() method to save XMP data into PDF file.
Dim inputFilePath As String = "C:\1.pdf"
Dim outputFilePath As String = "C:\output.pdf"
' Load metdata content from a XML file.
Dim xmpDataBytes As Byte() = File.ReadAllBytes("C:\metadata.xml")
' Update document metadata content.
Dim xmpData As String = Encoding.UTF8.GetString(xmpDataBytes)
PDFMetadataHandler.SetMetadata(inputFilePath, outputFilePath, xmpData)
Update XMP metadata from PDF Stream object in VB.NET code:
' Load metdata content from a XML file.
Dim xmpDataBytes As Byte() = File.ReadAllBytes("C:\metadata.xml")
Using inStream As FileStream = File.Open("C:\1.pdf", FileMode.Open, FileAccess.Read, FileShare.Read)
Using oStream As FileStream = File.Open("C:\output.pdf", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)
' Update document metadata content.
Dim xmpData As String = Encoding.UTF8.GetString(xmpDataBytes)
PDFMetadataHandler.SetMetadata(inStream, oStream, xmpData)
End Using
End Using