Announcement

Collapse
No announcement yet.

Encode pdf file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Encode pdf file


    I have to consume a fedex web service within an ILE RPG procedure, where I should indicate the commercial electronic document in binary format. The electronic document is available in pdf format on the IFS. How can I convert this file to a binary string to be included in the XML specification? A code example is very welcome! Thanks in advance

  • #2
    It depends on what exactly FedEx is expecting. I convert PDF files to base-64 encoded strings for JSON payloads. I read the PDF into a pointer using IFS APIs, I pass that pointer into a base64 API, and pass the pointer into JSON using YAJL.

    open()
    read()
    base64_encode()
    yajl_addCharPtr()

    Ref:
    https://www.scottklement.com/rpg/ifs.html
    https://www.scottklement.com/base64/
    https://www.scottklement.com/yajl/

    Comment

    Working...
    X