Bug 112292 - export to eps creates invalid eps file
Summary: export to eps creates invalid eps file
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-09 07:43 UTC by Alan Ezust
Modified: 2005-09-18 06:35 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
state-diagram.xmi (44.67 KB, text/plain)
2005-09-15 07:31 UTC, Oliver Kellogg
Details
state-diagram.eps (13.98 KB, text/plain)
2005-09-15 07:34 UTC, Oliver Kellogg
Details
latest eps file (14.65 KB, image/eps)
2005-09-17 17:33 UTC, Alan Ezust
Details
diff -u between the two eps files (11.86 KB, text/plain)
2005-09-17 18:04 UTC, Oliver Kellogg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Ezust 2005-09-09 07:43:43 UTC
Version:           1.4.89 (using KDE KDE 3.4.2)
Installed from:    Debian testing/unstable Packages
OS:                Linux

The eps files generated by this version of umbrello are not being rendered properly in XEP, among other things. I ran epstool and got the following output: It seems to happen with all exported eps files now.


epstool --test-eps contact.eps

DSC Warning
At line 2:
   %%BoundingBox: 35.: 23.8571 559 817.714
This line is incorrect.
The bounding box must be in integer coordinates,
not floating point. A floating point bounding box should
be specified using %%HiResBoundingBox:
A %%BoundingBox: should still be provided with integer values.

'OK' will convert the coordinates to integers,
rounding them outwards.
'Cancel' will ignore this line


DSC Information
At line 4858:
   %%Pages: 1
This comment is duplicated in the trailer, which is unnecessary.
The last occurence of a trailer line takes precedence.

'OK' or 'Cancel' will use the duplicate line.


DSC Error

This EPS file is missing the required %%BoundingBox:
See the GSview help for details of how to add/adjust the
bounding box.

'OK' will assume this as an EPS file
'Cancel' will assume this is NOT an EPS file.

"gs"  -dNOEPS -dNOPAUSE -dBATCH -dNODISPLAY  "/tmp/gsviewrW79Qe"
GPL Ghostscript 8.15: Unrecoverable error, exit code 1
Ghostscript failed to interpret file

Missing %%BoundingBox
File claims to be EPS.
FAIL: File does not comply with EPS specification.
Failed
Comment 1 Oliver Kellogg 2005-09-09 08:26:49 UTC
Ugh, I again mixed up bug numbers.
Correction:
Bug 112293 is a duplicate of 112017.
See the comments at 112293 for the actual resolution of 112292, sorry.
Comment 2 Alan Ezust 2005-09-14 17:51:12 UTC
I tried rebuilding the latest version from SVN and I still get this error 
on recently created EPS files:


[ezust@lazarus] /home/ezust/public_html/oopdocbook/docs/src/derivation> epstool --test-eps student.eps

DSC Warning
At line 2:
   %%BoundingBox: 35.: 23.8571 559 817.714
This line is incorrect.
The bounding box must be in integer coordinates,
not floating point. A floating point bounding box should
be specified using %%HiResBoundingBox:
A %%BoundingBox: should still be provided with integer values.

'OK' will convert the coordinates to integers,
rounding them outwards.
'Cancel' will ignore this line


DSC Information
At line 4931:
   %%Pages: 1
This comment is duplicated in the trailer, which is unnecessary.
The last occurence of a trailer line takes precedence.

'OK' or 'Cancel' will use the duplicate line.


DSC Error

This EPS file is missing the required %%BoundingBox:
See the GSview help for details of how to add/adjust the
bounding box.

'OK' will assume this as an EPS file
'Cancel' will assume this is NOT an EPS file.

"gs"  -dNOEPS -dNOPAUSE -dBATCH -dNODISPLAY  "/tmp/gsviewOVhAed"
GPL Ghostscript 8.15: Unrecoverable error, exit code 1
Ghostscript failed to interpret file

Missing %%BoundingBox
File claims to be EPS.
FAIL: File does not comply with EPS specification.
Failed
Comment 3 Oliver Kellogg 2005-09-14 21:16:16 UTC
Which place in svn are you using?
All work on Umbrello is being done on the branches/KDE/3.5/kdesdk
_not_ on trunk (which is the QT4/KDE4 version)
Comment 4 Alan Ezust 2005-09-15 02:52:45 UTC
[ezust@lazarus] /home/ezust/workspace/kde/kdesdk/umbrello/umbrello> svn info
Path: .
URL: svn://anonsvn.kde.org/home/kde/branches/KDE/3.5/kdesdk/umbrello/umbrello
Repository UUID: 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Revision: 460742
Node Kind: directory
Schedule: normal
Last Changed Author: binner
Last Changed Rev: 460587
Last Changed Date: 2005-09-14 05:54:12 -0700 (Wed, 14 Sep 2005)
Properties Last Updated: 2005-08-05 09:06:28 -0700 (Fri, 05 Aug 2005)

