How to check if PDF was modified - pdf

I have a PDF generated by 3rd party system. Using PDF editor or els software I have modified it.
Is it possible to detect if PDF file was modified, without original file?
I will add some more details.
There is no encryption and no signature features.
Document is created by IT system. User receives document and modifies it.
Is it possible to track that change somehow?
I thought that all these applications leaves some data in PDF header or somewhere encoded inside file and it is possible to check it. However properties showed by windows explorer shows nothing... so I was interested if there is something smarter than viewing properties/header in explorer.

The problem with this is that just opening the PDF on a Mac in Preview and hitting Command-S to save the file will replace both the Creation and Modification date to match the current date/time. So even the creation date will be wrong. Even novice users can unknowingly do this, so if you're trying to track someone who may be purposefully modifying the document, it may lead to a false positive.
What you're asking is just too easy to spoof and fool unfortunately.

You could always check the md5sum of the pdf file. I'm not sure what environment you are using but that should help get you started.

It's going to be rough without the original file unless there were security features like encryption or digital signatures applied to it, which it doesn't sound like there was. Do you have access to any information at all about the original file? A file size, creation date, any of the metadata, etc.?

If the tool used to modify the PDF is working according to the PDF spec then in the Info dictionary it should update ModDate but leave CreationDate alone. You may also see some non-zero generation numbers on the objects although it is just as possible that all the objects have been regenerated and will therefore be generation 0. The trial version of CosEdit will allow you to look at these 2 items.
If however the tool has been used to intentionally modify the PDF without leaving a trace then they would be spoofing those bits of data so they won't help you.

Are the users modifying the PDF using Acrobat? If so then what Danio mentioned above should work. Strictly speaking, modifying the PDF should change its ModDate or xmp:ModifyDate without changing its CreationDate. However not all tools adhere to this; quite a few simply leave all metadata untouched, so this method of checking isn't 100% reliable unless you know what PDF editor your users employ.
If the editor your users use does change ModDate or xmp:ModifyDate, then you should be able to see it in two places. One is when you open the document in Acrobat and hit Ctrl-D to view Document Properties. The Creation field and Modified field should have different timestamps. There may also be APIs that can be used to programmatically retrieve this metadata. The other way you can visualize it is to simply open the PDF in Notepad and search for the properties. Most of the document won't be human readable but these timestamps should be. If they do get changed appropriately, you can always parse for them in your application. Good luck!

If you're using Ubuntu linux 18.04 and using Document Viewer then, you can
click on File options (3 vertical line ellipsis)
click on Properties...
look for Created / Modified fields in the Properties pop up
Beware: A sufficiently knowledgeable user can manipulate the PDF contents without changing the Created and Modified time stamps in the PDF metadata and the file system.

You can use some tools to get the pdf file property.
I use pdfinfo, you can get many property of the file, and check it.
pdfinfo 58dcc41d01293.pdf
Author: worker
Creator: Microsoft® Word 2016
Producer: Microsoft® Word 2016
CreationDate: Sat Aug 24 16:02:29 2019
ModDate: Sat Aug 24 16:02:29 2019
Tagged: yes
UserProperties: no
Suspects: no
Form: none
JavaScript: no
Pages: 55
Encrypted: no
Page size: 841.92 x 595.32 pts (A4)
Page rot: 0
File size: 3346838 bytes
Optimized: no
PDF version: 1.7

Related

How to retrieve files in Domino Web documents to embed them instead of showing them as links?

I have a Notes app that was designed for the browser, not the client. It allowed upload of files into the documents, so nearly all the documents have files. The files are stored in the NSF as $FILE and displayed in the documents as links.
I am using Adobe Acrobat Pro to create PDFs from the documents and need to include the file attachments within the PDFs, however the PDFs just include links to the files, not the attachments. Can I write an agent to run against the documents to get those files and embed them within the documents? When I view those documents through the client, I see all of the HTML etc. and then at the bottom of the document, the file attachments appear. When I view these same documents in the browser, the file attachments do not appear. If I could merely ensure that they are there, then when running the PDF generator in Acrobat Pro, they would be included in the PDFs and executable.
I am really stuck here, with no other way to 'archive' this notes database with all the data intact.
Thanks in advance for any insights!!
Ginni
There is a commercial product from Swing Software that does this. I hear that it's quite good, but I've never used it. Let me explain why...
The way I usually end up doing this is just quick-and-dirty. I write an agent to export the files, using the document UNID as part of the filename. The same agent exports all the data fields from the document into a CSV file, and I add a column with the filename of the extracted attachment. In your case, I would add two columns -- one for the extracted attachment(s), and one for the generated PDF. The CSV serves as an index for the exported data. It can be imported into something more friendly, or just left as-is and brought up in Excel, depending on the customer's usage requirements and available systems. I've recommended Swing Software's product and offered to explore other ideas for developing code (e.g., using wkhtmltopdf for Domino web apps to capture a WYSIWYG rendering based on an HTML crawl) for PDF rendering of Notes documents for a couple of clients, but none of them have justified the cost that would be involved in buying licenses and/or writing the code. Quick and dirty always seems to win, even when there are retention and eDiscovery considerations taken into account.

