#1 2018-06-20 13:08:10

WillemGrooters
Member
Registered: 2018-06-20
Posts: 1

Ebcrypting existing PDF

If I get a PDF file by email (as attachment) I need to store it in a local database but in such a way that it is only accessibele by the persons that are authorized to read it. The PDF may also be forwarded as an e-mail attachment and only be readable by the person that holds the key.

So in fact, it's just a matter of encrypting an existing PDF (either file of stream)  and process the encrypted document in any way. The key will be linked to subject of the document.

I've noted it can be done by the PDF engine but I lack the real feel - and have little time to experiment.  Basic question is: HOW to read the existing document and copy it contents (encrypting it) into the new document as simple as possible? Just that: ALL aspects of the original document need to be preserved as is; no changes allowed.

Of course I could do a simple encryption using a key known by both parties, but this packages offers facilities I foresee to be needed so I'd like to use the encryption facilities of this package. What I lack is a simple example of reading an existing PDF and create an encrypted version of it  - without changes. This needs to be done without user intervention or visibility - in background. So without anything on screen (which, I think, rules out GDI).

I can think of:
* create a new document - stating encryption needed
* Read the original document
* Pass the information (page by page?) into the new document as-is
* Save the encrypted document


What I miss in the examples is reading the document and moving all attributes (canvas, fonts, colours…) from the old  document to the new one. Ideally, I would like to read the original document and past it all into the new one - causing it to be encrypted. (which logically means: read the document and write it encrypted).

It would help if I could get a mention of the routines involved - complete code is not needed, just which objects and methods are to be used and in which order, would be enough.
Or, of course, a link to some documentation about just that (I couldn't find it on the site...)

BTW I'm using delphi2007 for development.

.

Last edited by WillemGrooters (2018-06-20 13:13:25)

Offline

#2 2018-06-20 14:42:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,238
Website

Re: Ebcrypting existing PDF

Reading a PDF is not supported by the SynPdf library.

Offline

Board footer

Powered by FluxBB