Comment 5 Oliver Kellogg 2005-09-15 07:31:45 UTC
Created attachment 12573 [details]
state-diagram.xmi

I don't see how that can be after commit 458849.
For reality check, I am attaching an XMI file
and the EPS file created from it.
Comment 6 Oliver Kellogg 2005-09-15 07:34:50 UTC
Created attachment 12574 [details]
state-diagram.eps

EPS file generated from the previously attached XMI file.
Displays without problem using gv (Ghostview.)
Comment 7 Alan Ezust 2005-09-16 20:02:55 UTC
So bizarre. I can clearly see that my version of umlview.cpp has your 
changes which 
convert the floating point numbers to an int.

I've done a bunch of "clean" rebuilds, and this latest binary is 1.4.90 not 
1.4.89 which is the version I first reported. 

and yet, *STILL*, it generates eps files with floating point values. I can't 
understand why this is. I will have to investigate further, I guess.

It seems as if there is an old umlview.o somewhere which I can't delete....


On 15 Sep 2005 05:34:51 -0000, Oliver Kellogg <
okellogg@users.sourceforge.net> wrote:
[bugs.kde.org quoted mail]
So bizarre. I can clearly see that my version of umlview.cpp has your changes which <br>
convert the floating point numbers to an int.<br>
<br>
I've done a bunch of &quot;clean&quot; rebuilds, and this latest binary is 1.4.90 not 1.4.89 which is the version I first reported. <br>
<br>
and yet, *STILL*, it generates eps files with floating point values. I
can't understand why this is. I will have to investigate further, I
guess.<br>
<br>
It seems as if there is an old umlview.o&nbsp; somewhere which I can't delete....<br>
<br>
<br>
<div><span class="gmail_quote">On 15 Sep 2005 05:34:51 -0000, <b class="gmail_sendername">Oliver Kellogg</b> &lt;<a href="mailto:okellogg@users.sourceforge.net">okellogg@users.sourceforge.net</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
------- You are receiving this mail because: -------<br>You are the assignee for the bug, or are watching the assignee.<br><br><a href="http://bugs.kde.org/show_bug.cgi?id=112292">http://bugs.kde.org/show_bug.cgi?id=112292
</a><br><br><br><br><br>------- Additional Comments From okellogg users sourceforge net&nbsp;&nbsp;2005-09-15 07:34 -------<br>Created an attachment (id=12574)<br> --&gt; (<a href="http://bugs.kde.org/attachment.cgi?id=12574&amp;action=view">
http://bugs.kde.org/attachment.cgi?id=12574&amp;action=view</a>)<br>state-diagram.eps<br><br>EPS file generated from the previously attached XMI file.<br>Displays without problem using gv (Ghostview.)<br><br><br>-------------------------------------------------------
<br>SF.Net email is sponsored by:<br>Tame your development challenges with Apache's Geronimo App Server. Download<br>it for free - -and be entered to win a 42&quot; plasma tv or your very own<br>Sony(tm)PSP.&nbsp;&nbsp;Click here to play: 
<a href="http://sourceforge.net/geronimo.php">http://sourceforge.net/geronimo.php</a><br>_______________________________________________<br>Uml-devel mailing list<br><a href="mailto:Uml-devel@lists.sourceforge.net">Uml-devel@lists.sourceforge.net
</a><br><a href="https://lists.sourceforge.net/lists/listinfo/uml-devel">https://lists.sourceforge.net/lists/listinfo/uml-devel</a><br></blockquote></div><br>
Comment 8 Oliver Kellogg 2005-09-16 23:25:58 UTC
SVN commit 461214 by okellogg:

CCBUG:112292 - fixEPS(): Looking again at Comment #2,
> DSC Warning 
> At line 2: 
>    %%BoundingBox: 35.: 23.8571 559 817.714 

There's this strange colon at "35." so substitute
colons for '0'. Alan, could you try again? Thanks.


 M  +31 -22    umlview.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlview.cpp #461213:461214
@@ -1382,31 +1382,40 @@
 void UMLView::fixEPS(const QString &filename, QRect rect) {
     // now open the file and make a correct eps out of it
     QFile epsfile(filename);
-    QString fileContent;
-    if (epsfile.open(IO_ReadOnly )) {
-        // read
-        QTextStream ts(&epsfile);
-        fileContent = ts.read();
-        epsfile.close();
+    if (! epsfile.open(IO_ReadOnly)) {
+        return;
+    }
+    // read
+    QTextStream ts(&epsfile);
+    QString fileContent = ts.read();
+    epsfile.close();
 
-        // write new content to file
-        if (epsfile.open(IO_WriteOnly | IO_Truncate)) {
-            // read information
-            QRegExp rx("%%BoundingBox:\\s*(-?[\\d\\.]+)\\s*(-?[\\d\\.]+)\\s*(-?[\\d\\.]+)\\s*(-?[\\d\\.]+)");
-            const int pos = rx.search(fileContent);
-            const int left = (int)rx.cap(1).toFloat();
-            const int right = left + rect.width();
-            const int top = (int)rx.cap(4).toFloat();
-            const int bottom = top - rect.height();
+    // read information
+    QRegExp rx("%%BoundingBox:\\s*(-?[\\d\\.:]+)\\s*(-?[\\d\\.:]+)\\s*(-?[\\d\\.:]+)\\s*(-?[\\d\\.:]+)");
+    const int pos = rx.search(fileContent);
+    if (pos < 0) {
+        kdError() << "UMLView::fixEPS(" << filename
+                  << "): cannot find %%BoundingBox" << endl;
+        return;
+    }
 
-            // modify content
-            fileContent.replace(pos,rx.cap(0).length(),
-                                QString("%%BoundingBox: %1 %2 %3 %4").arg(left).arg(bottom).arg(right).arg(top));
+    // write new content to file
+    if (! epsfile.open(IO_WriteOnly | IO_Truncate)) {
+        kdError() << "UMLView::fixEPS(" << filename
+                  << "): cannot open file for writing" << endl;
+        return;
+    }
+    const int left = (int)rx.cap(1).replace(':', '0').toFloat();
+    const int right = left + rect.width();
+    const int top = (int)rx.cap(4).replace(':', '0').toFloat();
+    const int bottom = top - rect.height();
 
-            ts << fileContent;
-            epsfile.close();
-        }
-    }
+    // modify content
+    fileContent.replace(pos,rx.cap(0).length(),
+                        QString("%%BoundingBox: %1 %2 %3 %4").arg(left).arg(bottom).arg(right).arg(top));
+
+    ts << fileContent;
+    epsfile.close();
 }
 
 void UMLView::printToFile(const QString &filename,bool isEPS) {
Comment 9 Alan Ezust 2005-09-17 05:33:20 UTC
Just did an update again. Here is what epstool says now:
[ezust@lazarus] /home/ezust/public_html/oopdocbook/diagrams> epstool --test-eps Animals.eps

DSC Information
At line 2764:
   %%Pages: 1
This comment is duplicated in the trailer, which is unnecessary.
The last occurence of a trailer line takes precedence.

'OK' or 'Cancel' will use the duplicate line.

"gs"  -dNOEPS -dNOPAUSE -dBATCH -dNODISPLAY  "/tmp/gsviewqjr0KU"
GPL Ghostscript 8.15: Unrecoverable error, exit code 1
Ghostscript failed to interpret file

Missing %%BoundingBox
File claims to be EPS.
FAIL: File does not comply with EPS specification.
Failed
Comment 10 Oliver Kellogg 2005-09-17 09:27:04 UTC
Not being able to reproduce the behavior, there's not a lot I can do:
* Please check that you have a recent EPS converter (whatever that is.)
* If the problem persists, please attach your XMI source and the generated EPS.
Comment 11 Alan Ezust 2005-09-17 17:29:29 UTC
First, I recommend you get the program "epstool". I am using epstool 3.08 2005-06-06. 

http://www.cs.wisc.edu/~ghost/gsview/epstool.htm

Second, using the same XMI file you attached, and the latest version, I created the same state-diagram.eps and got this output:


[ezust@lazarus] /home/ezust/tmp/umbrello> epstool --test-eps statodiagramo1.eps

DSC Information
At line 441:
   %%Pages: 1
This comment is duplicated in the trailer, which is unnecessary.
The last occurence of a trailer line takes precedence.

'OK' or 'Cancel' will use the duplicate line.

"gs"  -dNOEPS -dNOPAUSE -dBATCH -dNODISPLAY  "/tmp/gsviewOetBQE"
GPL Ghostscript 8.15: Unrecoverable error, exit code 1
Ghostscript failed to interpret file

Missing %%BoundingBox
File claims to be EPS.
FAIL: File does not comply with EPS specification.
Failed

Comment 12 Alan Ezust 2005-09-17 17:33:47 UTC
Created attachment 12609 [details]
latest eps file

this is the file that caused the errors above
Comment 13 Oliver Kellogg 2005-09-17 18:04:08 UTC
Created attachment 12610 [details]
diff -u between the two eps files

Okay, I did as you suggested and installed the epstool.
At least I'm getting the same output from epstool on your eps file.
Quite amazing. Your file has exactly the same %%BoundingBox line as mine.
The main difference between the two seems to be the %%DocumentFonts but
there are other differences too.
Comment 14 Alan Ezust 2005-09-18 06:35:27 UTC
I just apt-get upgraded, and that upgraded libc6 and gcclibs. 

The problem went away after rebuilding umbrello.

There was a compiler warning about kdeprint and libc6 which I didn't really fully grok until today.