Closed Bug 1187581 Opened 5 years ago Closed 1 year ago

Have a way to properly debug print previews

Categories

(DevTools :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1534984

People

(Reporter: julienw, Unassigned)

References

Details

Printing output has several bugs (see for example bug 521204 and its dependencies) and being able to inspect and change CSS and see the result in real time could help a lot to workaround the issues.
I would kill to have this. Debugging print CSS is a complete throwback to the 90s in terms of developer experience. I just spent basically an hour changing random things until Firefox would kindly stop truncating my print view to just the one page (and just like it was in the 90s, in the end I'm still not sure what fixed it...).

This would fit great into the Responsive View tool. Is there a way to trigger rendering in a specific media?
(In reply to Robin Berjon from comment #1)
> I would kill to have this. Debugging print CSS is a complete throwback to
> the 90s in terms of developer experience. I just spent basically an hour
> changing random things until Firefox would kindly stop truncating my print
> view to just the one page (and just like it was in the 90s, in the end I'm
> still not sure what fixed it...).
> 
> This would fit great into the Responsive View tool. Is there a way to
> trigger rendering in a specific media?

Are you trying to debug a print-only style sheet?  Or something else?
Flags: needinfo?(robin)
I'm debugging `@media print` for the print view, so not precisely a print-only sheet so much as print-only sections (if that makes any difference).

But ideally it shouldn't matter which way it's done. I'd love to just have a button in the developer tools to "Show as Print" that I could use to debug the print output live, rather than edit -> reload -> print -> show pdf -> find problem -> edit...
Flags: needinfo?(robin)
(In reply to Robin Berjon from comment #3)
> I'm debugging `@media print` for the print view, so not precisely a
> print-only sheet so much as print-only sections (if that makes any
> difference).
> 
> But ideally it shouldn't matter which way it's done. I'd love to just have a
> button in the developer tools to "Show as Print" that I could use to debug
> the print output live, rather than edit -> reload -> print -> show pdf ->
> find problem -> edit...

Have you used the Developer Toolbar[1] before?

It has a command `media emulate print` to show the page with print stylesheets.  Does this help?

[1]: https://developer.mozilla.org/en-US/docs/Tools/GCLI#Opening_the_Developer_Toolbar
Flags: needinfo?(robin)
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #4)
> It has a command `media emulate print` to show the page with print
> stylesheets.  Does this help?

I had tried it (or a precursor?) quite a while ago but it didn't seem to do much at the time so I didn't look again. This is very cool, thanks!

Just a few notes:
  - ideally it would change the viewport to a paper size
  - it should trigger onbefore/afterprint (and matchMedia — it might do the latter, that's not a code path I hit on Firefox)
  - it would be sweet to have that in the UI

Thanks!
Flags: needinfo?(robin)
Product: Firefox → DevTools

Marking this as a duplicate of Bug1534984, which has been fixed. Toggling print simulation for the page is available as a button in the Rule View toolbar in Nightly.

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1534984

The button added as :mtigley mentioned does not fully implement the requested features.

As Robin Berjon suggested, it would be really great, if the current Print Preview would be debugable using the Developer tools.

The Print Preview provides features as defining paper size, page orientation and so on. Additionally it shows page breaks.
All these features are not available when using the currently available print simulation.

It is possible to open the developer tools in the Print Preview, but the Inspector is not usable, as interaction with the website are not possible.

You need to log in before you can comment on or make changes to this bug.