|Service||Code (AppBuilder), Third-party product|
|Mobile development type||Hybrid (Cordova app)|
- Go to the PDF.js page and click Download.
- On the download page, click Stable.
- Extract the downloaded archive and copy the
pdf.worker.jsfiles from the
buildfolder into a
scripts/pdf.js/folder in your project.
pdf.worker.jsfiles in your
- Enable the File core plugin in your app.
(Windows Phone only) Explicitly set the path to the
pdf.worker.jsfile in your code:
PDFJS.workerSrc = "scripts/pdf.js/pdf.worker.js";
- Use the File plugin to read the PDF file as a
Uint8Arrayand pass it to the
- Render the parsed PDF content into a
canvaselement on the page.
A working example is available here: PDF Create/Open sample app.
This example relies heavily on a third-party library. At the time of testing, it worked on all three operating systems supported by Telerik Platform. However, there is no guarantee that this code will continue to work seamlessly with future OS versions. It is recommended to test this functionality in your app with each release of a new OS version and each update of the PDF.js library that you decide to use.