PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
large image across multiple page https://forum.pdfsharp.net/viewtopic.php?f=2&t=1632 |
Page 1 of 1 |
Author: | badalpatel [ Fri Apr 22, 2011 4:57 am ] | ||
Post subject: | large image across multiple page | ||
Hello, I have one large image of 1024x3700 (i have attached the sample). Now i want to convert this image in the PDF having paper size as A4. I have tried it like below way to implement this PdfDocument doc = new PdfDocument(); PdfPage pg = new PdfPage(); pg.Size = PageSize.A4; doc.Pages.Add(pg); XGraphics xgr = XGraphics.FromPdfPage(doc.Pages[0]); XImage img = XImage.FromFile(Server.MapPath("~") + "/" + imagename); xgr.DrawImage(img, 0, 0); doc.Save(Server.MapPath("") + "/test.pdf"); doc.Close(); Now as the image height is large it should go to the next page and i am unable to do it. I know that i can specify the y position in "DrawImage" function but for which value should i set it for the second page? And one more thing, i want to scale the image also to paper width, i dont know what should i have to do for this. Right now above code removes some of the right portion of image. Any help will be much appreciated.
|
Author: | Thomas Hoevel [ Tue Apr 26, 2011 11:44 am ] |
Post subject: | Re: large image across multiple page |
When drawing an image, you can specify location and dimension. Calculate the width to fit the page, then calculate the height keeping the aspect ratio. You can draw the same image on multiple pages, using different positions. Clipping is not yet implemented. For pages 2ff, the position will be outside the page in order to show the corresponding "part" of the image. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |