You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using pdfjs to combine two PDF files. Each file is about 3 MB, but the combined pdf is 40 MB.
One of the files is a scanned document where each page is actually an image. Are the images getting upscaled as they are added to the combined PDF? If so, is there a way I can prevent this?
constoutputDoc=newpdfjs.Document();for(consturlofurls){constbuffer=awaitdownloadUrlAsBuffer(url);// my own codeconstdoc=newpdfjs.ExternalDocument(buffer);outputDoc.addPagesOf(doc);}constbuffer=outputDoc.asBuffer();
In a perfect world I would be able to specify a maximum DPI - if an image is higher resolution then the image is downscaled, otherwise the original image is unmodified.
I'll send the two files to you by email...
The text was updated successfully, but these errors were encountered:
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.
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.
I'm using pdfjs to combine two PDF files. Each file is about 3 MB, but the combined pdf is 40 MB.
One of the files is a scanned document where each page is actually an image. Are the images getting upscaled as they are added to the combined PDF? If so, is there a way I can prevent this?
In a perfect world I would be able to specify a maximum DPI - if an image is higher resolution then the image is downscaled, otherwise the original image is unmodified.
I'll send the two files to you by email...
The text was updated successfully, but these errors were encountered: