Print Page | Close Window

Create Table Exactly Like This Sample!

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1907
Printed Date: 02 May 24 at 3:42AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Create Table Exactly Like This Sample!
Posted By: m_alam
Subject: Create Table Exactly Like This Sample!
Date Posted: 02 Aug 11 at 7:21PM
please anyone help me out..

i am very new to quick pdf, and don't know anything about table structure..

please checkout the following link:

http://www.mediafire.com/?5sjp178q4jplr66

i like to create same pdf using quick pdf library. I use Acrobat Professional To convert the doc to that pdf, but i like to use quick pdf to make that pdf..

hope i am clear?

please any one help me out asap

best regards
kamrul hassan



Replies:
Posted By: Rowan
Date Posted: 08 Aug 11 at 3:17PM
Quick PDF Library can certainly create a table like the one in that PDF. Here's some sample code written in JScript, from the Quick PDF Library Demo, which should be fairly easy to convert to your programming language.

You will need to make some changes to it so that it exactly does what you want it to, but the basic building blocks are here and should be easy to configure.

/* Create a table and draw it on a PDF */

// Set the page size of the new document

QP.SetPageSize("Letter");

// Create the table and specify the number of rows and columns

tableID = QP.CreateTable(5, 5);

// Specify color and width of borders   

QP.SetTableBorderColor(tableID, 0, 0.3, 0.204, 0);
QP.SetTableBorderWidth(tableID, 0, 0.2);

// Specify table row height and table column width

QP.SetTableRowHeight(tableID, 1, 5, 0);
QP.SetTableColumnWidth(tableID, 1, 5, 100);

// Specify a background color for the column headers

QP.SetTableCellBackgroundColor(tableID, 1, 1, 1, 5, 0.3, 0.7, 1.0);
QP.SetTableCellAlignment(tableID, 1, 1, 1, 5, 4);

// Setup the column headers and content for the first row

QP.SetTableCellContent(tableID, 1, 1, "<b>This Week</b>");
QP.SetTableCellContent(tableID, 1, 2, "<b>Last Week</b>");
QP.SetTableCellContent(tableID, 1, 3, "<b>Artist Name</b>");
QP.SetTableCellContent(tableID, 1, 4, "<b>Peak</b>");
QP.SetTableCellContent(tableID, 1, 5, "<b>Weeks On</b>");

// Insert the content for the second row

QP.SetTableCellContent(tableID, 2, 1, "1");
QP.SetTableCellContent(tableID, 2, 2, "1");
QP.SetTableCellContent(tableID, 2, 3, "<b>The Black Eyed Peas</b><br>Boom Boom Pow");
QP.SetTableCellContent(tableID, 2, 4, "<b>1</b>");
QP.SetTableCellContent(tableID, 2, 5, "<b>11</b>");

// Insert the content for the third row

QP.SetTableCellContent(tableID, 3, 1, "2");
QP.SetTableCellContent(tableID, 3, 2, "3");
QP.SetTableCellContent(tableID, 3, 3, "<b>Missy Higgins</b><br>Life is a rainbow");
QP.SetTableCellContent(tableID, 3, 4, "<b>2</b>");
QP.SetTableCellContent(tableID, 3, 5, "<b>8</b>");

// Insert the content for the fourth row

QP.SetTableCellContent(tableID, 4, 1, "3");
QP.SetTableCellContent(tableID, 4, 2, "2");
QP.SetTableCellContent(tableID, 4, 3, "<b>Silverchair</b><br>The Door");
QP.SetTableCellContent(tableID, 4, 4, "<b>3</b>");
QP.SetTableCellContent(tableID, 4, 5, "<b>7</b>");

// Insert the content for the fourth row

QP.SetTableCellContent(tableID, 5, 1, "4");
QP.SetTableCellContent(tableID, 5, 2, "4");
QP.SetTableCellContent(tableID, 5, 3, "<b>Rolling Stones</b><br>Sweet Virginia");
QP.SetTableCellContent(tableID, 5, 4, "<b>4</b>");
QP.SetTableCellContent(tableID, 5, 5, "<b>19</b>");

// Draw the table onto the document

QP.SetOrigin(1);
QP.DrawTableRows(tableID, 50, 50, 400, 1, 0);

// Save the document to disk

QP.SaveToFile("table.pdf");


