Bug 89553 - what you see is not what you get when exporting to EPS
Summary: what you see is not what you get when exporting to EPS
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: 2004-09-15 11:33 UTC by Pekka Jääskeläinen
Modified: 2005-01-10 18:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
The EPS version (49.89 KB, application/postscript)
2004-09-15 15:08 UTC, Pekka Jääskeläinen
Details
The PNG version (24.90 KB, image/png)
2004-09-15 15:09 UTC, Pekka Jääskeläinen
Details
Output with QPrinter *printer = new QPrinter(QPrinter::HighResolution); (50.16 KB, application/postscript)
2004-09-15 17:59 UTC, Pekka Jääskeläinen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pekka Jääskeläinen 2004-09-15 11:33:55 UTC
Version:           1.3.0 (using KDE KDE 3.3.0)
Installed from:    Debian testing/unstable Packages
OS:                Linux

I don't know really should this be in the wishlist or a bug report. I noticed that the EPS output is
far away from what I see on screen or get with bitmap format outputs. Colors and layouting is
really different. When I print to a PS file, it looks fine, except that it produces a footer for the 
image thus I cannot directly use it in my LaTeX documents (haven't yet found a nice editor that handles
PS files to cut the footer away).

I can post png and eps versions on request if this is a bug and not a feature.
Comment 1 Sebastian Stein 2004-09-15 14:39:43 UTC
Pekka JÀÀskelÀinen <pjaaskel@cs.tut.fi> [040915 12:43]:
> http://bugs.kde.org/show_bug.cgi?id=89553        
>            Summary: what you see is not what you get when exporting to EPS
> 
> Version:           1.3.0 (using KDE KDE 3.3.0)
> Installed from:    Debian testing/unstable Packages
> 
> I don't know really should this be in the wishlist or a bug report. I
> noticed that the EPS output is far away from what I see on screen or get
> with bitmap format outputs. Colors and layouting is really different.

I can't confirm the problem at all. When right clicking on a diagram I can
export it as eps, svg, png, bmp, jpg, ... All of those look ok. The only
problem I have found is, that the eps is black-white and not in color.

Are you sure you are using the Umbrello version shipped with KDE 3.3? Maybe
Debian ships another version of Umbrello (it should be version 1.3 in the
about dialog).

Sebastian
Comment 2 Pekka Jääskeläinen 2004-09-15 15:08:53 UTC
Created attachment 7540 [details]
The EPS version
Comment 3 Pekka Jääskeläinen 2004-09-15 15:09:35 UTC
Created attachment 7541 [details]
The PNG version
Comment 4 Pekka Jääskeläinen 2004-09-15 15:13:09 UTC
Debian does not yet ship 1.3.0 Umbrello, but I installed it from a .deb provided by Umbrello home page. Anyways, I uploaded png and eps versions if you want to take a look. The layout difference is not (in this case) huge but noticable, missing color I can live with. 

I don't know about PostScript much (cannot recall the difference between PS and EPS), but would it possible to take advantage of that print to file functionality somehow to produce the PS from which EPS could be created?
Comment 5 Sebastian Stein 2004-09-15 15:55:26 UTC
Pekka JÀÀskelÀinen <pjaaskel@cs.tut.fi> [040915 15:49]:
> ------- Additional Comments From pjaaskel cs tut fi  2004-09-15 15:13 -------
> Debian does not yet ship 1.3.0 Umbrello, but I installed it from a .deb
> provided by Umbrello home page.

Does this mean you are running version 1.3 or not?

> I don't know about PostScript much (cannot recall the difference between
> PS and EPS), but would it possible to take advantage of that print to file
> functionality somehow to produce the PS from which EPS could be created?

PS is ascii, so if it is really important you can edit it with a text
editor. But there might also be some ps editing programs around. Karbon
seems to be such a program, but it can't load the ps files produced by
Umbrello.

When you try to export the image, what file types can you choose?

Sebastian
Comment 6 Achim Spangler 2004-09-15 15:59:58 UTC
Am Mittwoch, 15. September 2004 15:13 schrieb Pekka JXXXXskelXXinen:
> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
>
> http://bugs.kde.org/show_bug.cgi?id=89553
>
>
>
>
> ------- Additional Comments From pjaaskel cs tut fi  2004-09-15 15:13
> ------- Debian does not yet ship 1.3.0 Umbrello, but I installed it from a
> .deb provided by Umbrello home page. Anyways, I uploaded png and eps
> versions if you want to take a look. The layout difference is not (in this
> case) huge but noticable, missing color I can live with.
>
> I don't know about PostScript much (cannot recall the difference between PS
> and EPS), but would it possible to take advantage of that print to file
> functionality somehow to produce the PS from which EPS could be created?
As I implemented the current scaled print function, I looked often at the 
specialities of the EPS export.

