bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

allow printing to PDF file on gtk2-cairo

RESOLVED FIXED

Status

()

Core
Printing: Output
RESOLVED FIXED
12 years ago
11 years ago

People

(Reporter: Christian Persch (GNOME) (away; not receiving bug mail), Assigned: Christian Persch (GNOME) (away; not receiving bug mail))

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 3 obsolete attachments)

(Not sure this is the correct component; maybe -> Widget::Gtk ?)

Printing to file always prints to a PS file. That's because sDeviceContextSpecGTK::GetSurfaceForPrinter always creates a PS surface:

442 #ifdef USE_PDF
443   gfxPDFSurface *surface = new gfxPDFSurface(path, gfxSize(w, h));
444 #else
445   gfxPSSurface *surface = new gfxPSSurface(path, gfxSize(w, h));
446 #endif

and USE_PDF is undefined.

In Epiphany, I want to offer the choice to print to a PS or PDF file; so I need a programmatic switch here, not a compile time option.

Attached patch implements this by adding a new attribute "outputFormat" to nsIPrintSettings with values kOutputFormatPS|PDF.

Comment 2

12 years ago
Comment on attachment 252484 [details] [diff] [review]
patch

Should we have an OutputFormatNative or something that this defaults to?  Setting this to PS or PDF on windows and mac won't do what you'd hope for with this... thoughts?
Created attachment 252764 [details] [diff] [review]
add kOutputFormatNative and default to it

Yes, I think it makes sense to have kOutputFormatNative as default.
Attachment #252484 - Attachment is obsolete: true
Attachment #252764 - Flags: review?(pavlov)
Attachment #252484 - Flags: review?(pavlov)

Updated

12 years ago
Attachment #252764 - Flags: superreview+
Attachment #252764 - Flags: review?(pavlov)
Attachment #252764 - Flags: review+

Comment 4

12 years ago
Comment on attachment 252764 [details] [diff] [review]
add kOutputFormatNative and default to it

actually, is there any reason to have mOutputFormat on the devicecontextspec?  would it be easier to just call mPrintSettings->GetOutputFormat in GetSurfaceForPrinter?

Updated

12 years ago
Blocks: 369930
(In reply to comment #4)
> (From update of attachment 252764 [details] [diff] [review])
> actually, is there any reason to have mOutputFormat on the devicecontextspec? 
> would it be easier to just call mPrintSettings->GetOutputFormat in
> GetSurfaceForPrinter?

I just followed how the other print settings are cached in the devicecontextspec; if you prefer it without that, I change the patch.

Updated

12 years ago
Assignee: printing → chpe
Status: UNCONFIRMED → NEW
Ever confirmed: true
Created attachment 259700 [details] [diff] [review]
updated patch

Updated patch to trunk. I removed the caching of the setting, and added a null check.
Created attachment 273828 [details] [diff] [review]
unbitrotted, updated patch
Attachment #252764 - Attachment is obsolete: true
Attachment #259700 - Attachment is obsolete: true
Attachment #273828 - Flags: review?(pavlov)

Updated

11 years ago
Attachment #273828 - Flags: review?(pavlov) → review+
Does this need sr, or is this ready for checkin?

Comment 9

11 years ago
I guess it does need sr (see the log: http://bonsai.mozilla.org/cvslog.cgi?file=mozilla/widget/src/gtk2/nsDeviceContextSpecG.cpp), but you can request that from pavlov as well. Or ask roc.
Attachment #273828 - Flags: superreview?(roc)
Attachment #273828 - Flags: superreview?(roc) → superreview+
Keywords: checkin-needed

Comment 10

11 years ago
You now need to request approval1.9 as well, and provide a short evaluation of risk and benefit of the patch...
http://groups.google.com/group/mozilla.dev.planning/browse_thread/thread/569a23ce266a451/265344ae5291dee0

Updated

11 years ago
Attachment #273828 - Flags: approval1.9?

Updated

11 years ago
Attachment #273828 - Flags: approval1.9? → approval1.9+
The patch has no risk at all since it's just replacing an |#ifdef| with an |if ()| which will take the same branch as the #ifdef by default (the default value is kOutputFormatNative; and no code in mozilla sets it to any other value). The benefit is for embedders (Epiphany) that want to allow printing to PDF file instead of PS file.

Comment 12

11 years ago
Patch checked into trunk.
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Keywords: checkin-needed
Resolution: --- → FIXED

Updated

11 years ago
No longer blocks: 369930
Depends on: 369930
You need to log in before you can comment on or make changes to this bug.