Posted By: m_alam
Date Posted: 08 Aug 11 at 7:40PM
thanks for your reply sir,

but i am sorry to say, this is totally .................. not i asked for..  L

i told, i know how to create simple PDF table, but i ask for complex pdf table..

i used pdf in-the-box library, that library almost support all feature i want in a table, just only it can't handle complex symbol, just simple symbol...

but in your example there is no trace of symbol, auto resize cell height, justify (alignment)

so? Does that mean those  are not possible in QPDF or you didn't check my mentioned PDF yet?

please sir, leave a reply and let me know ASAP

best regards


Posted By: Rowan
Date Posted: 08 Aug 11 at 10:22PM
From your first question it sounded like you were talking about table structure, rather than table content.

With the table functions you can actually use a subset of HTML tags for the formatting of the content. The HTML tags which are available for use are shown here:

http://www.quickpdflibrary.com/help/quickpdf/AppendixA.php - http://www.quickpdflibrary.com/help/quickpdf/AppendixA.php

This enables you to add superscript or subscript text and set the alignment of text. Symbols can be added to the content of the table so long as the relevant fonts have also been added to the PDF which the symbols will use.

It is not possible to auto size row height to fit the text. You must calculate the height of the text and set the row height in advance.

I hope this helps.


Posted By: m_alam
Date Posted: 08 Aug 11 at 10:42PM
thanks again for your first reply.. but some example will help me a lot.. specially the symbol case..

for example how i can add sybol along with other text, for example :
"the quick brown box <symbolHere> jumps over the lazy<subscriptHere> dog?"

beat regards




Posted By: m_alam
Date Posted: 13 Sep 11 at 1:52PM
no reply yet? :(

please just let me know is it possible or not :(

for example.. please convert/use the following HTML code in PDF.. :

<p class=MsoNormal><span style='font-family:Georgia'>is it a symbol, &#1048;</span>
  <span style='font-family:Symbol;mso-ascii-font-family:"Times New Roman";
  mso-hansi-font-family:"Times New Roman";mso-char-type:symbol;mso-symbol-font-family:
  Symbol'><span style='mso-char-type:symbol;mso-symbol-font-family:Symbol'>b</span></span>
  <span style='font-family:Symbol;mso-ascii-font-family:"Times New Roman";
  mso-hansi-font-family:"Times New Roman";mso-char-type:symbol;mso-symbol-font-family:
  Symbol'><span style='mso-char-type:symbol;mso-symbol-font-family:Symbol'>v</span></span>
  <span class=SpellE>i</span> think so <span style='font-family:Symbol;
  mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:"Times New Roman";
  mso-char-type:symbol;mso-symbol-font-family:Symbol'><span style='mso-char-type:
  symbol;mso-symbol-font-family:Symbol'>µ</span></span> <span style='font-family:
  Symbol;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:"Times New Roman";
  mso-char-type:symbol;mso-symbol-font-family:Symbol'><span style='mso-char-type:
  symbol;mso-symbol-font-family:Symbol'>Å</span></span> <span style='font-family:
  Georgia'>&#8776; why &#8540; &#8706;</span></p>


i am using qpdf 7.26

please some on reply asap .. as i am stuck on this for long time :(

best regards


Posted By: m_alam
Date Posted: 19 Feb 13 at 11:21AM

hi,  Greetings every one..

once again I m working on a project where I need to manipulate.. table
so, I got few question.
1. I notice to print/draw the table I need to specify the height.. but how I can know the exact height of all the rows? because my table generate different data each time. so, each there any way to know the height of table so, it will draw the full content of the table?

2. how to set table text font/size/bold/italic etc? because I notice setTextSize don’t work on table content/text..

for now it’s all .. will come with more question as needed :)

best regards



Posted By: Aly
Date Posted: 12 Mar 13 at 4:43PM
You need to look at the HTML text functions. There are functions for setting the bold, italic font etc for use with HTML text. Then you use the appropriate html tags when setting the table cell contents. This will let you draw the cells with what ever font and style you wish. Under the HTML functions you will also find the functions required to work out the height your table will be.

Working out the size of a table is trivial but can be tedious if you then want to do any type of autosizing yourself. I do this myself, so it is possible, just takes a bit of work and reading of the reference guide!

Aly



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk