Skip to main content

save pdf to DB

  • May 19, 2021
  • 4 replies
  • 0 views

CRAIG CURTIS
Forum|alt.badge.img
I need to securely store pdf documents.  First thought was to encrypt and store on web server, then keep the key in DB to decrypt.  Second and better thought would be to upload the pdf to the DB and store the binary document in the DB.

Just wondering if anybody has attempted to store a PDF document in the db and if they would be willing to share any code/problems.

Craig

------------------------------
Craig Curtis
craig.curtis@seviersd.org
------------------------------

4 replies

Bill Brutzman
  • Participating Frequently
  • May 19, 2021
I need to securely store pdf documents.  First thought was to encrypt and store on web server, then keep the key in DB to decrypt.  Second and better thought would be to upload the pdf to the DB and store the binary document in the DB.

Just wondering if anybody has attempted to store a PDF document in the db and if they would be willing to share any code/problems.

Craig

------------------------------
Craig Curtis
craig.curtis@seviersd.org
------------------------------
I like using Adobe Live Cycle Designer (LCD) with Adobe ColdFusion (CF) to _ save the data _ as data _ injecting the data into pdf templates for Invoices, Purchase Orders, etc.

Pricing for LCD and hosted CF is modest.  I am happy to share example code.

------------------------------
Bill Brutzman
IT Manager
HK MetalCraft Mfg Corp
------------------------------

CRAIG CURTIS
Forum|alt.badge.img
  • Author
  • Participating Frequently
  • May 19, 2021
I like using Adobe Live Cycle Designer (LCD) with Adobe ColdFusion (CF) to _ save the data _ as data _ injecting the data into pdf templates for Invoices, Purchase Orders, etc.

Pricing for LCD and hosted CF is modest.  I am happy to share example code.

------------------------------
Bill Brutzman
IT Manager
HK MetalCraft Mfg Corp
------------------------------
Thanks Bill,
Interesting concept.  The PDF documents need to be stored in a secure manner since they will contain sensitive information.  Cloud hosted is for sure out.   I guess I am not sure if D3 will handle the long strings of what the blob would be.

Thanks again for the idea.

------------------------------
Craig Curtis
craig.curtis@seviersd.org
------------------------------

  • Participating Frequently
  • May 20, 2021
I need to securely store pdf documents.  First thought was to encrypt and store on web server, then keep the key in DB to decrypt.  Second and better thought would be to upload the pdf to the DB and store the binary document in the DB.

Just wondering if anybody has attempted to store a PDF document in the db and if they would be willing to share any code/problems.

Craig

------------------------------
Craig Curtis
craig.curtis@seviersd.org
------------------------------
We encrypt the PDF and save it in the linux file system and keep the encrypted key in the database along with metadata on the PDF.  I don't remember why we chose not to keep the PDF in the DB but this solution has been working well.

------------------------------
Steve Caspers
Murphy Automotive Inc
------------------------------

Brian Cram
Forum|alt.badge.img+3
  • Rocketeer
  • May 20, 2021
I need to securely store pdf documents.  First thought was to encrypt and store on web server, then keep the key in DB to decrypt.  Second and better thought would be to upload the pdf to the DB and store the binary document in the DB.

Just wondering if anybody has attempted to store a PDF document in the db and if they would be willing to share any code/problems.

Craig

------------------------------
Craig Curtis
craig.curtis@seviersd.org
------------------------------
Hey, Craig! How's it goin'?

Here's something in the HOSTS file documentation which shows an example of storing a hex-encoded binary in a D3 file. Let me know if this helps.

Manipulating O/S binary files in BASIC

No direct mechanism exists for reading O/S binary files (.JPG, .MP3, and so on) into a BASIC program variable. This is due to the translation of special characters commonly found in binary files that, if not translated, will confuse or be corrupted by D3. Segment marks, attribute marks, and value marks fall into this category.

Instead, you can do the following:

  1. Copy from the O/S into a D3 file using the nt_bin or unixb driver.
  2. Read the item from that file into a BASIC variable using the binx driver.
  3. Manipulate the hex-ASCII string in the program.
  4. Write the BASIC variable out to the D3 file using the binx driver.
  5. Copy the item out to the O/S using the nt_bin or unixb driver.

Example(s)

 data "(binx:hextest"
 execute \\copy nt_bin:c:/temp test.txt\\
 open 'binx:hextest' to file
 read item from file,"test.txt"
 *Manipulate item here.
 *This example replaces string for brevity.
 item = "6261FFFEFF6766"
 write item on file,"test.txt"
 data "(nt_bin:c:/temp"
 execute \\copy binx:hextest test.txt\\


------------------------------
Brian S. Cram
Principal Technical Support Engineer
Rocket Software
------------------------------