I have a client who want to be able to download files from the repository and have them retain the metadata attached to the original laserfiche file. Does anyone know of a way that could be done? By default our files download from original tif into PDF. Thanks!
Question
Question
Laserfiche download to PDF: Can the metadata be transferred into the PDF properties automatically or through a workflow?
Replies
If the destination for these downloads is another Laserfiche system, you could export as Laserfiche Briefcases, an XML-based format which contains both the files and their metadata.
You can write to the .pdf's custom properties with iTextSharp
using iTextSharp.text.pdf;
.....
using (PdfReader reader = new PdfReader(fullFileName))
{
using (FileStream fs = new FileStream(pdfStamped, FileMode.Create, FileAccess.Write, FileShare.None))
{
using (PdfStamper stamper = new PdfStamper(reader, fs))
{
Dictionary<String, String> info = reader.Info;
foreach (KeyValuePair<string, string> props in properties)
{
if(info.ContainsKey(props.Key))
{
info.Remove(props.Key);
}
info.Add(props.Key, props.Value);
}
stamper.MoreInfo = info;
stamper.Close();
}
}
}