I see and my apologies. wxWidgets classes which do not need event handling usually work with "int main". Sure, there is no reason why they should. So my first attempt was "int main". The second attempt was making the wxAppConsole code templates finally
and redoing my first attempt:
wxPdfDocument doesn't require event handling, but there are other data structures like color "database", paper "database" and others of which wxPdfDocument makes use. Therefore initializing wxWidgets is important. As you see it works in console mode where wxWidgets turns off event handling by itself.
Radek wrote:A few questions:
(1) wxStockGDI::DeleteAll(). This is not documented even in wx29. Is it necessary?
As far as I can remember I introduced this call in OnExit because I experienced memory leaks. But that was for wxWidgets 2.8. Maybe it's not needed for wx 2.9.
Radek wrote:(2) When I installed wxPdfDocument, I had two secret wishings, both of them concern manipulating existing PDFs. Is it possible in general?
In general yes, although support is limited.
Radek wrote:I am interested in
(a) adding indexes to PDFs without index. Such PDFs are hard to use but they can contain useful info. The most horrible example of this is - wxWidgets reference in PDF. More than 2000 pages, no index. wxPdfParser seems to be able to load an existing PDF.
Yes, wxPdfParser is able to extract all objects from a PDF file, but it doesn't handle page content. Parsing page content is a major task which I do not intend to add to wxPdfDocument.
Manipulating existing PDF files (adding an index, adding or removing pages and so on) is currently not supported by wxPdfDocument.
Radek wrote:(b) displaying the contents of an existing PDF using wxWidgets. wxPdfDC seems to be the right tool for it.
Definitely not. wxPdfDC allows to integrate PDF output into the wxWidgets printing framework - see the sample coming with wxPdfDocument. This allows to easily "print" to PDF from a wxWidgets application.
wxPdfDocument is not a PDF renderer. I would recommend to use the system PDF viewer for displaying PDF files.
If you really need to render a PDF to screen yourself you should take a look at poppler or similar libraries.