473,405 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Table problem with iText.

dmjpro
2,476 2GB
I think iText commonly used to create or manipulate PDF document in Java.
So finally i decided to throw a question over here. For two days i am struggling.

I encountered two types of table ..
1>Table: table can be easily created with row span or col span but still has a problem with vertical alignment of cell content.
2>PdfPTable: table can be easily created by col span but having a bit complex with row span. But it offers well vertical alignment of cell content.

Finally i decided to design the table with Table Class. Because what i am having the cells(with row span and col span), it's quite tough to draw the table with PdfPTable. With Table class it's easy to draw. But still struggling with vertcal alignment.
I think who already familiar to iText can solve my problem.

If you can, you can have a look at my HTML.
Run this stand-alone you will get the HTML view of which i am trying to design in PDF.
My code goes here...

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  4.    "http://www.w3.org/TR/html4/loose.dtd">
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13. <html>
  14.     <head>
  15.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  16.         <title>Time Table View</title>
  17.         <link rel="Stylesheet" href="./style1.css"/>
  18.     </head>
  19.  
  20.     <body>
  21.  
  22.                 <table border="1" cellpadding="5" cellspacing="5" style="background-color:#CCCCCC">
  23.                     <tr><td class=tableheader>Day Name</td>
  24.             <TD class=tableheader>7:30:AM-8:25:AM</TD>
  25. <TD class=tableheader>8:30:AM-9:25:AM</TD>
  26. <TD class=tableheader>9:30:AM-10:25:AM</TD>
  27. <TD class=tableheader>10:30:AM-11:25:AM</TD>
  28. <TD class=tableheader>11:30:AM-0:25:PM</TD>
  29.  
  30. <TD class=tableheader>1:30:PM-2:25:PM</TD>
  31. <TD class=tableheader>2:30:PM-3:25:PM</TD>
  32. <TD class=tableheader>3:30:PM-4:25:PM</TD>
  33. <TD class=tableheader>4:30:PM-5:25:PM</TD>
  34. </TR>
  35. <TR>
  36. <TD style='background-color:#0FAA8B' rowspan=5 colspan=1 >Monday</TD>
  37. <TD rowspan=1 colspan=1 style='background-color:#66CCFF' >IM21003/C4</TD>
  38. <TD rowspan=5 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  39. <TD rowspan=5 colspan=1 style='background-color:#66CCFF' >ME30604/C3</TD>
  40.  
  41. <TD rowspan=5 colspan=1 style='background-color:#66CCFF' >ME30604/F127</TD>
  42. <TD rowspan=5 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  43. <TD rowspan=5 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  44. <TD rowspan=5 colspan=1 style='background-color:#66CCFF' >IM41008/F116</TD>
  45. <TD rowspan=5 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  46. <TD rowspan=5 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  47. </TR>
  48. <TR>
  49. <TD rowspan=1 colspan=1 style='background-color:#66CCFF' >IM57002/C3</TD>
  50. </TR>
  51. <TR>
  52. <TD rowspan=1 colspan=1 style='background-color:#66CCFF' >ME30604/C3</TD>
  53. </TR>
  54.  
  55. <TR>
  56. <TD rowspan=1 colspan=1 style='background-color:#66CCFF' >IM57002/C3</TD>
  57. </TR>
  58. <TR>
  59. <TD rowspan=1 colspan=2 style='background-color:#66CCFF' >IM57002/C3</TD>
  60. </TR>
  61. <TR>
  62. <TD style='background-color:#0FAA8B' rowspan=2 colspan=1 >Tuesday</TD>
  63. <TD rowspan=2 colspan=1 style='background-color:#66CCFF' >ME30604/F127</TD>
  64. <TD rowspan=2 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  65. <TD rowspan=2 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  66. <TD rowspan=2 colspan=1 style='background-color:#66CCFF' >IM31006/Computer Lab</TD>
  67.  
  68. <TD rowspan=2 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  69. <TD rowspan=1 colspan=1 style='background-color:#66CCFF' >IM21003/C8</TD>
  70. <TD rowspan=2 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  71. <TD rowspan=2 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  72. <TD rowspan=2 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  73. </TR>
  74. <TR>
  75. <TD rowspan=1 colspan=2 style='background-color:#66CCFF' >IM57002/C3</TD>
  76. </TR>
  77. <TR>
  78. <TD style='background-color:#0FAA8B' rowspan=1 colspan=1 >Wednesday</TD>
  79. <TD rowspan=1 colspan=5 style='background-color:#66CCFF' >ME30604/N</TD>
  80. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  81.  
  82. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  83. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  84. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  85. </TR>
  86. <TR>
  87. <TD style='background-color:#0FAA8B' rowspan=1 colspan=1 >Thurshday</TD>
  88. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  89. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  90. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  91. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  92. <TD rowspan=1 colspan=1 style='background-color:#66CCFF' >ME30604/N</TD>
  93. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  94. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  95. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  96. <TD rowspan=1 colspan=1 style='background-color:#CCCCCC' >&nbsp;</TD>
  97.  
  98. </TR>
  99. <TR>
  100. <TD style='background-color:#0FAA8B'>Friday</TD>
  101. <TD>&nbsp;</TD>
  102. <TD>&nbsp;</TD>
  103. <TD>&nbsp;</TD>
  104. <TD>&nbsp;</TD>
  105. <TD>&nbsp;</TD>
  106. <TD>&nbsp;</TD>
  107. <TD>&nbsp;</TD>
  108. <TD>&nbsp;</TD>
  109. <TD>&nbsp;</TD>
  110. </TR>
  111.  
  112.     </table>
  113.  
  114.     </body>
  115. </html>
  116.  
