Font problem

View: New views
2 Messages — Rating Filter:   Alert me  

Font problem

by Suheb Ahmad :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all,

I am trying to create a pdf file from an image and setting a hidden text behind the image at defined location.
All things are working well but the font does not appears good.

i am using following code:-

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.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();


The font i passed in chunk 'Times New Roman'  but when i copy the text from the pdf file and paste it in Microsoft Word it shows the font 'TimesNewRomanPSMT' while the font size and color are same as i passed in chunk.

Can some one tell me where i made mistake.  

Thanks in Advance

Suheb Ahmad
Suheb Ahmad
-------------
New Delhi

Re: Font problem

by raj231362 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


use BaseFont.NOT_EMBEDDED

Suheb Ahmad wrote:
Dear all,

I am trying to create a pdf file from an image and setting a hidden text behind the image at defined location.
All things are working well but the font does not appears good.

i am using following code:-

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.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();


The font i passed in chunk 'Times New Roman'  but when i copy the text from the pdf file and paste it in Microsoft Word it shows the font 'TimesNewRomanPSMT' while the font size and color are same as i passed in chunk.

Can some one tell me where i made mistake.  

Thanks in Advance

Suheb Ahmad