Closed Bug 140718 Opened 19 years ago Closed 8 months ago

Add a "Print selection only" menu item to the context menu when there is a selection

Categories

(Toolkit :: Printing, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
Future
Tracking Status
firefox83 --- fixed

People

(Reporter: stefan.bach, Assigned: emilio, NeedInfo)

References

Details

(Whiteboard: [print2020_v83][old-ui-])

Attachments

(1 file)

When I want to print just a part of some web page I can select to print only the
marked text in the printing dialog that appears when selecting File - Print.
But I can't preview how the result will look like because there is no such
option in the print preview. The printing dialog only offers Ok and Cancel, no
Apply option to preview the changes.
The same applies to the Print Frames options in the printing dialog. I haven't
found an option to preview the different options. (Or is it there and I just
can't find it?)
Adding those options to print preview would be a great enhancement.
yes, would be nice
Status: UNCONFIRMED → NEW
Ever confirmed: true
Nice enhancement, at this time I don't IE even does a PP of the selection.
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → Future
*** Bug 144695 has been marked as a duplicate of this bug. ***
Summary: Print Preview always displays the complete web page → Add way to preview printing of selection
This is becoming increasingly desirable with all the extraneous **** on webpages
these days.  I almost exclusively use "print selection" -- everyone that knows
about this feature loves it.
  Print preview support of print selection (I'm thinking a button in preview
mode called "selection" that could be switched on or off to preview whatever had
been selected prior to entering the preview window) would give mozilla a nice
edge over IE.

on a similar note:
       Print preview should not cause deselection (it currently does in 1.7)
       and print selection should be implemented in Mail (there is a bug for this).
Flags: blocking-aviary2.0?
this is out of scope for Fx2, which is mostly a front end update, touching very little in the Gecko core.
Flags: blocking-aviary2? → blocking-aviary2-
If this can't make it into Fx 2.x, please at least add this for Fx 3.0.  I run into this inconvenience almost every time I want to print, as there's usually stuff on the page I don't want to print and there's not way to preview the selection to see how it's going to turn out.

Thanks.
The Mac version of Fx may need special attention to get this working, as it's not a part of the standard print dialog. But it'd certainly be welcome. Don't know why Apple has never bothered to include this feature...
(In reply to comment #7)
> The Mac version of Fx may need special attention to get this working, as it's
> not a part of the standard print dialog. But it'd certainly be welcome. Don't
> know why Apple has never bothered to include this feature...
> 

DOH! Of course it's right after I push the Commit button that I think to look at the Fx-specific portion of the dialog and discover that the feature is already there. Sorry. :-/

Assignee: rods → nobody
Status: ASSIGNED → NEW
QA Contact: sujay → printing
Print preview still causes deselect in Firefox 3.0.7. This is needed more than ever. Firefox superzoom bug (ignore scale -> print at >100%) makes this even more desperately needed.
Duplicate of this bug: 489068
I absolutely agree, this bug annoys me since almost three years, a fix would be very appreciated, thanks alot in advance :)
Duplicate of this bug: 498255
As FYI, IE7 does support this functionality (choose "Print Preview", then "As selected on screen") - if/when addressing this item, please also try to look at the Print Frames option for rendering accuracy.  Thank you
OS: Windows 2000 → All
Hardware: x86 → All
Adding print-selection for text search.
Duplicate of this bug: 1241109
Duplicate of this bug: 477485
The UI that bug 650966 was aiming to implement would fix this (there would be something like a "Selection only" checkbox that could be toggled in a Print Settings bar located to the side of the print preview contents).
Summary: Add way to preview printing of selection → [UX] Add a way to preview printing of selection
Blocks: 1660492

Mark, from the platform side, this should be supported by FrameLoader.printPreview now. You'd create a separate browser element for the selection print preview document, and do something like this when first creating the selection print preview document:

    // Clone and get the selection from the original print preview document:
    let originalPreviewBrowserWindowID = <get this>;
    settings.printRange = Ci.nsIPrintSettings.kRangeSelection;
    let {
      totalPageCount,
    } = await selectionPreviewBrowser.frameLoader.printPreview(
        settings, originalPreviewBrowserWindowID);
Component: Print Preview → Printing
Flags: needinfo?(mstriemer)
Product: Core → Toolkit
Summary: [UX] Add a way to preview printing of selection → Implement a "Print selection only" checkbox in the new print preview UI
Whiteboard: [print2020_v83][old-ui-]
No longer blocks: 1660492
Duplicate of this bug: 1660492
See Also: → 1666247

Emilio, I believe what's described in comment 18 is Fission compatible. Let me know if you see issues with that.

Flags: needinfo?(emilio)

I don't think so, specially if the selected text is in the OOP iframe. I don't think that works at all right now.

Flags: needinfo?(emilio)

We should bump this to P1 given it's one of our two highest-priority features for 83. That said, it sounds like per comment 21 a checkbox is still not an easy option.

Priority: P2 → P1

I'll try to prototype something, even though maybe not a checkbox... :-)

Flags: needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #21)

I don't think so, specially if the selected text is in the OOP iframe. I don't think that works at all right now.

If we had a field on BrowsingContext to indicate which BrowsingContexts have a selection, we could do a depth first traversal of them and select the first with a selection (or maybe something smarter [in future], such as preferring the first with a selection that is on-screen). We could then clone that BrowsingContext into a second print preview browser, setting Ci.nsIPrintSettings.kRangeSelection on the settings object that we pass when making the clone.

Is there an objection to making this work more like how "View selection source" works? Seems very similar to that feature.

By which you mean it would require using the context menu? Yeah, mainly that it's not very discoverable, and we wouldn't have parity with Chrome's much more discoverable checkbox in the print UI.

(In reply to Jonathan Watt [:jwatt] from comment #24)

If we had a field on BrowsingContext to indicate which BrowsingContexts have a selection

If it matters, we could set this field only for static clone docs (i.e. during the original clone).

(In reply to Jonathan Watt [:jwatt] from comment #26)

By which you mean it would require using the context menu? Yeah, mainly that it's not very discoverable, and we wouldn't have parity with Chrome's much more discoverable checkbox in the print UI.

I disagree with this argument FWIW. I didn't even know Chrome had such a feature, because you need to select before printing (which if you don't know the feature exists, you never do). Otherwise you'll never see the checkbox.

A context menu item seems much more discoverable to me, because it's where most of the other selection actions are, but maybe it's just me.

In fact, Chrome has a context menu > Print entry, when you have selected text.

(well, and when you don't, but it defaults to "Print selection only" when there's a selection)

Depends on: 1668767

This allows to use the feature from the context menu and is very
straight-forward.

This has the benefit of working with fission (as print from the focused
frame) and so on.

Making a checkbox on the UI on top of this is doable, but it is a lot
more complex (requires a bunch of both front-end and platform work)
because undoing this implies restoring the DOM which "print selection"
removes.

I think the context menu entry is very useful regardless of whether we
add a checkbox to undo it, and other browsers (with smaller context
menus) seem to agree.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

This is partial in the sense that it doesn't implement the actual checkbox to undo it. I think it's worth landing regardless, but let me know if you disagree.

In any case bug 1668767 should unblock most of the other work (I think we should be able to make the front-end work with that, modulo fission-compat, which is platform work).

Flags: needinfo?(emilio)
Duplicate of this bug: 184152
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3fa0c4e1bb95
Add a "Print selection only" entry to the context menu. r=Gijs,jwatt,fluent-reviewers
Regressions: 1669995
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
See Also: → 1670027
Blocks: 1670122

Changing the bug title to reflect what was actually implemented for this bug report.

I've spun off bug 1670122 to cover adding a "Print selection only" checkbox in the new print UI.

No longer blocks: 1670122
Summary: Implement a "Print selection only" checkbox in the new print preview UI → Add a "Print selection only" menu item to the context menu when there is a selection
Regressions: 1672864
You need to log in before you can comment on or make changes to this bug.