Closed Bug 367907 Opened 18 years ago Closed 17 years ago

allow printing to PDF file on gtk2-cairo

Categories

(Core :: Printing: Output, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: chpe, Assigned: chpe)

References

()

Details

Attachments

(1 file, 3 obsolete files)

(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.
Attached patch patch (obsolete) — Splinter Review
Attachment #252484 - Flags: review?(pavlov)
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?
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)
Attachment #252764 - Flags: superreview+
Attachment #252764 - Flags: review?(pavlov)
Attachment #252764 - Flags: review+
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?
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.

Assignee: printing → chpe
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch updated patch (obsolete) — Splinter Review
Updated patch to trunk. I removed the caching of the setting, and added a null check.
Attachment #252764 - Attachment is obsolete: true
Attachment #259700 - Attachment is obsolete: true
Attachment #273828 - Flags: review?(pavlov)
Attachment #273828 - Flags: review?(pavlov) → review+
Does this need sr, or is this ready for checkin?
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+
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
Attachment #273828 - Flags: approval1.9?
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.
Patch checked into trunk.
Status: NEW → RESOLVED
Closed: 17 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
No longer blocks: 369930
Depends on: 369930
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: