TextOut() public method

public TextOut ( float xpos, float ypos, string text ) : void
xpos float
ypos float
text string
return void
Example #1
0
    private static void ShowDescription (HPdfPage page, float x, float y,
            string text) {
        float fsize = page.GetCurrentFontSize();
        HPdfFont font = page.GetCurrentFont();
        HPdfRGBColor c = page.GetRGBFill();

        page.BeginText();
        page.SetRGBFill(0, 0, 0);
        page.SetTextRenderingMode(HPdfTextRenderingMode.HPDF_FILL);
        page.SetFontAndSize(font, 10);
        page.TextOut(x, y - 12, text);
        page.EndText();

        page.SetFontAndSize(font, fsize);
        page.SetRGBFill(c.r, c.g, c.b);
    }
 private static void PrintPage (HPdfPage page, string caption, HPdfFont font,
         HPdfTransitionStyle type, HPdfPage prev, HPdfPage next) {
     float r = (float)rand.Next(255) / 255;
     float g = (float)rand.Next(255) / 255;
     float b = (float)rand.Next(255) / 255;
     HPdfRect rect;
     HPdfDestination dst;
     HPdfAnnotation annot;
 
     page.SetWidth (800);
     page.SetHeight (600);
 
     page.SetRGBFill (r, g, b);
 
     page.Rectangle ( 0, 0, 800, 600);
     page.Fill ();
 
     page.SetRGBFill (1.0f - r, 1.0f - g, 1.0f - b);
 
     page.SetFontAndSize (font, 30);
 
     page.BeginText ();
     page.SetTextMatrix (0.8f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);   
     page.TextOut (50, 530, caption);
 
     page.SetTextMatrix (1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);   
     page.SetFontAndSize (font, 20);
     page.TextOut (55, 300, 
             "Type \"Ctrl+L\" in order to return from full screen mode.");
     page.EndText ();
 
     page.SetSlideShow (type, 5.0f, 1.0f);
 
     page.SetFontAndSize (font, 20);
 
     if (next != null) {
         page.BeginText ();
         page.TextOut (680, 50, "Next=>");
         page.EndText ();
 
         rect.left = 680;
         rect.right = 750;
         rect.top = 70;
         rect.bottom = 50;
         dst = next.CreateDestination();
         dst.SetFit();
         annot = page.CreateLinkAnnot (rect, dst);
         annot.SetBorderStyle (0, 0, 0);
         annot.SetHighlightMode (HPdfAnnotHighlightMode.HPDF_ANNOT_INVERT_BOX);
     } 
 
     if (prev != null) {
         page.BeginText ();
         page.TextOut (50, 50, "<=Prev");
         page.EndText ();
 
         rect.left = 50;
         rect.right = 110;
         rect.top = 70;
         rect.bottom = 50;
         dst = prev.CreateDestination();
         dst.SetFit();
         annot = page.CreateLinkAnnot (rect, dst);
         annot.SetBorderStyle (0, 0, 0);
         annot.SetHighlightMode (HPdfAnnotHighlightMode.HPDF_ANNOT_INVERT_BOX);
     }
 }