RavishaHesh / PDFJsAnnotations

Wrapper for PDF JS to add annotations
MIT License
322 stars 98 forks source link

Saved pdf squashed #42

Closed netmastan closed 2 years ago

netmastan commented 2 years ago

Hi, I noticed when I save the pdf it looks squashed - text and images. Does anyone have this issue?

RavishaHesh commented 2 years ago

@netmastan can you attach a screenshot?

netmastan commented 2 years ago

Thank you for the reply. The sample file is what is downloaded after clicking the save button and the contract pdf is the actual pdf.

sample (2).pdf contract.pdf

And also tried to put an image as per the JSON data left and top value. It doesn't match the x,y location. Any thoughts about it? Basically, I'm trying to save an object location later using pdftk to put something in the same location.

RavishaHesh commented 2 years ago

Sorry! Library haven't had support for page size and orientation. I've pushed an update to the master branch so you will be able to get desired output now.

netmastan commented 2 years ago

You are amazing Sir!

My final struggling is - I can't put a signature in the x,y cordinate( "left": 1090,"top": 48) using pdftk. The location doesn't match. So my text object position is left 1090, top 48. So I do this

convert logo.png -resize 26% -transparent white -page a4+1090+48 -quality 100 stamp.pdf pdftk sample.pdf multistamp stamp.pdf output final.pdf

Any help would be highly appreciated. I would be happy to contribute. Thank you.

{ "page_setup": { "format": [ 841.8898, 595.2756 ], "orientation": "landscape" }, "pages": [ { "version": "4.3.0", "objects": [ { "type": "i-text", "version": "4.3.0", "originX": "left", "originY": "top", "left": 1090, "top": 48, "width": 80.2, "height": 18.08, "fill": "#212121", "stroke": null, "strokeWidth": 1, "strokeDashArray": null, "strokeLineCap": "butt", "strokeDashOffset": 0, "strokeLineJoin": "miter", "strokeMiterLimit": 4, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "shadow": null, "visible": true, "backgroundColor": "", "fillRule": "nonzero", "paintFirst": "fill", "globalCompositeOperation": "source-over", "skewX": 0, "skewY": 0, "text": "Sample Text", "fontSize": 16, "fontWeight": "normal", "fontFamily": "Times New Roman", "fontStyle": "normal", "lineHeight": 1.16, "underline": false, "overline": false, "linethrough": false, "textAlign": "left", "textBackgroundColor": "", "charSpacing": 0, "styles": {} } ], "backgroundImage": { "type": "image", "version": "4.3.0", "originX": "left", "originY": "top", "left": 0, "top": 0, "width": 1262, "height": 892, "fill": "rgb(0,0,0)", "stroke": null, "strokeWidth": 0, "strokeDashArray": null, "strokeLineCap": "butt", "strokeDashOffset": 0, "strokeLineJoin": "miter", "strokeMiterLimit": 4, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "shadow": null, "visible": true, "backgroundColor": "", "fillRule": "nonzero", "paintFirst": "fill", "globalCompositeOperation": "source-over", "skewX": 0, "skewY": 0, "cropX": 0, "cropY": 0, "src":"too long" "crossOrigin": null, "filters": [] } } ] }