From theory ( I don't have enough time to do further evaluation at the 
moment ):
+ the low resolution which is used for the export could cause this deformation
   -> try to replace the following line
    in function: void UMLView::printToFile(QString filename,bool isEPS):
 OLD:  QPrinter *printer = new QPrinter(QPrinter::PrinterResolution);
 NEW: QPrinter *printer = new QPrinter(QPrinter::HighResolution);
 ==>> the current resolution of just 72dpi might cause this unwanted change
 ( another possible resolution might be: QPrinter::ScreenResolution , but this
    is not as good as HighResolution)

+ the gray scale mode can be avoided by the insertion of the following line
   after the line before ( the default color mode is gray scale ):
 printer->setColorMode( Color );


BOTH CHANGES IN umlview.cpp

Hope this helps,
Achim
  

Comment 7 Pekka Jääskeläinen 2004-09-15 16:14:40 UTC
To Sebastian: Yes, I'm running 1.3.0. I can choose quite a many file types, for example, EPS, PNG, JPG, BMP, SVG... I know PS is a scripting language to describe graphics. So, I know I can edit it with an ascii editor, but that's not what I call handy when I have to do it multiple times a day :) Maybe a script could handle this, but of course better avoid such hacks.

Achim: I'll try to download the sources / CVS HEAD at some point, and try your modifications out.

I'll get back to this later.
Pekka
Comment 8 Achim Spangler 2004-09-15 16:30:22 UTC
Am Mittwoch, 15. September 2004 15:55 schrieb Sebastian Stein:
> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
>
> http://bugs.kde.org/show_bug.cgi?id=89553
>
>
>
>
> ------- Additional Comments From seb_stein gmx de  2004-09-15 15:55 -------
>
> Pekka JÀÀskelÀinen <pjaaskel cs tut fi> [040915 15:49]:
> > ------- Additional Comments From pjaaskel cs tut fi  2004-09-15 15:13
> > I don't know about PostScript much (cannot recall the difference between
> > PS and EPS), but would it possible to take advantage of that print to
> > file functionality somehow to produce the PS from which EPS could be
> > created?
>
> PS is ascii, so if it is really important you can edit it with a text
> editor. But there might also be some ps editing programs around. Karbon
> seems to be such a program, but it can't load the ps files produced by
> Umbrello.

You might also try the normal Print action, and then select the special KDE 
print device for ps file generation. You could then convert the PS file to 
EPS.

Bye,
Achim

Comment 9 Pekka Jääskeläinen 2004-09-15 17:56:15 UTC
Achim: 

Following changes to the function you mentioned fixed the problem:

OLD:
  QPrinter *printer = new QPrinter(QPrinter::PrinterResolution);

NEW:  
  QPrinter *printer = new QPrinter(QPrinter::ScreenResolution);
  printer->setColorMode(QPrinter::Color);

When I tried QPrinter::HighResolution as the constructor argument, the output
was really messed. I'll upload the result so you'll see. BTW, why do you
want the default to be B/W? At least it would be nice to have the option of
outputing EPS in color somewhere, maybe add EPS (Color) and EPS (Black and 
White) in the file format menu to avoid writing a properties dialog for this 
single property?

While testing I came across to two other bugs (missing configure test for flex and one segfault crash) that I'll confirm and report next.

Anyways, if this EPS export fix is included in the next version, Umbrello will be a modelling tool I could use in my everyday work and avoid booting to Windows just because of Rational Rose.

Thanks a lot for that.
Comment 10 Pekka Jääskeläinen 2004-09-15 17:59:39 UTC
Created attachment 7547 [details]
Output with QPrinter *printer = new QPrinter(QPrinter::HighResolution);
Comment 11 Sebastian Stein 2004-09-16 20:57:46 UTC
Pekka JÀÀskelÀinen <pjaaskel@cs.tut.fi> [040916 20:53]:
> Achim: 
> 
> Following changes to the function you mentioned fixed the problem:
> 
> OLD:
>   QPrinter *printer = new QPrinter(QPrinter::PrinterResolution);
> 
> NEW:  
>   QPrinter *printer = new QPrinter(QPrinter::ScreenResolution);
>   printer->setColorMode(QPrinter::Color);
> 
> When I tried QPrinter::HighResolution as the constructor argument, the output
> was really messed. I'll upload the result so you'll see. BTW, why do you
> want the default to be B/W?

