Bug report #345

Problems with printing to EPS

Added by Redmine Admin over 17 years ago. Updated over 14 years ago.

Status:Closed
Priority:Low
Assignee:Redmine Admin
Category:-
Affected QGIS version: Regression?:No
Operating System:Linux Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:10404

Description

Usually when I print to eps, QGIS segfaults with his last words being:

[[QgsComposerMap]]::recalculate mCalculate = 0
mUserExtent = 3687846.8754472997970879,5589402.1066110003739595 : 3691952.4785347003489733,5592168.8243129998445511
mScale = 0.82838
mExtent = 3687846.8754472997970879,5587870.7407767521217465 : 3691952.4785347003489733,5593700.1901472480967641
[[QgsComposerMap]]::setOptions
[[QgsComposerMap]]::recalculate mCalculate = 0
mUserExtent = 3687846.8754472997970879,5589402.1066110003739595 : 3691952.4785347003489733,5592168.8243129998445511
mScale = 0.82838
mExtent = 3687846.8754472997970879,5587870.7407767521217465 : 3691952.4785347003489733,5593700.1901472480967641
[[QgsComposerMap]]::setOptions
[[QgsComposerMap]]::setOptions
draw mPlotStyle = 0 mPreviewMode = 0
use cache
extent = 4105.6 x 5829.45
cache = 1000 x 1419
transform = Map units/pixel: 4.1056 X minimum: 3.68785e+06 Y minimum: 5.58787e+06 Y maximum: 1419
scale = 3.401
translate: 75, 101
draw mPlotStyle = 0 mPreviewMode = 0
use cache
extent = 4105.6 x 5829.45
cache = 1000 x 1419
transform = Map units/pixel: 4.1056 X minimum: 3.68785e+06 Y minimum: 5.58787e+06 Y maximum: 1419
scale = 3.401
translate: 75, 101
Resolution = 300
Print to file
draw mPlotStyle = 2 mPreviewMode = 0
render
Segmentation fault (core dumped)

gdb doesn't like the core dump, saying:

"/home/shoofi/core.14622" is not a core dump: File format not recognized

so I can't give you a backtrace. I have backed up this core dump. If you want it, I can send it by email (it's ~800 KB bzpipped).

To reproduce the segfault, try:

1. add any layer (shape or raster, no matter)
2. map composer
3. format A4, orientation: portrait
4. add a map
5. print to eps
6. segfault

Maciek

gminy.tar.bz2 (209 KB) Redmine Admin, 2006-12-04 12:59 PM

eps_artefact.png (6.45 KB) anonymous -, 2006-12-04 01:00 PM

eps_artefact.2.png (6.45 KB) Redmine Admin, 2006-12-04 01:00 PM

History

#1 Updated by Martin Dobias over 17 years ago

Is there a difference between this ticket and #339 ?


When gdb has started, enter command *run* to the prompt and once qgis crashes type *bt* to see the backtrace.

#2 Updated by Redmine Admin over 17 years ago

Is there a difference between this ticket and #339 ?

This one provides a bit more details, so propably #339 should be a duplicate of this one.

Btw. to provide backtrace you run qgis this way: gdb /your/path/bin/qgis

That's exactly what I'm doing. And I get:

"/home/shoofi/bugi/qgis/core.14622" is not a core dump: File format not recognized

#3 Updated by Redmine Admin over 17 years ago

Oops sorry. Now I get it. Your procedure was different than the one proposed in FAQ of the QGIS site. Doing it as you suggested, I get:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1240062272 (LWP 5653)]
0x369b0000 in ?? ()
(gdb) bt
#0  0x369b0000 in ?? ()
#3905  0xb7664759 in QPaintDevice::~QPaintDevice ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3906  0xb76644ac in QPaintDevice::~QPaintDevice ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3907  0xb7666728 in QPaintDevice::~QPaintDevice ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3908  0xb766068a in QPaintDevice::~QPaintDevice ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3909  0xb761a44d in QPainter::drawPicture ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3910  0xb761aed8 in QPainter::drawPolyline ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3911  0xb6ab0c41 in [[QgsVectorLayer]]::drawLineString (this=0x82f9110,
    feature=0x89bc4b8 "\\001\\002", hasZValue=false, p=0xbff2ee98,
    mtp=0xbff2ea80, projectionsEnabledFlag=false, drawingToEditingCanvas=false)
    at qpainter.h:477
