preview and print Topic is solved
preview and print
Good day. I would advise. I need to build pages (some pages A4) for preview and printing. On this page you need to place in the frame header (name, city, street, country ....) and then the data from my tables (or classes). It is preferable to proceed in accordance with Chapter 5 (Drawing and Printing) or Chapter 12 (wxHTML)? Thanks for the advice (any advice good).
Re: preview and print
If you know some basic HTML and don't need pixel-exact accuracy, wxHtmlEasyPrinting will be much, much easier. The printing framework in wxWidgets is a pain in the ...
Use the source, Luke!
Re: preview and print
Thanks for the quick reply. No, I do not need to know the absolute size of its final document. Only to be printable on A4 (more pages). On these pages I will not make any changes (inputs from the user - not to the tender form). It will be the final print reports such as price lists, budgets. Some data in tables, as some lines (summary), some with frame. So I'm going to study and thanks again.
Re: preview and print
I'm very sorry, but I have a (stupid) question: where do I create a page (paper)? I think the base on which I want to place tables, frames, lines and others? The side that then I print?
Re: preview and print
You don't. You just create the html code of the page. Just like in a browser window, the layout will be determined by the size of the paper.
Use the source, Luke!
Re: preview and print
I already know, so sorry.
Re: preview and print
I know that I'm doing bad, but how can I print a page from wxHtmlWindow? That's what I'm doing (shown here, but bad), only lists everything word for word.
void BaseFrame :: OnPrint (wxCommandEvent & WXUNUSED (event))
{
m_htmlwin-> SelectAll ();
m_Prn-> PrintText (m_htmlwin-> SelectionToText ());
}
There is no page layout, as I created it in wxHtmlWindow. I do not load any pages (for example, from a file), I create everything by hand - using: m_htmlwin-> AppendToPage ("...."); Does anyone please advise?
void BaseFrame :: OnPrint (wxCommandEvent & WXUNUSED (event))
{
m_htmlwin-> SelectAll ();
m_Prn-> PrintText (m_htmlwin-> SelectionToText ());
}
There is no page layout, as I created it in wxHtmlWindow. I do not load any pages (for example, from a file), I create everything by hand - using: m_htmlwin-> AppendToPage ("...."); Does anyone please advise?
Re: preview and print
Code: Select all
m_Prn->PrintText (m_htmlwin->SelectionToText ());
As there is no method to get the current html data from wxHtmlWindow, you have to store it yourself after you created it.
Use the source, Luke!
Re: preview and print
Thanks for the reply. I thought so (and a little worried about that), I'll have to save your data to an HTML file. The problem is that the output file of my application is one database file (for example A1.fdb) - where everything is stored (the entire budget - material and work).
So I'll have to save for one order several files (the first file will be database; 2., 3.,. .. n the html). Then it might make sense to store the result as a multicomponent file with routine *exe. And it I do not know.
So I'll have to save for one order several files (the first file will be database; 2., 3.,. .. n the html). Then it might make sense to store the result as a multicomponent file with routine *exe. And it I do not know.
Re: preview and print
Or even occurred to me to save html pages into the database as a "BLOB" ...
Re: preview and print
You don't need to create a html file. Just store everything in a wxString variable. So instead of calling wxHtmlWindow::AppendToPage() multiple times, you add all html code to a wxString variable. If you're done, call wxHtmlWindow::SetPage() once with the complete html code.
Use the source, Luke!
Re: preview and print
This can not be true! It's as simple as that? Thanks very much!
Re: preview and print
BTW: I don't know exactly what you're doing, but if you're using the wxHtmlWindow only for a preview, that's not necessary. It's already in wxHtmlEasyPrinting.
Just call wxHtmlEasyPrinting::PreviewText() with the html code. It shows a preview window with zoom and everything.
Just call wxHtmlEasyPrinting::PreviewText() with the html code. It shows a preview window with zoom and everything.
Use the source, Luke!
Re: preview and print
I'm doing a report for printing. Everything is already filled (north, classes in the program, all variables and other data). Now I need "only" inspect "on paper" and send it to the printer. In wxHtmlWindow there would be no further interference in the code - it is for viewing the report is created.
Re: preview and print
Praised be wxString! Indeed one wxString "swallows" set the whole page code html - including the of tables in the loops and obtaining data from many m_textCtrl. Doblemax, thanks a lot!