Hi

I have successfully created a class which creates a PDF-document with many
pages where each page has two columns with both text and images. This I have
achieved by looking at the various examples found at http://itextpdf.com/ .
I know have just one big issue which I have not figured out how to solve,
neither have I been able to find any examples showing something similar (as
I have been aware of at least...)

I am creating a PDF-document of my blog, writing each post one by one. The
problem is when one of the posts have so much content that it exceeds the
current column. The text will just disappear. I am not aware of any methods
in class ColumnText that tells me that I now have to much text.
.getLinesWritten will not help me since I also have pictures. Would I need
to summarize the height of my text and images in order to know if I need to
continue on the next column?

Here is the code snippet that I use to print the content to the PDF

             for (BloggPost blogpost : poster) {
                // Verify if enough space
                y = ct.getYLine();
                addContent(ct, blogpost);
                status = ct.go(true);

                // Need a new column?
                if (ColumnText.hasMoreText(status)) {
                    column = (column + 1) % 2;
                    // Need a new page?
                    if (column == 0) {
                        document.newPage();
                        // Draw a line between the columns
                        drawColumnlines(writer);
                    }
                    // Create the colum
                    ct.setSimpleColumn(COLUMNS[column][0],
COLUMNS[column][1],
                            COLUMNS[column][2], COLUMNS[column][3]);
                    y = COLUMNS[column][3];
                }
                // Reset and write the content to the PDF
                ct.setYLine(y);
                ct.setText(null);
                addContent(ct, blogpost);
                status = ct.go();

(...looking forward to the release of the new book later this year :-) )

In advance

Rune

-- 
****************************************************
Bored? Check out http://hellem.org/blog
****************************************************
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to