#3912  0xb6ab11bf in [[QgsVectorLayer]]::drawFeature (this=0x82f9110, p=0xbff2ee98,
    fet=0x82f5a34, theMapToPixelTransform=0xbff2ea80, marker=0xbff2e844,
    markerScaleFactor=5, projectionsEnabledFlag=false,
    drawingToEditingCanvas=false) at qgsvectorlayer.cpp:3420
#3913  0xb6ab8799 in [[QgsVectorLayer]]::draw (this=0x82f9110, p=0xbff2ee98,
    viewExtent=0x82f5a34, theMapToPixelTransform=0xbff2ea80,
---Type <return> to continue, or q <return> to quit---q
drawingToEditingCanQuit
) at qgsvectorlayer.cpp:920
#10 0xb7e81acc in [[QgsComposerMap]]::draw (this=0x855bb08, painter=0xbff2ee98,
    extent=0x855bbf4, transform=0xbff2ea80) at qgscomposermap.cpp:129
#3914 0xb7e8305f in [[QgsComposerMap]]::draw (this=0x855bb08, painter=@0xbff2ee98)
    at qgscomposermap.cpp:285
#3915 0xb7bb1e12 in Q3CanvasItemList::drawUnique ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQt3Support.so.4
#3916 0xb7bb4dab in Q3Canvas::drawCanvasArea ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQt3Support.so.4
#3917 0xb7bb4ea8 in Q3Canvas::drawArea ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQt3Support.so.4
#3918 0xb7e688f9 in [[QgsComposer]]::on_mActionPrint_activated (this=0x80e30d0)
    at qgscomposer.cpp:349
#3919 0xb7ea887d in [[QgsComposer]]::qt_metacall (this=0x80e30d0,
    _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0x82f5a34)
    at qgscomposer.moc.cpp:91
#3920 0xb7d634ba in QMetaObject::activate ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtCore.so.4
#3921 0xb7d636f3 in QMetaObject::activate ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtCore.so.4
#3922 0xb75584e1 in QAction::activated ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3923 0xb7558efc in QAction::activate ()
---Type <return> to continue, or q <return> to quit---
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3924 0xb7800c5a in QToolButton::nextCheckState ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3925 0xb7767757 in QButtonGroup::id ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3926 0xb77679c5 in QAbstractButton::mouseReleaseEvent ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3927 0xb759c65c in QWidget::event ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3928 0xb7767eb0 in QAbstractButton::event ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3929 0xb7800a04 in QToolButton::event ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3930 0xb755cc95 in QApplicationPrivate::notify_helper ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3931 0xb755eb8a in QApplication::notify ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3932 0xb75af79d in QApplication::x11ProcessEvent ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3933 0xb75aee68 in QApplication::x11ProcessEvent ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3934 0xb75c0ca5 in non-virtual thunk to QDesktopWidget::~QDesktopWidget() ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
---Type <return> to continue, or q <return> to quit---
#3935 0xb7d5521e in QEventLoop::processEvents ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtCore.so.4
#3936 0xb7d5543a in QEventLoop::exec ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtCore.so.4
#3937 0xb7d58217 in QCoreApplication::exec ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtCore.so.4
#3938 0xb755ca35 in QApplication::exec ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#36 0x0804c4d8 in main (argc=1, argv=0xbff30354) at main.cpp:604

#4 Updated by Gavin Macaulay - over 17 years ago

