itextsharp - How to scale a page less then 1 percent? -



itextsharp - How to scale a page less then 1 percent? -

i want scale total pdf-page , insert new document. works fine. have problems scale-factor when factor less 1%. illustration factor of 0,5%, no scale happening. factor 0,7%, document (rectagle) has right size, scaled page bigger calculated new size. there way scale page continuously? looks like, in such cases little scale factors, scaling works in stages. or maybe there problem internal matrix-calculation?

float scale = 1.005f; //100,5% var newwidth = originwidth*scale; var newheight = originheight*scale; pdfreader reader = new pdfreader(inputfile); var newmediabox = new rectangle(newwidth, newheight); document doc = new document(newmediabox); pdfwriter author = pdfwriter.getinstance(doc, new filestream(outputfile,filemode.create)); doc.open(); pdfcontentbyte cb = writer.directcontent; pdfimportedpage page = writer.getimportedpage(reader, 1); //page #1 cb.addtemplate(page, scale, 0, 0, scale, 0, 0); doc.close();

the other way: can calculate or read out new size after scaling?

thanks.

itextsharp default utilize 2 decimal places rounded when adding template. can alter setting high_precision static variable of bytebuffer class true give 6 decimal places. not know if impact overall application performance i'm confident won't.

itextsharp.text.pdf.bytebuffer.high_precision = true;

itextsharp

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -