简体   繁体   中英

Add a unique File ID to PDF documents received

I need to track PDF documents RECEIVED. I can keep a list of the documents in a database, however sometimes the documents get renamed or moved, so the file path to the PDF is not always reliable. For other document types, I sometimes add a unique ID as metadata, so that I can recognize that a file that was moved and/or renamed is the same as one seen previously. I am looking for a solution that will work on Windows 10, and would prefer a solution based on Node.js, although Python would also be acceptable. The documents are received from many different sources, and I do not have the option of requiring the source of the document to add a unique identifier. I have use IPTCinfo in this way for media files, but (as far as I know) that can't be used with PDFs. I am looking for something similar that can be used with PDFs.

Use md5sum :

import os 

def check_md5sum(file_path):
    md5sum = os.system(f'md5sum {file_path}')
    return md5sum

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM