It's a strange way of doing layout in a PDF:)
But I think there are no extra lines added. The lines you speak of have
one whitespace more then others in your txt file. ( just like the line
ELI A GREEN 1842 BLACK/DK PEWTER 04/16/01 21 03/03/05 )
Remove the trailingspaces in the txt and you should achieve the result
you want.
On 2/09/2011 16:34, Barry Dysert wrote:
I'm converting a plain, vanilla text file (attached) to a pdf (also
attached). The problem is that there is too much white space between
the lines in the pdf. There are no extra blank lines in the text file
-- lines are just separated by a crlf. (I'm speaking in particular of
lines 11-16, i.e., "POWER WINDOWS" thru "BRAKE CONCERN".) How can I
remove the white space between these lines so that they're closer
together? Here's the code I'm using:
string txtfile = @"C:\Temp\00002RX06I00QL_sanitized.txt";
string outfile = @"C:\Temp\Text.pdf";
string txtcontent = File.ReadAllText(txtfile);
Document document = new Document(new iTextSharp.text.Rectangle(72 *
8.5f, 72 * 17f), 0, 0, 0, 0);
PdfWriter.GetInstance(document, new FileStream(outfile, FileMode.Create));
document.Open();
Paragraph par = new Paragraph(txtcontent,
FontFactory.GetFont(FontFactory.COURIER, 8, iTextSharp.text.Font.NORMAL));
document.Add(par);
document.Close();
Thanks!
-----------------
Barry Dysert
[email protected]
Regards
--
twitter <http://twitter.com/redlabbe>
redlab-log <http://www.redlab.be/blog/>
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php