https://github.com/munawwar/merge-pdfs-on-browser
Merge PDFs on a browser
https://github.com/munawwar/merge-pdfs-on-browser
Last synced: 7 months ago
JSON representation
Merge PDFs on a browser
- Host: GitHub
- URL: https://github.com/munawwar/merge-pdfs-on-browser
- Owner: Munawwar
- License: mit
- Created: 2020-05-15T20:34:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T17:31:48.000Z (over 3 years ago)
- Last Synced: 2025-03-10T15:55:11.137Z (7 months ago)
- Language: JavaScript
- Size: 2.18 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Merge PDFs on browser
## Run the demo
```sh
npm i -g http-server
http-server public
```There are two implementations of PDF merging in this repo:
1. Using pdfjs - http://localhost:8080/pdfjs-approach/
This approach merges PDF contents. It retains text and images. Text is highlightable etc (i.e it's good, quality wise)
2. Using canvas - http://localhost:8080/canvas-approach/
This use HTML5 canvas to render the PDF content first and then convert each page to PNG or JPEG and then save it to a new PDF. But this is not only slow, the quality of images maybe not be like merging PDFs properly together.
## For building pdfjs approach
```sh
npm i -g parcel-bundler
cd public/pdfjs-approach/
parcel pdf-merger-js-adapted.js
```## For building canvas appraoch
No steps needed. Used Mozilla's pdf.js library from CDN.
(Note "pdfjs" is not same as Mozilla's pdf.js. Former is name of an npm module written by "Markus Ast")