I'm developing a quotation generating system which output a PDF created using itextpdf library. I'm printing these data using x,y positions.It works fine when data to be print fit the page. But when it exceed the size of the page it's not creating another page and write them to page. How to fix this ?
Asked
Active
Viewed 231 times
0
-
2Did you use `document.newPage()` to create a new page? – Bruno Lowagie Apr 21 '16 at 12:50
-
the problem is how can I know when it's exceed the page size ? I'm taking about dynamic data. when data to be print cannot fit inside the page it's it simply print the data which can fit inside page and ignore the rest. – Chathuranga Shan Jayarathna Apr 21 '16 at 13:30
-
A page has dimensions. For instance: all coordinates outside a rectangle with lower-left corner 0, 0 and upper-right corner 595, 842 won't fit the page. What is there to fix? How do you keep track of the coordinates? Why don't you create a page defining a size in a way that all the content fits? – Bruno Lowagie Apr 21 '16 at 13:37
-
well, I think I'm missing something. Is there any better way to print a document other than using positions ? my document has images, table, paragraphs other string data. please let me know if there's a better way to create this document. This is the first time I'm using this library. – Chathuranga Shan Jayarathna Apr 21 '16 at 13:52
-
@ChathurangaShanJayarathna *Is there any better way to print a document other than using positions?* - yes, by abstractly defining paragraphs, tables, images and letting some layouting API do the rest. – mkl Apr 22 '16 at 08:57
-
Have you read any of the documentation? http://developers.itextpdf.com has many examples. Unfortunately, it's not clear what you're asking. Adding content at absolute positions is difficult. iText allows you to add content in a much easier way. – Bruno Lowagie Apr 22 '16 at 10:54
1 Answers
0
You can use fonction to know the size of page :
document.getPageSize().getWidth();
document.getPageSize().getHeight();

Louis Zwawiak
- 55
- 10