Hello, i searching for methods or libarys to edit metadata of a pdf file like the programm becypdfmetaedit.
I want to write a program and i need this opton in this program. Perhaps you have some samples for c#.
Thanks
Hello, i searching for methods or libarys to edit metadata of a pdf file like the programm becypdfmetaedit.
I want to write a program and i need this opton in this program. Perhaps you have some samples for c#.
Thanks
Does the PdfDocumentInformation class from PDF Sharp fulfill your requirements.
Pimping here - my company, Atalasoft, makes .NET components for working with images. Part of the suite includes the ability to read/write PDF document metadata. It's not free, but it is run-time royalty free for desktop applications.
The code for reading is simple:
PdfDocumentMetadata metadata = PdfDocumentMetadata.FromStream(sourceStream);
to edit it and write it back to the same stream:
meta.Title = "Knicholas Knickleby";
meta.Author = "Edmund Wells";
sourceStream.Seek(0, SeekOrigin.Begin);
meta.Append(sourceStream, false); // false means don't merge - overwrite
Custom fields are supported through a hashtable.
Using PDF Sharp works like this:
using System;
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main (string[] args)
{
Program p = new Program();
p.Test();
}
public void Test ()
{
PdfDocument document = PdfReader.Open ("Test.pdf");
document.Info.Author = "ME";
document.Save ("Result");
}
}
}