Somehow send command line commands on windows externally and get back the response

Problem: Need to convert local html (with local images etc) to pdf from an AIX box running Universe 11.2.5 with System Builder
Current solution: FTP over html file to a Windows server which converts in batches and sends the e-mail to the destination
Proposed Solution: Do everything on the AIX box, from converting html to pdf and sending the e-mail.
Current problem: Unable to find a way to convert local html to PDF on the AIX box. I have been trying many different ways from trying to install Python3, but to no avail.
The only really difficult part of the process is getting the HTML to render into a format will properly display your html into pages that are suitable for printing. There is a fair amount of magic that goes on between HTTP:GET and clicking print on a browser window that needs to be accounted for.
I was trying accomplish something similar many moons ago on AIX but kind of ran into a skill level/time wall because I was going to have essentially create a headless browser to render the html. It looks like there are now some utilities that you might be able to leverage. I found this recent updated article on Super User that actually got me somewhat excited, especially since I don't use AIX anymore so precompiled binaries and well understood and easily attainable dependencies are something I can actually have in my life.
https://superuser.com/questions/280552/how-can-i-render-a-website-as-an-image-from-the-shell
Good Luck.
There seems to be several questions rolled into this one item.
Converting HTML to PDF, while that is just a data manipulation that you could do in basic, writing such code would be a large task. The option you use sending it to another system is valid, but put more points of failure into the system. I would think you could find code to do it on the AIX box.
Rocket plans on getting the MV Python to work on AIX, this will make the converting of html to PDF much easier since there are a lot of open source modules.
As for my suggestion of using sockets, that would be if you intend to send it to a service that will take the htms, and return the pdf document.
i.e. Is there a web service for converting HTML to PDF?
Once you have the pdf document, you can either store it in a UniVerse type-19 file, or do the base64 encoding and store it in UniVerse hash file.
Hope this helps,
Mike

How to create advance PDF file encryption and protection using php?

I have a problem about PDF file encryption using php.
Case: Let's say I have a local system (web based) to upload and download files, such as 4sh*red (dot) com, but it just allows PDF file. A user sign up and login to download the PDF files using his or her own personal computer. After users downloaded a PDF file from my system, the file can be viewed only on computer where they downloaded the file. But, if another user copy it (I mean: downloaded PDF file) to another computer, the file can't be viewed on that computer.
Note: I don't mean here about protecting the PDF files using password because nowadays there are a lot of softwares used to remove PDF's password protection. But, the file can't be viewed at all if copied to another computer.
Can we do that in php? If yes, do you know any algorithm to solve the case?
I really appreciate your response or answers.
Thank you.
The PDF format is an open format by Adobe. This means there are a lot of programs out there that can read it and quite same that can modify it.
If you write your own program and add some stuff to the PDF, then maybe you can do this.
Another question is - why don't you just make the document visible in the web browser to the user? Of course there's still going to be a way around for savvy users to get it, but most noobs wouldn't know how and you can easily close the simplest blocks (like right click / save).
What maybe interesting to do is what a lot of companies are doing with videos nowadays: you can dynamically add some hidden or visible 'info' to a PDF that identifies who you sent it to. In that way, if the PDF shows up somewhere else - you know who spread it.... Again - PDF is an open format, so anyone can always erase whatever you write in the main contents, so you'd have to add a hidden image to the content or something.

advice on technology to use for document/form creation and indexing

