PDFJsAnnotations icon indicating copy to clipboard operation
PDFJsAnnotations copied to clipboard

File after annotate is bigger (x4)

Open vavicheth opened this issue 3 years ago • 11 comments

Thank you for your great package. I have a problem with size after annotation. Do you have a solution for optimizing after annotate?

vavicheth avatar Apr 19 '21 06:04 vavicheth

Try setting this to "Fast" https://github.com/RavishaHesh/PDFJsAnnotations/blob/cb4131d865b981a8599138b7bd89bbf580ea845d/script.js#L9

RavishaHesh avatar Apr 19 '21 16:04 RavishaHesh

Thanks for your advice. It's nothing change size. When I change the scale to 1 (scale: 1), It's smaller but my pdf file smaller than paper (as padding).

vavicheth avatar Apr 19 '21 17:04 vavicheth

Scaling is similar to zoom function, but pageImageCompression sets the compression level of images of each page.

RavishaHesh avatar Apr 19 '21 17:04 RavishaHesh

I tried to change pageImageCompression: "FAST", // FAST, MEDIUM, SLOW(Helps to control the new PDF file size) but It still big size.

vavicheth avatar Apr 19 '21 17:04 vavicheth

Try this solution

hichamhargal avatar Aug 30 '21 04:08 hichamhargal

Now pdf files save as an image. (Image inside pdf file). Can we make save it as normal pdf. (I mean as selectable text format. Not images in pdf).?

kalana85 avatar Dec 09 '21 09:12 kalana85

@kalana85 It's possible but requires little bit of time to go through the documentations and stuff. I've started to work on that and haven't had time to work on that for last few months. You can find it in the dev branch. Last time I worked on that I was stuck in something related to the fonts.

RavishaHesh avatar Dec 09 '21 15:12 RavishaHesh

@ kalana85这是可能的,但需要一点时间来浏览文档和内容。我已经开始做这件事,但在过去几个月里一直没有时间做这件事。您可以在 dev 分支中找到它。上次我工作时遇到了与字体相关的问题。

If it is difficult, could you save annotation data in a single file? Then we can add annotation to pdf by other backend(such as python).

bzxgcs avatar Dec 27 '21 11:12 bzxgcs

The issue still persists even after disabling retinascaling in pdfannotate.js The file gets 4 times bigger and the quality is lost. . . Let me know if there are any other solution for this issue? thanks

fewbackseven avatar Mar 02 '22 11:03 fewbackseven

did anyone find the solution?

fewbackseven avatar Mar 02 '22 11:03 fewbackseven

Yes.. The solution here worked for me. After disabling the Retinascaling, Assigning Imagecompression to 'FAST', I restricted the page size to A4 while saving the pdf. Please refer below code..

PDFAnnotate.prototype.savePdf = function (fileName) { debugger; var inst = this; //var format = inst.format || 'a4';
var format = 'a4'; //<------------ Restricted the page size to A4 here by addling this line in pdfannotate.js var orientation = inst.orientation || 'portrait'; if (!inst.fabricObjects.length) return; debugger;

var doc = new jspdf.jsPDF({ format, orientation }); if (typeof fileName === 'undefined') { fileName = ${new Date().getTime()}.pdf; PDFAnnotate.prototype.savePdf = function (fileName) { debugger; var inst = this; //var format = inst.format || 'a4';
var format = 'a4'; //<------------ Restricted the page size to A4 here by addling this line in pdfannotate.js var orientation = inst.orientation || 'portrait'; if (!inst.fabricObjects.length) return; debugger;

var doc = new jspdf.jsPDF({ format, orientation }); if (typeof fileName === 'undefined') { fileName = ${new Date().getTime()}.pdf; }

fewbackseven avatar Mar 02 '22 12:03 fewbackseven