How can I change the Print Spooler filename/document name associated with wxPrintout in wxwidgets

320 views Asked by At

I have managed to attach my filename to my print out by overloading the wxPrintout constructor with my chosen name.

 wxPrintout(const wxString& title = wxT("Printout"));

In my code:

VRPrintout::VRPrintout(blababala):wxPrintout(_("Heartrate")),

But on printing to save as a PDF, in the filename dialog, it reads "Printing Heartrate".

How can I get rid of "Printing" added before the name or even change it?

1

There are 1 answers

0
Federico On BEST ANSWER

@Credits to Xaviou from wxDev.fr.

You can try overriding the "OnBeginDocument" method in your wxPrintout derived class.

The default code is the following (the "OnBeginDocument" is virtual) in wx-src/common/prntbase.cpp:584 :

 bool wxPrintout::OnBeginDocument(int WXUNUSED(startPage), int WXUNUSED(endPage))
{
   return GetDC()->StartDoc(_("Printing ") + m_printoutTitle);
}

I think that if you provide yours with the correct text, it should be ok.

Regards Xav'

Edit : Tested on an app of mine that do printing stuff, and it works...

Worked for me too