Using the font Courier might help. You'll also have to expand the tabs
to spaces and it's also a good idea to replace the spaces for \u00a0. 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of vishal shah
> Sent: Wednesday, March 16, 2005 9:33 AM
> To: [email protected]
> Subject: [iText-questions] unable to manage spacing & 
> alignment while creating PDF from text file
> 
> Dear Sir
> 
> We've application that creates a report in text format.
> 
> from that text report i'm creating PDF copy of that.
> 
> But to my surprise it is not keeping same spacing & alignment 
> as text format.
> 
> can you give me a solution for that ?
> 
> below is my present working - code
> 
> regards 
> 
> vishal r shah
> 
> --------------------------------------------------------------
> -------------------------
> 
> public void convert(String pdfDoc,String txtDoc) throws Exception
>  {
>   this.pdfDoc=pdfDoc;//+".pdf";
>   this.txtDoc=txtDoc;//+".txt";
>   Document document = new Document(PageSize.A4, 50, 50, 50, 50);
>   //try {
>   System.out.println("In convert...");
>   // creation of the different writers
>   //HtmlWriter.getInstance(document, System.out);
>   PdfWriter.getInstance(document, new FileOutputStream(this.pdfDoc));
>   System.out.println("pdf object ...");
>   // we add some meta information to the document
>   document.addAuthor("vishal r shah");
>   document.addSubject("Report");
> 
>   // we define a header and a footer
>   HeaderFooter header = new HeaderFooter(new Phrase("This is a
> header."), false);
>   HeaderFooter footer = new HeaderFooter(new Phrase("This is page "),
> new Phrase("."));
>   footer.setAlignment(Element.ALIGN_CENTER);
>   document.setHeader(header);
>   document.setFooter(footer);
>   
>   //document.marginMirroring=true;
>   // we open the document for writing
>   document.open();
>   System.out.println("header footer created...");
>   BufferedReader br = new BufferedReader(new FileReader(this.txtDoc));
>   String strLine="";
>   while((strLine=br.readLine()) != null)
>   {
>    document.add(new Paragraph(strLine));
>    //System.out.println("Read Line : "+(i+1));
>   }
>   System.out.println("going to close...");
>   br.close();
>   document.close();
>   System.out.println("pdf created...");
>    //}catch(Exception e) {System.err.println(e.getMessage());}
>    
>  }
> 
> -- 
> Regards,
> 
> Vishal R Shah
> Senior Software Engineer,
> Starnet Software (I) Ltd.
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from 
> real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to