1. Home
  2. Foxit Quick PDF Library
  3. How to Insert a Table into PDF

How to Insert a Table into PDF

Creating tables with text formatted using standard HTML tags is straightforward using Foxit Quick PDF Library. After positioning and creating the table, set the default HTML styles for the specific HTML tags to be used for formatting, then the content can added using the SetTableCellContent function.

Some sample Delphi code for creating and formatting a PDF table appears below:

// * Create a PDF table with HTML text formatting */
 
// Set top-left origin
QP.SetOrigin(1);
 
// Create table, set default HTML text styles and add content
id = QP.CreateTable(1, 6);
QP.SetHTMLNormalFont("Default", QP.AddTrueTypeFont("Arial", 0));
QP.SetHTMLBoldFont("Default", QP.AddTrueTypeFont("Arial [Bold]", 0));
QP.SetHTMLItalicFont("Default", QP.AddTrueTypeFont("Arial [Italic]", 0));
QP.SetHTMLBoldItalicFont("Default", QP.AddTrueTypeFont("Arial [BoldItalic]", 0));
QP.SetTableColumnWidth(id, 1, 6, 72);
QP.SetTableCellContent(id, 1, 1, "<b>My Text</b>
Normal Text");
QP.DrawTableRows(id, 36, 36, QP.PageHeight() - 72, 1, 0);
 
// Save the new document to disk
QP.SaveToFile("Table.pdf");
Updated on April 10, 2017

Was this article helpful?

Related Articles

Ready to try Foxit PDF SDK?
Click the link below to download your trial
Free Trial