I am trying to modify the metadata of a PDF file using Bitmiracle.Docotic.Pdf
. I derived the following example from BitMiracle's Github page. Metadata.pdf
is an existing PDF document in my PC.
string pathToFile = "Metadata.pdf";
using (PdfDocument pdf = new PdfDocument(pathToFile))
{
pdf.Info.Author = "Sample Browser application";
pdf.Info.Subject = "Document metadata";
pdf.Info.Title = "Custom title goes here";
pdf.Info.Keywords = "pdf, Docotic.Pdf";
pdf.Save(pathToFile);
}
I get the error like this:
System.IO.IOException: The process cannot access the file 'Metadata.pdf' because it is being used by another process.
How can I solve this?