javascript - How to use PDF.js to load file included in web app (not from "file:" URL? -
i want able show pdf files within chrome app using pdf.js documentation non-existent. i've been unable find simple examples or tutorials show code load pdf relative url, show page, , navigate through pdf. have complex examples 95% of code other things , it's difficult parse these , find relevant functions. to:
include relevant code in app (is "pdf.js" created "node make generic" , nothing else? or need include other js files well?)
be able show pdf files inside
myapp.crx
filedoes pdf.js require "localstorage"? localstorage continue allowed in chrome extensions/apps or deprecated?
can tell me if #2 possible , how find example code or documentation on proper classes/functions call , files include/build?
node make generic
outputsbuild/generic
directory. directory contains 2 subdirectories, "build" , "web".
"build" contains "pdf.js", actual pdf engine.
"web" contains viewer, similar 1 @ http://mozilla.github.io/pdf.js/web/viewer.html.after copying both of previous directories app, should able load pdf file using
chrome.extensi/web/viewer.html?file=path%2fto%3ffile.pdf
pdf.js not require
localstorage
.it's used if available persisting settings such scroll position, if unavailable, pdf.just continues work without it.
there 1 significant issue though: pdf.js loads localization files using synchronous xmlhttprequest. not allowed in chrome app. solve issue serializing files in locales
, put in single javascript file, load in viewer.html, , simplify l10n.js
read translations file described.
Comments
Post a Comment