Open vavicheth opened 3 years ago
Try setting this to "Fast" https://github.com/RavishaHesh/PDFJsAnnotations/blob/cb4131d865b981a8599138b7bd89bbf580ea845d/script.js#L9
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).
Scaling is similar to zoom function, but pageImageCompression
sets the compression level of images of each page.
I tried to change pageImageCompression: "FAST", // FAST, MEDIUM, SLOW(Helps to control the new PDF file size)
but It still big size.
Try this solution
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 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.
@ 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).
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
did anyone find the solution?
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
;
}
Thank you for your great package. I have a problem with size after annotation. Do you have a solution for optimizing after annotate?