Open tbessie opened 2 years ago
Hi, can I work on this issue?
Hi, can I work on this issue?
Not sure if you're asking me, or someone who's in charge of the project. :-)
If you do, in any case, when I stepped through what's happening, I suspected the various listener events that are being fired and how they are responded to. Perhaps they are being ignored for page size change for current page. I don't know what the listeners are doing, though, as I didn't step into them.
NOTE: I also noticed that the default MediaBox value per PDF page is the same as the resolution of the image that page contains. In the iText version we were using, the default value is A4 (which appears the default pagesize overall). I'm not sure if this is a bug in the old iText library or a bug in OpenPDF - probably debateable.
It looks like this (and associated behavior) is the culprit, from PdfDocument:
public boolean setPageSize(Rectangle pageSize) {
if (this.writer != null && this.writer.isPaused()) {
return false;
} else {
this.nextPageSize = new Rectangle(pageSize);
return true;
}
}
hi tbessie, i moved document.open() after document.setPageSize, it works fine.
Describe the bug When I create a new Document and add images to it, I set the page size for each image received before adding the image. However, the page size I set doesn't appear to take effect until the next page. This worked differently in the older version of iText we ported this from.
To Reproduce
Expected behavior Page size applies to current page, not next page.
Screenshots
System (please complete the following information):
Additional context Add any other context about the problem here.