PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
migradoc fill entire A4 page using image https://forum.pdfsharp.net/viewtopic.php?f=2&t=4057 |
Page 1 of 1 |
Author: | Jessica [ Thu Nov 14, 2019 3:37 pm ] |
Post subject: | migradoc fill entire A4 page using image |
Hi Can somebody confirm if this code is correct for filling an entire A4 page using an image (not using original aspect ratio of the image): Code: Image image = section.AddImage(fileName); //DIN A4. Width is 21 cm, height is 29.7 cm. image.Height = "29.7cm"; image.Width = "21cm"; image.RelativeHorizontal = RelativeHorizontal.Page; image.RelativeVertical = RelativeVertical.Page; image.Top = ShapePosition.Top; image.Left = ShapePosition.Left; Is there something missing in the code or wrong. Or is 100% correctly to do this? |
Author: | Jessica [ Thu Nov 14, 2019 3:47 pm ] |
Post subject: | Re: migradoc fill entire A4 page using image |
If I add an image like this, a previous page of the PDF is overwritten by the image. Why is that? I tried creating a new section before adding the image and adding the image to the new section, but it doesn't work. |
Author: | Thomas Hoevel [ Thu Nov 14, 2019 4:33 pm ] |
Post subject: | Re: migradoc fill entire A4 page using image |
Jessica wrote: If I add an image like this, a previous page of the PDF is overwritten by the image. You do not add a pagebreak before adding the image, so the image is added to the current page and there may be some overlaps with other contents.Why is that? No need to add a new section if you only want a new page. |
Author: | Jessica [ Thu Nov 14, 2019 7:00 pm ] |
Post subject: | Re: migradoc fill entire A4 page using image |
Thomas Hoevel wrote: Jessica wrote: If I add an image like this, a previous page of the PDF is overwritten by the image. You do not add a pagebreak before adding the image, so the image is added to the current page and there may be some overlaps with other contents.Why is that? If I make a new paragraph just before adding the image, is the pagebreak needed then? |
Author: | Jessica [ Thu Nov 14, 2019 7:09 pm ] |
Post subject: | Re: migradoc fill entire A4 page using image |
Jessica wrote: Hi Can somebody confirm if this code is correct for filling an entire A4 page using an image (not using original aspect ratio of the image): Code: Image image = section.AddImage(fileName); //DIN A4. Width is 21 cm, height is 29.7 cm. image.Height = "29.7cm"; image.Width = "21cm"; image.RelativeHorizontal = RelativeHorizontal.Page; image.RelativeVertical = RelativeVertical.Page; image.Top = ShapePosition.Top; image.Left = ShapePosition.Left; Is there something missing in the code or wrong. Or is 100% correctly to do this? Can somebody confirm? |
Author: | TH-Soft [ Fri Nov 15, 2019 7:31 am ] |
Post subject: | Re: migradoc fill entire A4 page using image |
Jessica wrote: Can somebody confirm? I'd have to run that code on my computer to confirm it. But why should I spend 20 minutes to turn this code snippet into a program and try it?But maybe someone else will confirm it. |
Author: | Jessica [ Sat Nov 16, 2019 7:45 pm ] |
Post subject: | Re: migradoc fill entire A4 page using image |
TH-Soft wrote: Jessica wrote: Can somebody confirm? I'd have to run that code on my computer to confirm it. But why should I spend 20 minutes to turn this code snippet into a program and try it?Because I trust you, you have experience with MigraDoc If you say it works, then I better believe it. I'm not sure because I can't see if the image is really completely drawn (but I don't see page background anymore) |
Author: | Thomas Hoevel [ Mon Nov 18, 2019 10:13 am ] |
Post subject: | Re: migradoc fill entire A4 page using image |
Jessica wrote: If you say it works, then I better believe it. Code looks good, but without testing it in a debugger I cannot be sure it actually works.I produced lots of code that didn't work as expected. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |