We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Absolute Position Formatted Textbox on a PDF Document

I need help adding an Absolute Position Formatted Textbox on the first page of an existing PDF Document. This is what I have so far but it does not work. Any ideas… I

public void InsertBlurb( Document doc )
{
Page page = doc.Pages[1];

        FloatingBox box = new Aspose.Pdf.FloatingBox();
        box.Top    = blurbConfig.top - 80 ;
        box.Left   = blurbConfig.left - 80;
        box.Height = blurbConfig.height;
        box.Width  = blurbConfig.width; 
        box.HorizontalAlignment = HorizontalAlignment.Left;
        box.VerticalAlignment  = VerticalAlignment.Top;
        box.BackgroundColor = Aspose.Pdf.Color.FromRgb( System.Drawing.Color.White );  
        box.ZIndex = 10;
        box.Border = new BorderInfo(BorderSide.Box);    
        box.Margin = new MarginInfo(0,0,0,0);            

        string blurb = "<p>A couple paragraphs with <b>bold</b> and <i>italic</i><p>";
        HtmlFragment blurbFragment = new HtmlFragment( blurb );
        blurbFragment.Margin = new MarginInfo(0, 0, 0, 0);
        blurbFragment.TextState = new TextState();
        blurbFragment.TextState.Font = FontRepository.FindFont("Arial");
        blurbFragment.TextState.FontSize = 10;
        blurbFragment.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb( System.Drawing.Color.Black ); 
         
         box.Paragraphs.Add(blurbFragment);
         page.Paragraphs.Add(box);

}

@Toberville

Thanks for contacting support.

Would you kindly share your sample PDF document along with an expected document or screenshot of where you want to place a text over page. We will try to prepare code snippet accordingly and share with you.