How can I store a print image once a page is created using wxPrintout?
(Trunk on Windows 10)
Print to file
Re: Print to file
Hi,
Why do you want to use wxPrintout?
Can't you just use wxImage->Save()?
Or you are using wxPDF?
Thank you.
Why do you want to use wxPrintout?
Can't you just use wxImage->Save()?
Or you are using wxPDF?
Thank you.
-
- Super wx Problem Solver
- Posts: 488
- Joined: Fri Oct 27, 2006 4:35 pm
- Location: Paris, France
- Contact:
Re: Print to file
@Oneeyeman
With wxPrintout I know how to create and print a document, which is what is needed. However, when a document is printed with wxPrintout, there is no trace of it in the system, and I would like to have a copy for archiving. While it is possible to scan the document and save the image, it sound pretty ridiculous as far as applications go.
I have no idea how to transform a wxPrintout to wxImage. It would be useful if you could show the way.
With wxPrintout I know how to create and print a document, which is what is needed. However, when a document is printed with wxPrintout, there is no trace of it in the system, and I would like to have a copy for archiving. While it is possible to scan the document and save the image, it sound pretty ridiculous as far as applications go.
I have no idea how to transform a wxPrintout to wxImage. It would be useful if you could show the way.
Re: Print to file
Hi,
If you are on Windows you can probably print to either PDF or XPS.
I am not sure myself but if you look at the printing sample it can probably show you how to do a different printing.
Thank you.
If you are on Windows you can probably print to either PDF or XPS.
I am not sure myself but if you look at the printing sample it can probably show you how to do a different printing.
Thank you.
Re: Print to file
There is no immediate way to just "grab" the last printed page and store it into a file.
If you have subclassed wxPrintout, you should have a wxPrintout::OnPrintPage(int page) in which you perform the actual drawing. Create a bitmap of the appropriate size and use a wxMemoryDC to draw the same content into the bitmap. Then you can save it as a file.
If you have subclassed wxPrintout, you should have a wxPrintout::OnPrintPage(int page) in which you perform the actual drawing. Create a bitmap of the appropriate size and use a wxMemoryDC to draw the same content into the bitmap. Then you can save it as a file.
Use the source, Luke!