Closed Bug 400955 Opened 17 years ago Closed 7 months ago

Feat: Implement (add) a JavaScript window.printpreview() method

Categories

(Core :: General, enhancement)

enhancement

Tracking

()

RESOLVED WONTFIX

People

(Reporter: scunliffe, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8

There are many circumstances when calling window.print() on a page is handy when developing web based applications, to (for example) print only the contents of a frame (say an SVG map).

However, this circumvents the print preview screen, which provides the much needed scaling, portrait/landscape options etc. (e.g. I often scale a print as desired, then print only pages 3-5)

To be honest, the method name can be whatever you want, or become an overloaded version of .print()

e.g.
window.print( boolean showPreview );


Either way, designers could take advantage of this new method, and provide the end users with a choice.

function printWindow( winObj ){
  var msg = 'Would you like to preview your print request?';
  if(confirm(msg)){
    winObj.printpreview();
  } else {
    winObj.print();    
  }
}


Reproducible: Always

Steps to Reproduce:
1. No steps - Feature Request
Actual Results:  
No JavaScript .printpreview() functionality available

Expected Results:  
Some level of JavaScript .printpreview() functionality
Note that Firefox on Mac doesn't have a print preview feature like Firefox on Windows.  Instead, the Print dialog has a Preview button, which acts like "Print to PDF" followed by showing the result in Preview.app.

Also note that Gecko has had memory safety bugs that only show up in print preview mode, so we can't let sites just put you in print preview mode.
Hmm, didn't know about the memory issue...  However if the user can do a print preview on any site, I'm guessing that solving the mem issue is something that can/should be done in parallel, rather than be a stumbling block for a feature like this?

I'm not a big Mac user, so I don't know this, but does Safari have a print preview button/feature from the menu?

I suppose if the OS of the browser doesn't directly support a print preview option, "upgrading" the call to a .print() wouldn't be too out of place (and in the Mac scenario, would provide that print preview option)
This is a mass search for bugs that are in the Firefox General component, are UNCO, and have not been changed for 1000 days and have an unspecified version. 

Reporter, can you please update to Firefox 3.6.10, create a fresh profile, http://support.mozilla.com/en-US/kb/managing+profiles, and test again. If you still see the bug, please update this bug. If the issue is gone, please set the resolution to RESOLVED > WORKSFORME.
Whiteboard: [CLOSEME 2010-11-01]
Whiteboard: [CLOSEME 2010-11-01]
OS: Windows XP → All
Product: Firefox → Core
QA Contact: general → general
Hardware: x86 → All
Version: unspecified → Trunk
Severity: normal → S3

window.print() always opens a print preview now.

Status: UNCONFIRMED → RESOLVED
Closed: 7 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.