Ticket #339 gives a different way of failing to this ticket, but they look to be the same problem.

#5 Updated by Gavin Macaulay - over 17 years ago

Another 'crash with postscript' ticket is #141.

#6 Updated by Redmine Admin over 17 years ago

#141 is slightly different, as it occurs only when projects are more complex (several rasters), more often with larger sizes (A3) and only on pdf

#7 Updated by Martin Dobias over 17 years ago

Tested again with Qt 4.2.1 and seems to work well now. Can you retest?

#8 Updated by Redmine Admin over 17 years ago

Tested. In my setting it does not crash, but the eps produced is not valid (Cannot find BoundingBox). Furthermore, to choose the name of the file I have to deselect the "Print to file" option (that shows my default printer) and select it again (a minor annoyance).

#9 Updated by Martin Dobias over 17 years ago

The annoyance with print dialog is a Qt bug reported here:
http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=129148

What's wrong with the postscript file - only BoundingBox tag is missing or are there more problems? Does it happen always? What are the steps to reproduce it?

#10 Updated by Redmine Admin over 17 years ago

No more segfault. But still no EPS created - I keep on getting error "Cannot find translate". This is another bug I reported as #339, which was marked as a duplicate of this bug.

#11 Updated by Redmine Admin over 17 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

"Cannot find translate" is fixed in 6142.

Trolls are not going to release a decent printing devices?

Radim

#12 Updated by Redmine Admin over 17 years ago

Radim,

What's the "6142" you refer to?

Thanks,
Maciek

#13 Updated by Redmine Admin over 17 years ago

OK, got it - it's SVN revision. Nevermind.

Cheers.

#14 Updated by anonymous - over 17 years ago

  • Status changed from Closed to Feedback
  • Resolution deleted (fixed)

Radim wrote:

Cannot find translate" is fixed in 6142.

It is still mostly broken for me. Built SVN 6142 against QT 4.2.1, and:

1. "Cannot find BoundingBox" error pops up when printing to check.eps

2. I don't press the OK yet - I look whether the file was created first; and it is there, 1.8 MB. So I try to open it with PS viewer. This doesn't work and I'm told the file is in pdf format! So I rename the created "check.eps" into "check.pdf". Open it in acroread. It looks mostly OK, only the bottom is broken (was supposed to be A4).

3. Return to QGIS and I press OK in the error dialog. Another one pops up: "Cannot find translate"; and the check.eps is created again, only 0 bytes this time. Then I press OK in this second error dialog. The check.eps is not overwritten again this time.

