Welcome Guest Search | Active Topics | Sign In | Register

PDF Html Header Options
JHH
Posted: Monday, March 11, 2019 4:06:37 PM
Rank: Newbie
Groups: Member

Joined: 8/12/2014
Posts: 2
I am trying to use a table as HTML for the header, but the header ends up below the main HTML document...

I set the HTML to be converted...

strHTML = "<table cellspacing="0" style="border-collapse:collapse;">" & vbCrLf & " <tr>" & vbCrLf & " <td style="font-family:Arial;font-size:10pt;width:142pt;"><br></td><td style="font-family:Arial;font-size:10pt;width:48pt;">This is a test</td><td style="font-family:Arial;font-size:10pt;width:411pt;">For a header</td>" & vbCrLf & " </tr>" & vbCrLf & "</table>"

I set the HTML header...

toptions.HeaderHtmlFormat ="<table style="border-collapse: collapse;" cellspacing="0">
<tbody>
<tr>
<td style="color: #000000; font-family: Arial; font-size: 6pt; width: 48pt;">&nbsp;</td>
<td style="color: #0070c0; font-family: Tahoma; font-size: 6pt; width: 90pt;">Corporate Office</td>
<td style="color: #0070c0; font-family: Tahoma; font-size: 6pt; width: 42pt;">&nbsp;</td>
<td style="color: #0070c0; font-family: Tahoma; font-size: 6pt; width: 100pt;">US Operations</td>
</tr>
<tr>
<td style="color: #000000; font-family: Arial; font-size: 6pt; width: 48pt;">&nbsp;</td>
<td style="color: #000000; font-family: Tahoma; font-size: 6pt; width: 90pt;">ABC</td>
<td style="color: #000000; font-family: Tahoma; font-size: 6pt; width: 42pt;">&nbsp;</td>
<td style="color: #000000; font-family: Tahoma; font-size: 6pt; width: 100pt;">ABC</td>
</tr>
<tr>
<td style="color: #000000; font-family: Arial; font-size: 6pt; width: 48pt;">&nbsp;</td>
<td style="color: #000000; font-family: Tahoma; font-size: 6pt; width: 90pt;">123 Street</td>
<td style="color: #000000; font-family: Tahoma; font-size: 6pt; width: 42pt;">&nbsp;</td>
<td style="color: #000000; font-family: Tahoma; font-size: 6pt; width: 100pt;">456 Street</td>
</tr>
<tr>
<td style="font-family: Arial; font-size: 10pt; width: 48pt;">&nbsp;</td>
<td style="color: #000000; font-family: Tahoma; font-size: 6pt; width: 90pt;">Toronto, ON M5V 1K4 CAN</td>
<td style="color: #000000; font-family: Tahoma; font-size: 6pt; width: 42pt;">&nbsp;</td>
<td style="color: #000000; font-family: Tahoma; font-size: 6pt; width: 100pt;">New York, NY 10022 US</td>
</tr>
</tbody>
</table>"

And then I convert...

HtmlToPdf.ConvertHtml(strHTML, pdfStream, toptions)

I would assume the header would always be converted first and be on the top, but that is not happening?
eo_support
Posted: Friday, March 15, 2019 8:53:27 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

We tested your code and it seems to work fine here.

The header and main contents are converted almost independently. Specifically, it is not true that the headers are converted first. The header are converted and then outputted in the header area, the main contents are converted and then outputted in the main content area. So if these two areas overlaps, then your header and main contents will overlap. Or even if these two areas do not overlap, but the header is too big and overflows the header area, it can "spill" into the main content area and to overlap with the main content.

You would use HtmlToPdfOptions.OutputArea to set the main contents area. You would use HtmlToPdfOptions.HeaderHtmlPosition to set the top position of the header area. The left/right position of the header area is the same as OutputArea. The bottom position of the header area is open (thus it can overflow to the main content area if the header is too big).

The only connection between the header area and the main content area is that the header HTML would use the same zoom level as the main contents. So if the main content has been zoomed out, then the header HTML will be zoomed out by the same level as well.

If you still have problems, please try to isolate the problem into a separate test project and send the test project to us. Once we have that we will be happy to investigate further. See here for more details on sending test project to us:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks
JHH
Posted: Friday, March 15, 2019 3:42:11 PM
Rank: Newbie
Groups: Member

Joined: 8/12/2014
Posts: 2
Thanks for the info and quick response, much appreciated - I'll see if I can figure it out, if not, I will package up a test project for you to easily check it
eo_support
Posted: Monday, March 18, 2019 8:35:05 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
No problem. Please let us know.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.