Skip to content

pedromtorres/pdf-viewer

 
 

Repository files navigation

Published on webcomponents.org

<pdf-viewer>

pdf-viewer is a simple viewer, without any decoration, based on the Mozilla's pdfjs library. Buttons have to be created by the parent page or component.

the component is written using es6 syntax, a transcompiled version is also provided for older browsers, in this case use pdf-viewer.es5.html :

<link rel="import" href="bower_components/pdf-viewer/pdf-viewer.es5.html">

Nota : the pdfjs library uses XMLHttpRequest to load the pdf documents. So, you may encountered CORS problem, if you try to load a document from another origin. A solution could be to use a proxy to serve your documents, you could take advantage to use for example the project CORS Anywhere.

Demo and doc are available on https://telecomsante.github.io/pdf-viewer/

Basic usage :

<pdf-viewer   
  src="https://www.w3.org/TR/1998/REC-html40-19980424/html40.pdf"
  initial-zoom="fit-width",
  mode="double",
  page="5"></pdf-viewer>

The component is licensed under the ISC License

About

A pdf viewer webcomponent

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 82.8%
  • HTML 17.2%