spadged / alivepdf

Automatically exported from code.google.com/p/alivepdf
0 stars 0 forks source link

Enhancement - added first pass at multi-column text #270

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, 
I added support for multi-column text. 
I overode PDF to do it - I've attached the file.

Usage Example:

pdf = new multiColumnPDF(Orientation.PORTRAIT, Unit.POINT, true, Size.LETTER);

pdf.addPage();
pdf.setMargins(HORIZONTAL_MARGIN,VERTICAL_MARGIN,HORIZONTAL_MARGIN,VERTICAL_MARG
IN );

//you must set autopagebreak with a value if you want to explicitly set a 
bottom margin of anything other than the default       
pdf.setAutoPageBreak(true, HORIZONTAL_MARGIN );

//store the current y value - you need it when you generate a second and 
subsequent columns
pdf.storedY = pdf.getY();

//set up for multicolumn output
pdf.storedMarginLeft = pdf.getMargins().x;
pdf.storedMarginTop = pdf.getMargins().y;
pdf.numberOfColumns = 2;

pdf.addMultiCell( 250 , 13, 
"myTextThatIsn'tLongButReallyShouldBeForThisExample", 0,  Align.LEFT );

pdf.addMultiCell( 250 , 13, "someMoreTextThatWillAlsoBeColumnized", 0,  
Align.LEFT );

//call this if you want to reset everything:
pdf.setCol(0);

Original issue reported on code.google.com by rap...@gmail.com on 9 Aug 2010 at 3:28

Attachments: