Opened 4 years ago

Closed 18 months ago

Last modified 18 months ago

#11779 closed defect (worksforme)

Printing on OSX just shows error message

Reported by: SnowLeopard Owned by:
Priority: normal Milestone:
Component: wxOSX-Cocoa Version: stable-latest
Keywords: OSX printing Cc: tmsorensen@…
Blocked By: Blocking:
Patch: no

Description

OSX 10.6

Try to print anything (for example, the html print sample), and you get an error:

"Print Error 4294967246" and "Could not start printing"

Printing was working fine in the SVN a couple of months ago.

My configuration:

./configure CC=gcc-4.0 CXX=g++-4.0 LD=g++-4.0 --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-osx_cocoa --with-macosx-version-min=10.4 --disable-shared --enable-universal_binary --enable-debug

Change History (4)

comment:1 Changed 4 years ago by tmsorensen

  • Cc tmsorensen@… added

I get this error message as well (with the same build configuration, except mine is a Carbon build). However, I'm using wx 2.8.4, and for me it works flawlessly on Mac OS X 10.5. It's just failing on 10.6.3 (and possibly 10.6.2 - haven't checked below that).

I haven't been able to sort it out so far, as I'm no print expert, but the error code is the unsigned version of -30870 which - unfortunately - translates to "An unspecified error occurred." according to Apple's Core Printing Reference...

One thing that _might_ be helpful is that it seems as if the wx code reuses the PMPrintSession object along with the PMPageFormat and PMPrintSettings objects, whereas Apple's example code creates a new PMPrintSession for each print job and only reuses the PMPageFormat and PMPrintSettings.

comment:2 Changed 4 years ago by tmsorensen

I should also mention that I only get the error when using wxHtmlEasyPrinting. Just allocating a wxPrinter and drawing on its DC generally works fine (but not _after_ I getthe error message).

comment:3 Changed 18 months ago by vadz

  • Resolution set to worksforme
  • Status changed from new to closed

OK, since r72805 the situation is even works: we crash in wxHtmlPrintout::OnPreparePrinting() because we don't have the DC yet. And we don't have the DC because we need to get the number of pages first. But we can't get the number of pages without the DC... I really have no idea how is this supposed to work :-(

For now I can only revert the changes above. But at least after this printing does seem to work for me (at least into PDF).

comment:4 Changed 18 months ago by VZ

(In [72883]) Revert "Fix the pages range in the print dialog in wxOSX."

This reverts r72805 (leaving only the changes to printdlg.cpp which seem
harmless and potentially useful) as it resulted in crashes when using
wxHtmlEasyPrinting because we called wxPrintout::OnPreparePrinting() before
setting the DC to be used, which was wrong.

In fact it's not clear how can we get the correct range of pages at all
because we need a DC to paginate properly (i.e. taking into account its size)
but we need to show a dialog, in which we already want to show the pages
range, before choosing the DC. Perhaps we could create a dummy DC for
pagination purposes but how could this work with printers using different page
sizes?

The best would probably be to avoid setting any limits on the page range as
showing 9999 looks ugly but anything else would be wrong.

See #8349, #11779.

Note: See TracTickets for help on using tickets.