1

I have to create a pdf file for a bill which can be very long, and I do not want any page break in side my printed bill.

I create a document using iText v5.5.5 library in java:

Document document = new Document(PageSize.LETTER, 3f, 3f, 0f, 0f);

So how can I create a document which has pagesize is very long which can contain full bill?

Or no space between pages is also fine for me, eventhough, I set marginTop | Bottom = 0, but not help.

Hong Nguyen
  • 403
  • 3
  • 14
  • Thank you for your answer, but I cannot calculate heigth of a page, it is dynamically. PageSize.LETTER is just my current code, it can be replace by whatever works. – Hong Nguyen Sep 29 '15 at 11:37
  • You allegation *I cannot calculate height of a page* is a personal statement. It isn't true in general. When you create content dynamically in a `ColumnText`, then you can always ask the `ColumnText` for its height. – Bruno Lowagie Sep 29 '15 at 11:52
  • In Bruno's example, he wrote that Rectangle pagesize = new Rectangle(width, max - y); Why max - y but not just y? – Hong Nguyen Sep 30 '15 at 03:09
  • You have a bottle with 1 liter of water (`max`). You give it to your friend and he returns it with only a quarter of a liter (`y`). How much water did your friend drink? Did he drink a quarter of a liter (`y`)? Or did he drink three quarters of a liter (`max - y`)? Using what I've learned in primary school, I would answer "three quarters of a liter" :D – Bruno Lowagie Sep 30 '15 at 06:40

0 Answers0