Open Bug 525998 Opened 15 years ago Updated 2 years ago

Add support for SVG output format when printing to file for Gtk builds


(Core :: Widget: Gtk, defect, P5)





(Reporter: dholbert, Unassigned)




(3 files)

In Ubuntu Karmic, the Gnome "print" dialog's print-to-file mode includes an option for SVG output (along with PS and PDF).  However, if I select this mode in Firefox, the resulting ".svg" file *actually* contains postscript.

 1. File | Print
 2. Select "Print To File" from the printer list
 3. Select "SVG" as the Output Format, and enter in a name for the file.
 4. Examine the resulting file

EXPECTED RESULTS: Outputted file should be an SVG (or, "SVG" output mode should not be available)
ACTUAL RESULTS: Examining the text of the outputted file shows that it's actually a postscript file.

 * Ubuntu 9.10
 * Gnome 2.28.1
 * Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.3a1pre) Gecko/20091030 Minefield/3.7a1pre
I just tried printing "about:blank" once as Postscript and once as SVG, and the outputted files were identical. (aside from the "%%CreationDate:" header)
Here's a screenshot of the print dialog that I get from Firefox, with "SVG" available as an output format.
SVG is a new format in the print dialog we don't handle yet. I'm wondering if there's a way for us to tell GTK we don't support it.
We can support it. We just need to use the cairo SVG backend.
Ah, of course.
Attached patch PatchSplinter Review
This hould work in theory, but I can't get it to compile because it keeps giving this error during libxul linking:

In function `_cairo_svg_surface_emit_composite_pattern':
cairo-svg-surface.c:(.text+0x1cc0): undefined reference to `INT__moz_cairo_surface_write_to_png_stream'

I don't know how we build Cairo and I don't have the time right now to deal with it. Does anyone who understands this knows what's going on?
Looks like we are not compiling cairo-png.c
Attached patch Updated patchSplinter Review
* Some libpng features which are disabled currently are enabled to compile cairo-png.c

* Use SVG 1.2 to adopt what gtk applications do.
Using SVG 1.1, cairo fallbacks almost contents and only renders last page.
Using SVG 1.2, cairo uses less fallback images and generates multi-page SVG using the SVG Print 1.2 elements.
# I wonder if there are any implementation of the SVG Print 1.2.
> --- a/widget/src/gtk2/nsPrintDialogGTK.cpp
> +++ b/widget/src/gtk2/nsPrintDialogGTK.cpp
> @@ -209,18 +209,16 @@ nsPrintDialogWidgetGTK::nsPrintDialogWid
> -                      | GTK_PRINT_CAPABILITY_GENERATE_PDF
> -                      | GTK_PRINT_CAPABILITY_GENERATE_PS

IMHO it would be better to keep these set and add the SVG variant, in case Gtk+ adds yet another format (in which case not specifying anything would bring up the new unsupported format in the print dialog, like it happened when SVG was added in Gtk+)
BTW, the originally reported issue is gone with bug 546093. This bug is now about allowing SVG as an output format.
Summary: Firefox "print-to-file" has SVG Output Format available, but the result is actually postscript → Add support for SVG output format when printing to file for Gtk builds
Hmm, GTK+ lacks a constant to specify whether application supports SVG output.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.