Comments (2)
@rkusa Have you been able to look into this yet?
I've done some more experiments with different files. The source file is a file I generated with another library jspdf containing text, lines and images.
The full file contains 5 pages with a header image on each page plus two pages with photos.
Here's a summary of my findings:
Description | Original | Orig Size | Converted | Converted Size |
---|---|---|---|---|
Full | orig.pdf | 2.15 Mb | converted.pdf | 10.7 Mb |
No headers | orig no headers.pdf | 2.09 Mb | converted no headers.pdf | 10.4 Mb |
No images | orig no images.pdf | 71.8 kB | converted no images.pdf | 341 kB |
Why is PDFjs increasing the output file size so much?
- Are the fonts getting duplicated for each page?
- Is the image resolution getting upscaled?
- Is compression being removed?
- In the source file, the same header image data is re-used on each page - is this getting duplicated by PDFjs?
from pdfjs.
Just FYI, I've moved way from using pdfjs for merging PDFs, due to this issue with excessive file sizes, and also (#312) where certain PDF files throw errors when they are merged.
Instead I'm using pdf-lib which is really easy to use to copy pages from one PDF to another, and it doesn't have any problems with the files we've provided in #312 which throw errors in pdfjs, and the output file size is never bigger than the original files. It also seems a bit faster.
I'm still using pdfjs to generate PDF from html, but then I use pdf-lib to combine that with other PDF files.
from pdfjs.
Related Issues (20)
- Error: Using spaces or \t at the beginning of a line when using Chinese will result in no line breaks HOT 1
- ExternalDocument can not create pdf from buffer HOT 1
- TypeError: Cannot read property '12' of undefined HOT 11
- Can I create a large pdf without loading the entire file into memory? HOT 1
- Missing outline when merging PDF files HOT 1
- how can I extract contents from a pdf HOT 1
- Downscale images in external PDF HOT 1
- Cannot catch error in asBuffer() HOT 21
- imported in .vue file but giving issue HOT 1
- Fragments are appearing in wrong order... HOT 1
- Invalid throw code in text._render HOT 1
- Issue with Inaccurate Text Highlighting in PDF Search Using ng2-pdfjs-viewer - Version 13 HOT 1
- The add() method of the table cell text method does not respect the "textAlign" or "alignment" properties HOT 1
- How do I set the font My characters are now garbled ? HOT 1
- Improve client-side support HOT 1
- Failed to add document containing lexer HOT 1
- Crash when processing PDF using nodejs HOT 2
- Underline does not seem to work well
- I get Process error while using this library in react js
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdfjs.