Dear All,

I have some images which were converted into xml files and searchable PDF
files using some OCR engine. But latter on I found that there are some
spelling mistakes and a few words are missing in the xml file and also in
searchable PDF file.

The PDF file is a searchable PDF (text behind image) file and the xml file
contains all the details of the OCR having the information about the region
coordinate, text, font details and color information.

I am using ItextSharp to create a pdf using the image and xml file. I have
done it but there is a problem with text.

The text added in pdf using chunk does not fit in the rectangle some words
displayed incorrectly like 'Times' is written as 'sTime'. I have tried
chunk.HorizontalScaling(0.72f) but it resize the text and rectangle also so
problem remain same.

I am using following code:

PdfContentByte cb = writer.DirectContentUnder;
ColumnText ct = new ColumnText(cb);

FontFactory.RegisterDirectory(@"C:\WINDOWS\fonts"); 
FontFactory.RegisterDirectory(@"C:\WINDOWS\fonts\Arial.ttf"); 
FontFactory.RegisterDirectory(@"C:\WINDOWS\fonts\Times New Roman.ttf"); 

chunk = new Chunk("New Zealand Trained Nurses' Association",
FontFactory.GetFont("Times New Roman", "Cp1252", BaseFont.EMBEDDED, 20, 0,
iTextSharp.text.Color.RED)); 
chunk.HorizontalScaling(0.72f);
chunk.SetTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_FILL, 0,
iTextSharp.text.Color.MAGENTA); 
rect = new iTextSharp.text.Rectangle(184, 1063, 376, 1063); 
ct.SetSimpleColumn(rect.Left, rect.Bottom, rect.Right, rect.Top, 0, 0); 
ct.AddText(chunk); 
ct.Go(); 


How can i use the scaling in the text so that text can be fitted in
rectangle without changing the font size?

Thanks & Regards 
Suheb Ahmad


-----
Suheb Ahmad
-------------
New Delhi
-- 
View this message in context: 
http://www.nabble.com/Text-Scaling-in-ItextSharp-tp25819217p25819217.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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