I need to create a database of different PDF files which are either uploaded by users on the server or are saved as bookmarks for the pdf files available on internet. The files available through internet are opened in pdf.js. I came across the the fingerprint that pdfjs generates for some of its operations and was wondering if I could use that to identify the pdf uniquely. But to do that I also need to generate this fingerprint myself for the documents that are uploaded but not opened via viewer.js (since I can get my hands on this fingerprint via viewer.js but not otherwise). I can use iTextSharp as pdf parser for pdf parsing but have no clue how pdfjs generates the fingerprint.
It seems pdf.js is doing the following in its fingerprint():
- If available, it uses the first ID string from the PDF trailer.
- If there's no ID, an MD5 hash of (part of) the byte content is calculated.
That's my quick interpretation of the current pdf.js fingerprint() source