PDF Viewer component enhancements : external URL and zoom in %

Hi,

I have tried out the PDF Viewer, which could be useful, because whereas iOS provides a native preview for PDF, this is not the case on Android.

However, it was a non-starter for me because only Backendless URLs are accepted. A URL outside Backendless does not seem to work. Is there a workaround for this ? Could this be solved or is it by design ? It sort of contradicts the recent push towards hosting stuff outside of Backendless…

Also, a nice to have suggestion : the zoom level is more commonly understood by users if written in % rather that decimal (i.e. 80% is better than 0.8).

Hi.
I’ve created the task in order our devs checked and added (if necessary) such a functionality.

1 Like

Hi @Nicolas_REMY

Unfortunately, we are unable to resolve the issue with external links to PDF files due to the CORS policy on the server where the PDF file is stored. If you have your own server and can configure CORS to respond to a PDF request, you should be fine. As for percentages to zoom PDF files, we will add them soon and let you know about it. Thanks for the report!

Best regards, Pavlo

Hi, @Nicolas_REMY, we are happy to announce that the “PDF Viewer” component has been updated to the 1.1.1 version with a Scaling in % function and another helpful changes. You already can try it on the Marketplace or Update your actual component to the last version in your App.

Happy Codeless Coding!

1 Like

Thanks a lot.

Unfortunately, I won’t be able to use the component. I need the app to display the PDF on Android, whether it is stored on Backendless or not.

For those who face the same issue, my current workaround is to use Google’s preview :
https://docs.google.com/gview?url= + EncodeURI of the target document URL
It’s not perfect, but it seems to work.

I wonder how Google manage to have this work in spite of the CORS policy constraint that you mentioned. Couldn’t Backendless do the same ?

Hi @Nicolas_REMY,

Our developer is investigating this issue and will respond as soon as possible.

Regards,
Olha

Hi @Nicolas_REMY,

Unfortunately, we cannot do anything systematically. I can suggest trying to bypass CORS. The idea is to send a request to a PDF file through a cloud service and use the file API to add the file to our file system, then transfer the URL of this file (already in our file system) to the component. After uploading the file to the user interface, it can be removed from our file system. Here is an example of this logic:



Regards,
Pavlo

2 Likes