You can grab the check.pdf here:
[http://kufaya.googlepages.com/check.pdf]

P.S
Note also that it was qgis that put the .eps extension as default, in spite of creating a pdf, not me.

P.S.2
When I try to print to a printer, I'm told "The selected paper does not match the composition size", although I have carefully set A4, portrait everywhere, including the printer properties.

Cheers,
Maciek

#15 Updated by Martin Dobias over 17 years ago

Some problems with printing should be resolved in Qt 4.2.2.

#16 Updated by Redmine Admin over 17 years ago

Replying to [comment:16 wonder]:

Some problems with printing should be resolved in Qt 4.2.2.

After upgrading to QT 4.2.2 it is better now. Still bad though.

No crashes anymore. But the eps output happens to be corrupted if it conatins polygons. Take the attached shapefile and compose a map out of it (A4, portrait). In the left-top corner you'll see bogus line rendered (see the attached png dump; you can grab the whole eps from here: [http://kufaya.googlepages.com/qgis.eps.bz2]). This is only an example, I can reproduce this bug with other polygon layers. It is reproducable, though I can't find a pattern for it.

Another thing is that printing to pdf still yields an error "Cannot find BoundingBox" and "Cannot find translate". Is printing to pdf not going to be supported (not a big deal for me, can always eps2pdf; but target QGIS users, especially those on Windows, might have a problem)? QT bug?

Moreover, although the "Print to file" is checked by defualt when entering the print menu, the dialog for the path to output eps file is not active - my printers are listed there instead. I have to uncheck the "Print to file" and check it back, for the path-dialog to become available.

Cheers,
Maciek

#17 Updated by Martin Dobias over 17 years ago

No crashes anymore. But the eps output happens to be corrupted if it conatins polygons. Take the attached shapefile and compose a map out of it (A4, portrait). In the left-top corner you'll see bogus line rendered (see the attached png dump; you can grab the whole eps from here: "This is only an example, I can reproduce this bug with other polygon layers. It is reproducable, though I can't find a pattern for it.

This seems to be another Qt4 rendering bug. I'll try to figure out what's going on here.

[[BR":http://kufaya.googlepages.com/qgis.eps.bz2]).]

Another thing is that printing to pdf still yields an error "Cannot find BoundingBox" and "Cannot find translate". Is printing to pdf not going to be supported (not a big deal for me, can always eps2pdf; but target QGIS users, especially those on Windows, might have a problem)? QT bug?

In what cases does it show up these messages? They come from composer as it tries to correct some values. Normally these strings should be in EPS, in PDF they're not used... this is invalid QGIS behaviour.

Moreover, although the "Print to file" is checked by defualt when entering the print menu, the dialog for the path to output eps file is not active - my printers are listed there instead. I have to uncheck the "Print to file" and check it back, for the path-dialog to become available.

This has been already reported by Paolo above in this ticket. Also a Qt bug - according to task tracker it should get fixed in Qt 4.3.0.

Martin

#18 Updated by Redmine Admin over 17 years ago

Replying to [comment:17 ]:

No crashes anymore. But the eps output happens to be corrupted if it conatins polygons. Take the attached shapefile and compose a map out of it (A4, portrait). In the left-top corner you'll see bogus line rendered (see the attached png dump; you can grab the whole eps from here: [http://kufaya.googlepages.com/qgis.eps.bz2]). This is only an example, I can reproduce this bug with other polygon layers. It is reproducable, though I can't find a pattern for it.

Please fill in another ticket for this bug. I see the reason but no easy solution.
The problem is that Qt (AFAIK) does not support rendering of polygons with holes.
We use the trick when each hole is connected 2 lines from the first vertex of the polygon.
This works on screen but it seems it does not work in PS. PS has its own correct method
how to render polygons with holes but we cannot use it through Qt.

We could probably find for each hole a better outer polygon vertex so that the connection
does not run outside the polygon but it can be CPU time consuming in case of
large polygons with many holes.

Another thing is that printing to pdf still yields an error "Cannot find BoundingBox" and "Cannot find translate". Is printing to pdf not going to be supported (not a big deal for me, can always eps2pdf; but target QGIS users, especially those on Windows, might have a problem)? QT bug?

We have to check if translate/box modification is still necessary in Qt4.2.2 and if
it is necessary for PDF and if it can be done for PDF.

Radim

#19 Updated by Redmine Admin over 17 years ago

The troubles with BoundingBox and translate are caused by the fact that in Qt (till 4.2.2)
is not possible to set custom page size. That is problem especially for
small EPS maps which need to be included in a text document.

According to
http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=99441
it could be resolved in 4.3.0, but it is not sure yet if there will be a method
to set custom page or it will be only possible from dialog.

Radim

#20 Updated by Redmine Admin over 17 years ago

  • Status changed from Feedback to Closed
  • Resolution set to fixed

The problem with BoundingBox and translate should be fixed in revision 6188.
No it should only overwrite the BoundingBox and translate if output format
is PS or EPS. That is determined according to the output file extension (.ps, .eps)
because mPrinter->outputFormat() does not work (always 0 ).

Please test. I am going to close this ticket and open a new for the problem with polygon holes.

Radim

#21 Updated by Anonymous over 14 years ago

Milestone Version 0.8 deleted

Also available in: Atom PDF