× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I would start by checking that the PDF file is really encoded properly and that what you get back in the JSON object is the correct base-64 encoded PDF file. Try uploading a test PDF to this site https://www.base64encode.org/ and then checking that the base-64 it gives you matches the base-64 version of the same document that you are receiving. Assuming this matches then I think it's safe to say that the PDF is arriving intact, so I'd then look at whether it's being properly decoded on the client and transformed back to its original binary format. You can also use the "decode" part of that website to decode a base-64 document, so you could use it to check what the decoded version of your base-64 comes out like.

Tim.
[https://cdn.base64encode.org/assets/images/b64_fb.png]<https://www.base64encode.org/>

Base64 Decode and Encode - Online<https://www.base64encode.org/>
Decode from Base64 or Encode to Base64 - Here, with our simple online tool.
www.base64encode.org




________________________________
From: WEB400 <web400-bounces@xxxxxxxxxxxx> on behalf of Toni Schaake <Toni.Schaake@xxxxxxxxxxxxxx>
Sent: 05 November 2018 10:53
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] Return PDF in Rest Service

Hi All,

Thank you all for the advice.

I've made the changes to encode the PDF to Base64, but still no luck.

Does anybody have some sample code, as I'm really stuck here and need to get it to work ASAP.

I'm using Scott's YAJL tools, and HTTPAPI handle the request to the server where the PDF originates from. (Using Http_Req(), also tried http_Stmf()).

Thank you in advance,

Toni Schaake.

-----Original Message-----
From: WEB400 <web400-bounces@xxxxxxxxxxxx> On Behalf Of Charles Wilt
Sent: 31 October 2018 17:28
To: Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>
Subject: Re: [WEB400] Return PDF in Rest Service

On Wed, Oct 31, 2018 at 1:29 AM Toni Schaake <Toni.Schaake@xxxxxxxxxxxxxx>
wrote:

I understand that the PDF, when viewed as raw data is already
"garbage", but in my test the "garbage" does not look the same as the
original saved PDF. (Hope you understand what I mean here).



Probably your code (and/or the i) didn't treat the document as binary, thus it was translated from to ASCII

Make you write/read from the IFS as binary, not text.

Charles
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&amp;data=02%7C01%7C%7C36d022ea4dbc4e8ff7ef08d64304972f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636770084325948223&amp;sdata=Lrwv%2B9ypqprq6aZ55LQ4r6l3D47OAHT1oUdt63HtGiY%3D&amp;reserved=0
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&amp;data=02%7C01%7C%7C36d022ea4dbc4e8ff7ef08d64304972f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636770084325948223&amp;sdata=4BoURHJ2RZlPaUWoSo1ZIDuWMDHmFGf39SYVwXQOGko%3D&amp;reserved=0.

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&amp;data=02%7C01%7C%7C36d022ea4dbc4e8ff7ef08d64304972f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636770084325948223&amp;sdata=Lrwv%2B9ypqprq6aZ55LQ4r6l3D47OAHT1oUdt63HtGiY%3D&amp;reserved=0
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&amp;data=02%7C01%7C%7C36d022ea4dbc4e8ff7ef08d64304972f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636770084325948223&amp;sdata=4BoURHJ2RZlPaUWoSo1ZIDuWMDHmFGf39SYVwXQOGko%3D&amp;reserved=0.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.