Jul 10 '09 #1
3 6646
Dököll
2,364 Expert 2GB
@dmjpro
Hey dmjpro!

I am probably not giving what you needed here but I reckon you are trying to print to pdf. I suspect you will be happy with jasper report...

You can do a lot of manipulation with iReport. Here are a couple of links I pulled up that I think may help you further your pdf prints. You will need the iReport software to build your pdf document:

http://www.devx.com/Java/Article/29309/1954

Again, I am not sure if you'll take the bait, but I am convinced you will like this. You simply need to get it to load through your html pages. You can use a servlet to do that:

http://www.cise.ufl.edu/~otopsaka/CI...omServlet.html

You will still need to do some work, but this should get you on your way.

View source on the HTML to fire servlet used to load your report.

By the way, iReport includes iText technology. Have a great week!

Dököll
Jul 13 '09 #2
dmjpro
2,476 2GB
@Dököll
Ah! .... ;)
I forgot to mention that i tried iReport. But iReport takes one query, but my query gives each class details in one row. Then how it is possible?
Jul 13 '09 #3
Dököll
2,364 Expert 2GB
@dmjpro
You need to use Frames then, if I am getting what you are asking. With Frames you can have different queries adding to the same report. There's a fancy video out there on that.

Give that a go!
Jul 15 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Daryl Middleton | last post by:
Can python be used to merge pdf documents into a single pdf file so that I do not have to manually insert each one. Thanks
1
by: Ruchi Dayal | last post by:
Hi, I am using XSL-FO/FOP to generate PDF documents from XSLT. The resultant PDF can run into thousands of pages and this is where the whole problem is. FOP cannot handle such large outputs....
2
by: Ivo | last post by:
I have this code to add a row to a table: var r=document.createElement('tr'); var c=document.createElement('td'); var cn=c.cloneNode(false); cn.className='tdname';...
4
by: Mateo | last post by:
Hi! I have labels on my page (some are web forms controls, and some are plain HTML labels), and I need Mozilla compatibile way for reading label value. For example, in IE I can use this:...
4
by: Elhanan | last post by:
hi.. i'm looking into ways for generating pdf's from xml, at first i thought fo / fop looks nice enough i mean it's standard, it's free and sperates concers, but i'm worried about fop from...
1
by: gaya3 | last post by:
Hi all, Please any one say me.. how to download the iText? Thanks in advance... -Hamsa
0
by: pkombli | last post by:
hi to every one . . i m using itext to create pdf files but m not getting how to connect database to create pdf using itext. .so plz help me
2
by: Toni Pohl | last post by:
Hi, some years ago I´ve implemented an classic ASP form which fills in data from a database into a PD-form. I used the free FDF Toolkit which worked very well. After submitting the PDF the...
2
m6s
by: m6s | last post by:
Good morning. I have a major issue with iText. Major but most of all ridiculous. After the cration of a table like that tbl = new Table(7, dataTbl.Rows.Count);...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.