flyingsaucerproject / flyingsaucer

XML/XHTML and CSS 2.1 renderer in pure Java
Other
1.95k stars 549 forks source link

Adding an image to the full size of a pdf page #315

Open happydroid opened 2 months ago

happydroid commented 2 months ago

I have a problem adding an image to the entire size of a pdf page. I need to make a report in which the first page will be a special image, in a4 format and horizontal orientation (like the entire report).

And no matter what I did, what advice I tried from the Internet (stackoverflow, chatgpt), I was never able to do this simple operation.

I made a project on Github https://github.com/happydroid/pdf_full_page that generates a simplified report consisting of two pages - the first page with an image and the second page with some data. As you can see, trying to render the image in landscape orientation creates three whole pages: image

As you can see, the page cannot be displayed completely, due to some indentation on the left and possibly on other sides, and I have turned off any indentation(paddings) in the styles for this page. In the test project, I added the simplest example of rendering the project; I did not add all kinds of non-working methods.

Do you have any ideas on how this can be implemented using your library? Thank you.