I would change it to color, if no reasons can presented why it should be in
black white. If black white is needed, it can be converted in an external
program.

Sebastian
Comment 12 Sebastian Stein 2004-09-20 10:18:45 UTC
PrinterResolution works fine for eps and for all other formats now ScreenResolution is used.
Comment 13 Pekka Jääskeläinen 2004-09-20 14:42:43 UTC
No, you got it exactly the wrong way around. ScreenResolution should be used for EPS, and, if you think it's necessary, the PrinterResolution for the other formats (I didn't actually test whether it breaks the other formats for some reason). The layouting with EPS is still broken for me because of PrinterResolution. 
Comment 14 Sebastian Stein 2004-09-20 16:04:10 UTC
Pekka JÀÀskelÀinen <pjaaskel@cs.tut.fi> [040920 15:48]:
> No, you got it exactly the wrong way around. ScreenResolution should be
> used for EPS, and, if you think it's necessary, the PrinterResolution for
> the other formats (I didn't actually test whether it breaks the other
> formats for some reason). The layouting with EPS is still broken for me
> because of PrinterResolution.

Have you tried the latest CVS HEAD version? I have tested it with png and
eps and it works. Here are my changes:

--- kdesdk/umbrello/umbrello/umlview.cpp  #1.175:1.176
@@ -1341,7 +1341,15 @@ void UMLView::printToFile(QString filena
         // user-coordinates, set to the resolution
         // of the printer (which should be 72dpi here)
-        QPrinter *printer = new QPrinter(QPrinter::PrinterResolution);
+        QPrinter *printer;
+
+        if (isEPS == true)
+        {
+                printer = new QPrinter(QPrinter::PrinterResolution);
+        } else {
+                printer = new QPrinter(QPrinter::ScreenResolution);
+        }
         printer->setOutputToFile(true);
         printer->setOutputFileName(filename);
+        printer->setColorMode(QPrinter::Color);

         // do not call printer.setup(); because we want no user


Sebastian
Comment 15 Pekka Jääskeläinen 2004-09-20 16:14:57 UTC
Sebastian Stein wrote:

> Have you tried the latest CVS HEAD version? I have tested it with png and
> eps and it works. Here are my changes:

Yes. It's CVS HEAD I tried. It did work for your resolution initially,
that's why I posted the samples how it looks like with my computer.

> +        if (isEPS == true)
> +        {
> +                printer = new QPrinter(QPrinter::PrinterResolution);
> +        } else {
> +                printer = new QPrinter(QPrinter::ScreenResolution);
> +        }

This is wrong. It doesn't lay out correctly for me. Colors are there
now, layout just is not working. It should be the other way around:

+        if (isEPS == true)
+        {
+                printer = new QPrinter(QPrinter::ScreenResolution);
+        } else {
+                printer = new QPrinter(QPrinter::PrinterResolution);
+        }
Comment 16 Sebastian Stein 2004-09-20 18:41:57 UTC
Pekka JÀÀskelÀinen <pjaaskel@cs.tut.fi> [040920 18:38]:
> > Have you tried the latest CVS HEAD version? I have tested it with png and
> > eps and it works. Here are my changes:
> 
> Yes. It's CVS HEAD I tried. It did work for your resolution initially,
> that's why I posted the samples how it looks like with my computer.
> 
> > +        if (isEPS == true)
> > +        {
> > +                printer = new QPrinter(QPrinter::PrinterResolution);
> > +        } else {
> > +                printer = new QPrinter(QPrinter::ScreenResolution);
> > +        }
> 
> This is wrong. It doesn't lay out correctly for me.

But it works for me, so it is not wrong ;-) No, it seems the problems lies
somewhere else I would say.

> +        if (isEPS == true)
> +        {
> +                printer = new QPrinter(QPrinter::ScreenResolution);
> +        } else {
> +                printer = new QPrinter(QPrinter::PrinterResolution);
> +        }

If I use those lines my diagram is too big and doesn't fit on a page. So the
eps shows only a part of the diagram. In both cases it doesn't make any
difference for the png export.

