Welcome Guest Search | Active Topics | Sign In | Register

Adding text with differing fonts to the text layer Options
SarahH
Posted: Friday, May 4, 2012 11:21:12 AM
Rank: Newbie
Groups: Member

Joined: 5/4/2012
Posts: 6
Apologies if this has been asked elsewhere.

I am using html2pdf and have created a pdf from my html and I'd like to add extra text to the page using the text layer. I'm adding 2 layers because I want them to have different fonts & collours but for some reason, even with one layer, I can't get the font to set to what I've asked for. I'm using an On_AfterRenderPage method as follows:

Code: C#
private static void On_AfterRenderPage(object sender, EO.Pdf.PdfPageEventArgs e)
        {
            
            //Create a new text layer
            EO.Pdf.Contents.PdfTextLayer textLayer1 = new EO.Pdf.Contents.PdfTextLayer();
            textLayer1.Font = new EO.Pdf.Drawing.PdfFont("Arial", 12);
            textLayer1.NonStrokingColor = Color.Gray;


            //Create a new text layer
            EO.Pdf.Contents.PdfTextLayer textLayer2 = new EO.Pdf.Contents.PdfTextLayer();
            textLayer2.Font = new EO.Pdf.Drawing.PdfFont("Arial", 8);
            textLayer2.NonStrokingColor = Color.Black;
                       
           
            //Create the text object
            EO.Pdf.Contents.PdfTextContent textContent1 = new EO.Pdf.Contents.PdfTextContent("Text 1l");
            textContent1.PositionMode = EO.Pdf.Contents.PdfTextPositionMode.Matrix;
            textContent1.GfxMatrix.Translate(44, 28);

                      
            //Create the text object
            EO.Pdf.Contents.PdfTextContent textContent2 = new EO.Pdf.Contents.PdfTextContent("text 2");
            textContent2.PositionMode = EO.Pdf.Contents.PdfTextPositionMode.Matrix;
            textContent2.GfxMatrix.Translate(265,28);

            //Add the text object into the text layer object
            textLayer1.Contents.Add(textContent1);
            textLayer2.Contents.Add(textContent2);

            //Add the text layers onto the page
            e.Page.Contents.Add(textLayer1);
            e.Page.Contents.Add(textLayer2);
        }


The text has no issue displaying or changing colour using the NonStrokingColor variable but for some reason the font request is being ignored. Can you advise me where I may have gone wrong?

Thanks!
Sarah
eo_support
Posted: Friday, May 4, 2012 12:21:22 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

This is a bug. We have just posted a new build that should fix this problem. Please see your private message for the download location.

Thanks!
SarahH
Posted: Tuesday, May 8, 2012 7:43:10 AM
Rank: Newbie
Groups: Member

Joined: 5/4/2012
Posts: 6
Thanks - this has sorted the issue!

Sarah


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.