To assist with the processing of my Personal Health Record, I created a number of tools and utilities. The first tool I wrote will unlock a PDF file. Locked PDF seems to be how most Providers send along copies of the health record. In other words, when I request my medical records, they come in one large multi-page PDF file that is password protected. To make processing easier, I want to remove the password.
To make this work, I use the PDFsharp library which is an Open Source toolkit that greatly simplifies everything.
I have created two projects: one to unlock a PDF file and the other to lock the PDF.
To illustrate just how great and easy the PDFsharp library is, here’s the three lines of code that unlock the PDF document:
PdfDocument document = PdfReader.Open(fileName, pw, PdfDocumentOpenMode.Modify);
document.SecuritySettings.DocumentSecurityLevel = PdfSharp.Pdf.Security.PdfDocumentSecurityLevel.None;
The “fileName” variable is the path and name to the PDF file and the “pw” variable is the password for the document we want to clear.
That’s it. Three simple lines of code to clear the password. The “lock” functions are just as easy. Mark another win for Open Source software.
Once we have the document unlocked, we find that we may have a few hundred pages of medical records. Next time we’ll talk about how to break those down into manageable and indexable documents so we can use them