https://github.com/zerox-dg/easypdf
A simple library that use PDF.js for rendering pdf file on electron
https://github.com/zerox-dg/easypdf
electron javascript pdf
Last synced: 10 months ago
JSON representation
A simple library that use PDF.js for rendering pdf file on electron
- Host: GitHub
- URL: https://github.com/zerox-dg/easypdf
- Owner: ZeroX-DG
- Created: 2018-03-09T06:02:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-11T04:35:22.000Z (about 7 years ago)
- Last Synced: 2025-03-12T11:49:33.011Z (over 1 year ago)
- Topics: electron, javascript, pdf
- Language: JavaScript
- Size: 4.03 MB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# EasyPDF
*A simple library that use PDF.js for rendering pdf file on electron*
Author: Hung Nguyen
## About this project
This library will help you render your pdf file using [pdf.js](https://github.com/mozilla/pdf.js/) on your electron app with minimal effort.
## Documentation
Check out the documentation [here](api.md)
## Example
First you need to install the library using the command
```
npm install easypdf
```
Then include it in your js file (I named mine index.js)
```js
let easypdf = require('easypdf');
// example pdf file
let pdf_file = 'http://www.africau.edu/images/default/sample.pdf';
// load the pdf file and set the container
let container = easypdf(pdf_file).setContainer('#pdf-container');
// render the pdf
container.render();
```
Then include it the html file
```html
EasyPDF demo
body, html {padding: 0; margin: 0}
#pdf-container {
width: 100%;
height: 100%;
position: fixed;
}
```
Finally, load the html file to electron browser window and here is what we get

Want more example? checkout the [test folder](/test)
## Contributing
To getting started, you can fork and clone this repo. After that run the command bellow to install all dependencies
```
npm install
```
Then edit your code in the [src folder](/src) and send me a PR :)
## Contact
If you have any questions, you can find me at:
Facebook: https://fb.com/ZeroXCEH
Twitter: https://twitter.com/ZeroX_Hung
Email: viethungax@gmail.com