I want to scale a full pdf-page and insert into an new document. This works fine. But i have problems with the scale-factor when the factor is less than 1%. for example with a factor of 0,5%, no scale is happening. With a factor from 0,7%, the document (rectagle) has the correct size, but the scaled page is bigger then the calculated new size. Is there a way to scale a page continuously? It looks like, that in such cases with very small scale factors, the scaling works only in stages. Or maybe is there a problem with the 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 writer = 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 i calculate or read out the new size after the scaling?
Thanks.