java - itext, pdf size A4, and image scalling -


my paper b4 - 17,60cm x 24,50cm

its scanned have size in pixels -> 2048 x 2929

im creating pdf a4 size (2480px x 3508px) using itext.. im unable scale margins, , not without margins, need insert b4 image pdf a4 size, using left margin of 2,5cm , righ margin 2cm, how can make fit calculating sizes, since paper a4 has 2480x3508, b4 image has 2048x2929, if insert, cut? b4 bigger :| how?? considering size of a4, , b4 should fit inside a4

if this:

doc = new document(pagesize.a4, 0, 0, 0, 0); os = new fileoutputstream(arquivonomecompleto);         pdfwriter.getinstance(doc, os);         doc.open();        image img = image.getinstance(arraypath[i]); // array store path image           //  img.scaletofit(2090, 1208); // tried lot of modifications, can set 500x500 or in have showed in pdf, how can calculate margins              doc.add(img);                doc.add(new paragraph("test: text under b4 image");            doc.newpage(); 

still cutting

if convert 17cm , 29,70cm pixels, , set in img.setscaletofit, still cutting, how? or computer crazy or pdf a4 size of itext wrong :|

look want:

enter image description here

edit: ops, margin of left side 2cm :)


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -