Retrieve PDF document to convert image Base64
Wednesday, June 23, 2021 at 09:35amHello,
I am calling OneSpan API to fetch pdf using {onepanurl}/api/packages/{packageID}/documents/{documentId}/pdf. But I am receiving the response in PDF binary string. I want to convert the response to a single base64 image which can be shown on a html page? I am using NodeJs. Can you please help with this issue.
Reply to: Retrieve PDF document to convert image Base64
Wednesday, June 23, 2021 at 10:14amHi AyshaSingh,
The only response type for this API is "application/pdf", therefore I believe to use a third party library to convert PDF to base64 string, for example pdf-to-base64, would be the easiest approach.
Duo
Reply to: Retrieve PDF document to convert image Base64
Sunday, June 27, 2021 at 03:44pmThanks Duo for quick response.
I came across an API to fetch document in page format which would help with my implementation.
GET /api/packages/{packageId}/documents/{documentId}/pages/0
I wanted to confirm if is it possible to use this API to fetch multiple pages at once?
Aysha
Reply to: Thanks Duo for quick…
Monday, June 28, 2021 at 08:39amHi Aysha,
Yeah, this API returns flattened PDF page in image format. However, as you have noticed, it won't fetch multiple pages at once.
Actually if it's just for preview purpose, you can download the flattened PDF instead, which is in smaller size:
GET /api/packages/{packageID}/documents/{documentId}/pdf?flatten=true
Duo