Hello,

I'm creating a PDF document with a PdfTemplate. Everything works well except
that the font used in the PdfTemplate is displayed ugly within Acrobat. The
document prints correctly however. Also, when I add text to the document
with the same font as is used within the template, this is also displayed
ugly. Other fonts are displayed correctly. The following code summaries my
situation:

Document doc = new Document();
PdfWriter writer = PdfWriter.GetInstance(doc, os);
writer.PdfVersion = PdfWriter.VERSION_1_5;
writer.ViewerPreferences = PdfWriter.PrintScalingNone;
writer.PageEvent = new Listener();

doc.Open();
document.Add(new Paragraph(20, "ander font"));
document.Add(new Paragraph(20, "template font", font)); // georgia font from
the template
doc.Close();

class Listener : PdfPageEventHelper
{
  PdfImportedPage page;

  public override void OnOpenDocument(PdfWriter writer, Document document)
  {
    PdfReader reader = new PdfReader("template.pdf"); // a pdf document
containing georgia font
    page = writer.GetImportedPage(reader, 1);    
  }

  public override void OnEndPage(PdfWriter writer, Document document)
  {
    PdfContentByte cb = writer.DirectContent;
    cb.AddTemplate(page);
  }
}

I've attached two documents: one with the PdfTemplate and one without (with
the writer.PageEvent commented). This to show the actual problem...

Does anybody knows why the font that is used within the template is not
displayed correctly? Can this be solved within iText or is this perhaps an
Acrobat problem?

As you can see I'm using iTextSharp, version 5.0.1.1. I'm also using Acrobat
Professional, version 9.3.2.


Thanks in advance, Fons

http://n4.nabble.com/file/n2173792/without_template.pdf without_template.pdf 
http://n4.nabble.com/file/n2173792/with_template.pdf with_template.pdf 
-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Font-problem-when-viewing-pdf-with-PdfTemplate-s-tp2173792p2173792.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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