Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created the pdf using ItextSharp class and it will work fine and i have created html in code file using inline style sheet and its work fine but my converted pdf not look as i would i like to same as my html ,Below i have link where you can see my pdf file and actual html screen shot .
1.http://melisa.aleaitsolutions.co.uk/images/TestReport.pdf[^]
2.http://melisa.aleaitsolutions.co.uk/images/Test1.jpg[^]
3.http://melisa.aleaitsolutions.co.uk/images/Test2.jpg[^]
4.http://melisa.aleaitsolutions.co.uk/images/Test3.jpg[^]
Hope this will work , waiting for answer shortly
Thanks in advance
Posted
Updated 22-Jan-12 21:00pm
v2

1 solution

Congratulations! This is a pretty nice PDF (well, a layout could be a bit better, but you can easily improve it.

Now, you should be be disappointed that your document cannot precisely match the HTML rendering of this information. This is not possible in principle. You should not try to hard to make a perfect match, anyway. These two document formats are build on very different design principles. PDF is like an electronic print version: all rendering is solidly fixed on each sheet of paper. In contrast, HTML is fluid and it does not have any fixed view: it depends on many factors, first of all, the width of the client area of the Web browser window, version of the browser, its rendering defaults (usually, CSS defines only important details of rendering leaving the rest to defaults).

There is also know one-to-one correspondence between structural elements of both formats — HTML is much more logical, it provides pretty good isolation of logical structure from presentation (which is mostly delegated to CSS) and this isolation becomes deeper as the standards develops (compare with HTML5). In contrast, PDF is much more raw rendering standard. I think you know this much better than I do as you recently finished this job.

So, how to solve this problem in practice?


I think all you can do is improvement of the pure design of the document in both formats. This is more of graphical designer work than programming, is more about applied cognitive science. You need to focus of some features common to any format which will catch the human eyes on the level of structure of the document which can make the differences not essential for perception. The best thing to do it is to work at the level of structure of the document. For example, if you have three levels of document section (like h1, h2 and h3 in HTML) make the title of the section recognizable, so the reader could easily recognize what level is that by its features, but not by the detail of the test itself (indents, margins, font, etc. as the perception of the paragraph is more fluid and dependent on the rendering conditions). Also, it's very important to keep the document design simple. You should not use any single decoration, not even a tiny line without well-defined purpose.

Good luck,
—SA
 
Share this answer
 
v2
Comments
sharad_sharma82 23-Jan-12 2:54am    
Thanks SAKryukov for this great focus on these point ,i m posting my html page code and code behind page that will show the and emebed the proper data in with desgin on pdf hope this will mark the idea of my work proper
1.Html Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="melisa.aleaitsolutions.co.uk/" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Melisa Diagnostics</title>
<!-- MASTER STYLESHEET-->
</head>
<body style="font-size: 12px;">
<table style="width: 900px; margin-left: auto; margin-right: auto; height: auto !important;">
<tr>
<td>
<table style="width: 900px; margin-left: auto; margin-right: auto; height: auto !important;"
border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="left" valign="top">
<span style="font-size: 18px; color: #26276d;">Test report</span>
<br />
<span style="font-size: 18px;">[test_no]</span>
</td>
<td valign="top" style="text-align: right">
[Elements]
</td>
</tr>
<tr>
<td width="460" align="left" valign="top">
<span style="font-size: 18px; color: #26276d;">Test report for</span>
<br />
<span style="font-size: 18px;">[PatientName]</span>
</td>
<td width="200" align="left" valign="top">
<span style="font-size: 18px; color: #26276d;">Neg. control</span>
<br />
<span style="font-size: 14px; color: #666666;">[Negcontrol]</span>
</td>
<td align="left" valign="top">
<span style="font-size: 18px; color: #26276d;">Test date</span>
<br />
<span style="font-size: 14px; color: #666666;">[TestDate]</span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="480" border="0" cellpadding="0" cellspacing="0">
<tr style="font-size: 10px; color: #26276d;">
<td width="10" align="left" valign="top">
 
</td>
<td width="100" align="left" valign="top">
Code
</td>
<td width="315" align="left" valign="top">
Substance
<br />
(in order of reaction)
</td>
<td width="200" align="left" valign="top">
Stimulation
<br />
Index
</td>
<td align="left" valign="top">
Comments
</td>
</tr>
[Substance]
</table>
</td>
</tr>
<tr>
<td>
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="font-size: 10

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900