My customer actually stores his documents, which are single page automotive forfeits, in a single MS Word document... this method is of course generating a huge file which is slow to open, not to talk about searches.
After a user compiles a document, he may need to print it to manually sign it. Then the document is scanned back and stored in PDF format. The document may be printed again to be
signed a second time by a manager. The doubly signed document is scanned again and saved
overwriting the singly-signed one.
The user wants to be able to search the document using a couple of search keys (the doc number and a sort of a SSN). That is the reason they are using a single file, to be able to search in the file using Word's search feature.
I have to propose an IT solution. I was thinking about giving them a software tool that:
reads a pdf form/template; the template rarely changes
shows the template on the screen and allows the user to input his variable fields in the form
some of the fields must be defined as searchable
the user saves only the form fields, not the whole pdf.
the sw is able to rebuild a document by coupling the template with the fields. I have to find a way to tie the template with the saved fields, so that the template can change (versioning) without breaking the old documents
the tool allows to search in multiple documents, using the defined search fields
the tool allows to print the document to manually sign it; this is the hard part. When the document is signed cannot be changed anymore, but if the document is simply scanned and coupled with the form/fields pdf, then I'll loose the benefits of only storing the data decoupled from the template. Should I only scan the signature and attach it to the document as an image?
What do you suggest to use?
Adobe XML Forms?
Adobe Forms Data Format?
An already existing software?
Other?
For the existing documents, I want allow the customer to import his huge MS Word file into the new system.
Thanks.
Sounds like you want a PDF form template that submits data to a dB that can be searched.
OTOH, if you just save the PDFs, Acrobat Pro can generate an index file from a directory, that can be searched (from reader?). Yep, you can run searches on an index from reader, but can only build them with Acrobat.
I prefer AcroForms to LiveCycle forms myself. There's a lot more software out there that works with 'em. If you go with LiveCycle, you're almost completely locked into Adobe. And Adobe server software is EXPENSIVE.

Creating PDF file in PowerBuilder

I am new to PowerBuilder. I got an assignment to create a PDF file using PowerBuilder. How can I do that?
Our organization used to use Ghostscript, but has instead moved to Amyuni.
as suggested by Alberto Megia, download PDF creator, but dont use SAVE AS.
After you install pdf creator it will install a printer, use that printer to save the
datawindow with the print function.
after call print function, you will see a "Save as" dialog.
If you use "saveas" function, the pdf will not have the format that the datawindow shows.
What version of PowerBuilder are you using? The most recent versions have PDF capability built in (using Ghostscript).
Install Ghostscript.
Get PDFCreator for free there and install it.
Then you can save as PDF any datawindow or datastore with the statement:
dw_1.saveAs(path_where_to_save_with_name_of_file.pdf, PDF!, true)
Third parameter is for override if the file exists with that name. I hope it works for you.
Regards,
Alberto
We just use Ghostscript. I wrote Ghostscript setup instructions earlier. We also print Word documents we've filled in to PDF from our app by printing them to 'Sybase DataWindow PS' printer then running Ghostscript to make the PDF.
Good Question - There really isn't an easy way other than finding a third party tool. I've tried the prior method mentioned and it does work but not without headaches and you are left with deployment headaches, deploying ghost script and having to make sure Post Script drivers are on the client.
I ended up trying many PDF converters, both free and paid, the one that worked most seamlessly was one that installed as a "printer" such as if you have Adobe installed on the PC, but you need to dynamically verify existence of the printer via RegistryGet and if it doesn't exist ask user to install or install it dynamically via code, and registry entries (not fun).
After several headaches mostly related to deployment issues I ended up going with a server solution, but it requires having a server that you can have a process (distiller) running that grabs post script files and distills them to PDF. I used a response window with progress bar, the PB app printed post script file to server location upon which the distiller grabs and converts. My PB app polls the server until it finds the PDF, or the user cancels whichever comes first. With a good distiller the process is fast (< 5 seconds) which was acceptable to our users.
Upon existence of the PDF, we'd attach it to an email and send via Oracle (mapi). This solution limits the requirements on client to post script driver which in most corporate environments is there, but you need to check it via Registry. Maybe there is a better solution out there since I did this last, around 2008.
fyi- I usually don't make vendor recommendations but will in this case because there was one that stood out in ease of use and quality, it was called PDFCreator which installs as a windows printer. It looks to be open-source right now but I recall that we would have had to pay to use it in corporate environment.
Good Luck.
Use the tutorial How to use PowerBuilder to create PDF file?.