D3 and mvBase

 View Only
  • 1.  save pdf to DB

    Posted 05-19-2021 15:31
    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
    ------------------------------


  • 2.  RE: save pdf to DB

    Posted 05-19-2021 15:52
    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
    ------------------------------



  • 3.  RE: save pdf to DB

    Posted 05-19-2021 17:54
    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
    ------------------------------



  • 4.  RE: save pdf to DB

    Posted 05-20-2021 10:32
    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
    ------------------------------



  • 5.  RE: save pdf to DB

    ROCKETEER
    Posted 05-20-2021 11:30
    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
    ------------------------------