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.
Attachments: |
File comment: sample image
test.png [ 81.05 KiB | Viewed 3955 times ]
|
|