Sebastian
Comment 17 Achim Spangler 2004-09-20 19:03:13 UTC
Am Montag, 20. September 2004 18:41 schrieb Sebastian Stein:
> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
>
> http://bugs.kde.org/show_bug.cgi?id=89553
>
>
>
>
> ------- Additional Comments From seb_stein gmx de  2004-09-20 18:41 -------
>
> Pekka JÀÀskelÀinen <pjaaskel cs tut fi> [040920 18:38]:
> > > Have you tried the latest CVS HEAD version? I have tested it with png
> > > and eps and it works. Here are my changes:
> >
> > Yes. It's CVS HEAD I tried. It did work for your resolution initially,
> > that's why I posted the samples how it looks like with my computer.
> >
> > > +        if (isEPS == true)
> > > +        {
> > > +                printer = new QPrinter(QPrinter::PrinterResolution);
> > > +        } else {
> > > +                printer = new QPrinter(QPrinter::ScreenResolution);
> > > +        }
> >
> > This is wrong. It doesn't lay out correctly for me.
>
> But it works for me, so it is not wrong ;-) No, it seems the problems lies
> somewhere else I would say.
>
> > +        if (isEPS == true)
> > +        {
> > +                printer = new QPrinter(QPrinter::ScreenResolution);
> > +        } else {
> > +                printer = new QPrinter(QPrinter::PrinterResolution);
> > +        }
>
> If I use those lines my diagram is too big and doesn't fit on a page.
This Problem must then be fixed by a custom page size ( the Qt-Doc describes 
it, I thought custom size is default ) or by adding the same scaling function 
to EPS export as used for normal printout. But the _slightly_ but existing 
disturbance of layout is caused by the too low resolution.
> So 
> the eps shows only a part of the diagram. In both cases it doesn't make any
> difference for the png export.
The other bitmap exports use a different function. The QPRinter part is - as 
far as I understand the code - ony used for EPS export.
The bitmap files are created by a Image class, and not by QPrinter.

Bye,
Achim

Comment 18 Pekka Jääskeläinen 2004-09-26 11:23:06 UTC
Achim, are you going to fix this (do you have time?) or should I try to hack it to work somehow? It's the main distraction for me at the moment. One easy way out would be to make it possible to disable the footer from the PS printout, and use print to file functionality to get the well layouted PS.
Comment 19 Sebastian Stein 2004-09-26 16:15:14 UTC
Pekka JÀÀskelÀinen <pjaaskel@cs.tut.fi> [040926 15:46]:
> ------- Additional Comments From pjaaskel cs tut fi  2004-09-26 11:23
> ------- Achim, are you going to fix this (do you have time?) or should I
> try to hack it to work somehow? It's the main distraction for me at the
> moment. One easy way out would be to make it possible to disable the
> footer from the PS printout, and use print to file functionality to get
> the well layouted PS.

Just an idea, would it not be possible to use the print function also for
eps image export? What are the differences between ps and eps?

Sebastian
Comment 20 Pekka Jääskeläinen 2004-09-27 22:48:08 UTC
"Postscript is what you print; it contains multiple pages, page sizes etc.

EPS stands for "Encapsulated PostScript" It is an element (contain
graphics, text, fonts) that can be placed into QuarkXpress, PageMaker,
InDesign and other applications. It may also contain a preview (TIFF or
PICT) It does not contain a page size nor multiple pages."
-- http://www.planetpdf.com/forumarchive/64659.asp

I might take a look at this on weekend unless Achim has already a solution in
mind. Yes, we might be able to reuse the printing code for the EPS output,
probably that's the solution.
Comment 21 Alan Krempler 2004-12-16 17:07:23 UTC
i had the same problem with changed layout after exporting pictures. with me, not only the exported pictures looked different, but the exporting process changed the layout of the document being edited!
for the moment, i can get correct output when disabling the "snap to grid" feature.
while this works around the problem, there still is something to do. i don't think exporting the canvas is meant to change the layout of the document!

alan
Comment 22 Jonathan Riddell 2004-12-19 19:44:49 UTC
Alan: could you attach an XMI file where this happens?
Comment 23 Alan Krempler 2005-01-10 18:15:12 UTC
sorry for the delay, i have been trying to find or construct a file to reproduce the bug with.
alas, after opening the problematic files with umbrello 1.3.2 and disabling the "snap to grid" feature, the problem is gone.
after upgrading to 1.3.2, the problem showed up only on the _first_ open. i couldn't find any more copies of "unopened" files to demonstrate the problem nor could i construct a diagram with the problematic behaviour, so as far as i am concerned, the bug seems resolved.
Comment 24 Jonathan Riddell 2005-01-10 18:17:44 UTC
*** Bug has been marked as fixed ***.