Hi ,

 I am creating a simple PDF document and my document
runs into 10 pages. I am using font size 8 and I want
the space between the lines as 8. With the code given
here ,
  the first page looks better with only 8 as leading
value but all other pages from 2 to 10 are defaulting
to 8x1.5=12 leading. What's wrong with this code ?

 
public ByteArrayOutputStream toPdf(StringBuffer
inBuffer, String headerBuffer, String footerBuffer,
String legendBuffer,boolean landscape)
    {
        //StringBuffer outBuffer = new StringBuffer();
        ByteArrayOutputStream outputStream = new
ByteArrayOutputStream();
        
                // creation of the document with a certain size and
certain margins
                Document document = null;
                if (landscape) {                
                    document = new
Document(PageSize.LETTER.rotate(), 5, 5, 5, 5);
                } else {
                    document = new Document(PageSize.LETTER, 50, 50,
50, 50);
                }

                try {
                        // creation of the different writers
                        //PdfWriter.getInstance(document, new
FileOutputStream("text.pdf"));
                        PdfWriter.getInstance(document, outputStream);
                        
                        // Use courier font             
                        Font standardFont = new Font(Font.COURIER, 8,
Font.NORMAL, new Color(0, 0, 0));
                        
                        
                         // we add a Header that will show up on PAGE 1
            HeaderFooter header = new HeaderFooter(new
Phrase(headerBuffer), false);
            document.setHeader(header);
                          
                        // we add a Footer that will show up on PAGE 2
            HeaderFooter footer = new HeaderFooter(new
Phrase(footerBuffer), true);
            document.setFooter(footer);        
                                
                        // Open the document for writing
                        document.open();
                        
                        // Create a paragraph with our input StringBuffer       

                        Paragraph paragraph = new Paragraph(8,
inBuffer.toString(), standardFont);             
                        document.add(paragraph);                    
                        
                        // we reset the page numbering
            document.resetPageCount();
            // we trigger a page break
            document.newPage();
             // we add some more content
            document.add(new
Paragraph(legendBuffer,standardFont));
            
                }
        //      catch(DocumentException e) {
                    catch(Exception e) {
                    // We need to actually throw this message up ...
                        System.err.println(e.getMessage());
                }
       
                // Close the document
                document.close();
                
                return outputStream;
    }
    
 

 Thanks,
bala




__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com


-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to