Version: 1.3.1 (using KDE KDE 3.5.5) Installed from: Fedora RPMs OS: Linux When using the export to EPS feature, the resulting encapsulates PostScript file has a wrong bounding box value. In most cases the bounding box is too large, leaving a thick white border around the chart.
SVN commit 619695 by arwalker: BUG:139495 Set the BoundingBox values correctly for an EPS file M +17 -4 kstviewwindow.cpp --- trunk/extragear/graphics/kst/src/libkstapp/kstviewwindow.cpp #619694:619695 @@ -234,7 +234,9 @@ if (!view()->children().isEmpty()) { QString filenameNew; QString filenameNewEps; - + int right; + int bottom; + { QPrinter printer(QPrinter::HighResolution); QString dotFormat = QString(".eps"); @@ -251,13 +253,16 @@ if ( size.height() / 8 > resolution ) { resolution = size.height() / 8; } - + right = ( 72 * size.height() ) / resolution; + bottom = ( 72 * size.width() ) / resolution; + + printer.setMargins(0, 0, 0, 0); printer.setResolution(resolution); printer.setPageSize(QPrinter::Letter); printer.setOrientation(QPrinter::Landscape); printer.setOutputToFile(true); printer.setOutputFileName(filenameNew); - + KstPainter paint(KstPainter::P_PRINT); paint.begin(&printer); QPaintDeviceMetrics metrics(&printer); @@ -279,7 +284,7 @@ if (fileEPS.open(IO_WriteOnly | IO_Truncate)) { QTextStream streamPS(&filePS); QTextStream streamEPS(&fileEPS); - + line = streamPS.readLine(); if (!line.isNull()) { if (line.left(11) == "%!PS-Adobe-") { @@ -287,6 +292,14 @@ // we have a ps file, so do the conversion... // streamEPS << "%!PS-Adobe-2.0 EPSF-2.0\n"; + + line = streamPS.readLine(); + if (!line.isNull() && line.left(14) == "%%BoundingBox:") { + streamEPS << "%%BoundingBox: 0 0 " << right << " " << bottom << "\n"; + } else { + streamEPS << line << "\n"; + } + while (!streamPS.atEnd()) { line = streamPS.readLine(); streamEPS << line << "\n";