I'm wondering why i'm getting a bitmap from a page that has a different size/dpi than the bitmap i used to create the page.
example: bmp
is a Bitmap
with a Width of 1275 and Height 1651 at a dpi of 150. I use this bitmap to create the page. When i use PDFDraw to retrieve the Bitmap at the end of my code, Bitmap
b
has a Width of 2657 and height of 3440 at 150 dpi. Why has this changed and how can i get my original bitmap back?
//create a page
var imgRect = new Rect(0, 0, bmp.Width, bmp.Height);
pdftron.PDF.Page _currentPage = convertedPdf.PageCreate(imgRect);
imgRect.Dispose();
//start writing to a page
elementWriter.Begin(_currentPage, ElementWriter.WriteMode.e_underlay, false);
//write the image
var element = elementBuilder.CreateImage(_currentImg, new pdftron.Common.Matrix2D(bmp.Width, 0, 0, bmp.Height, 0, 0));
elementWriter.WritePlacedElement(element);
//cleanup
_currentImg.Dispose();
//add the page to the pdf
convertedPdf.PagePushBack(_currentPage);
//just a test for retrieving the page later on
PDFDraw drawer = new PDFDraw();
Bitmap b = drawer.GetBitmap(_currentPage);