Image scaling

Image scaling

Forum member · Apr 27, 2006
I am adding bitmap charts to my pdf document. ceTe.DynamicPDF.PageElements.Image image = new ceTe.DynamicPDF.PageElements.Image(bmp, currentX, currentY); When I export the image from chartFX as bitmap, what should I set the width of the ChartFX image to avoid scaling and to ensure better image resolution. My requirement is to diplay the chart image to the width of the pdf page based on landscape or potrait.

Re: Image scaling

Support · Apr 27, 2006
Hello, In order to display the image across the entire page, you would need to set the image width equal to the page width using the "SetBounds" method. This will stretch the image to any given height and width. However, using our product you cannot increase the size of the image keeping the same resolution. Our product does not resample the image. You would need to use some Imaging tool to resample the image in order to maintain the same resolution while increasing the image size. Thanks, ceTe Software Support Team

Re: Image scaling

Forum member · Apr 27, 2006
I don't understand what's wrong //In landscape the pagewidth = 692 (i.e 792 - 50 -50) pageWidth = page.Dimensions.Width - page.Dimensions.LeftMargin - page.Dimensions.RightMargin; //This is how I set the chartFX size chart.Width = Convert.ToInt32(pageWidth * 1); //692 chart.Height = Convert.ToInt32(pageHeight * .50); Then I add the bitmap which has 96 dpi ceTe.DynamicPDF.PageElements.Image image = new Image(bmp, currentX, currentY); image.SetBounds(pageWidth, image.Height); Do I need to change the dpi or scaling of the image?? new Image(bmp, currentX, currentY, .54f); The image seems to occupy only 70% of the screen.

Re: Image scaling

Support · Apr 28, 2006
Hello, You will have to set the scale to .75f in order to keep the image resolution to 96 dpi. You will only need three lines of code to set the image across the entire page and still preserve the same resolution. In the code below margins are set to 0 to display the image across the entire page. Image image = new Image(bmp, 0, 0, .75f); Page page = new Page(image.Width, image.Height, 0); page.Elements.Add(image); If you want to add any other page elements and require setting the margins, then the image x and y co-ordinates will change as the code below: Image image = new Image(bmp, -50, -50, .75f); Page page = new Page(image.Width, image.Height, 50.0f); page.Elements.Add(image); Thanks, ceTe Software Support Team