wxHtml table with printable image background

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
Post Reply
tlip
In need of some credit
In need of some credit
Posts: 2
Joined: Sun Jan 24, 2021 7:32 pm

wxHtml table with printable image background

Post by tlip » Sun Jan 24, 2021 8:42 pm

I think, it may be usable for someone...
I've modified m_tables.cpp file from src/html folder. My modifications are marked by "//tl" comment.
With modified file, after recompilation wxWidgets library, there is parametr "BACKGROUND" for tag <TABLE> supported.
The image file for background of a table may be specified in parameter. A image is scaled to the size of a table.
An additionally parameter "HEIGHT" in pixels may be given: with it a rendered image have this height (before scaling).

As a bonus there is non-standard parameter "FACTOR". It is usable if you need smaller cellspacing, counted as:
new_cellspacing=CELLSPACING/FACTOR

[2021-01-06] I have placed the file m_tables.cpp file one more time.
In the previous version there was a bug when the image file did not exist.

There is a sample of a product in wxHtmlEasyPrinting window in the attached image, from html:

Code: Select all

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
</head>
<body>
<table BORDER=0 COLS=1 WIDTH="750" HEIGHT="1000" BACKGROUND="img/wx.png" NOSAVE >
<tr>
<td>
Lorem ipsum dolor sit amet, consectetur adipiscing elit,<br> sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <br>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat<br> non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
<br>
<br>
<br>
<br>
<br>
<br>
<b>Lorem ipsum dolor sit amet, consectetu<br>r adipiscing elit, sed do eiusmod tempor<br> incididunt ut labore et dolore magna aliqua. Ut<br> enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip <br>ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in <br>culpa qui officia deserunt mollit anim<br> id est laborum.</b>
</td>
</tr>
</table>

</body>
</html>
Attachments
m_tables.cpp
(30.58 KiB) Downloaded 43 times
sample 2021-01-24 212432.png
Last edited by tlip on Tue Jan 26, 2021 5:26 pm, edited 1 time in total.

User avatar
doublemax
Moderator
Moderator
Posts: 16018
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxHtml table with printable image background

Post by doublemax » Sun Jan 24, 2021 9:52 pm

Thanks for the contribution!

Have you considered making a pull request at Github? It would be much nicer to have this built into wxWidgets.
Use the source, Luke!

tlip
In need of some credit
In need of some credit
Posts: 2
Joined: Sun Jan 24, 2021 7:32 pm

Re: wxHtml table with printable image background

Post by tlip » Sun Jan 24, 2021 10:07 pm

Maybe, if I recognize how to do this :wink:

User avatar
doublemax
Moderator
Moderator
Posts: 16018
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxHtml table with printable image background

Post by doublemax » Sun Jan 24, 2021 10:13 pm

How to make a pull request, by ONEEYEMAN:
viewtopic.php?p=201291#p201291
Use the source, Luke!

Post Reply