Closed Bug 306653 Opened 20 years ago Closed 7 years ago

[UX] enhancement: Paper Size Setup in Mozilla Browser

Categories

(Core :: Printing: Output, enhancement)

1.7 Branch
x86
Linux
enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: wzhao, Unassigned)

Details

Attachments

(4 files)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 we want an option to enter the Paper Height and Width(in mm) for printing through Mozilla browser. As of now only predefined paper Size is available for printing. Reproducible: Always Steps to Reproduce: file->print->properties Actual Results: we can't customize paper size Expected Results: we can input paper size i try fixxing this enhancement .here is the code. hope this is helpful ./gfx/src/ps/nsPostScriptObj.cpp /* Find PS paper size record by name */ aSpec->GetPaperName(&(mPrintSetup->paper_name)); - nsPaperSizePS paper; - if (!paper.Find(mPrintSetup->paper_name)) + nsPaperSizePS paper; + if(strcmp((mPrintSetup->paper_name), "Custom") == 0) { + nsCOMPtr<nsIPrefBranch> mPrefBranch; + nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (prefService) + prefService->GetBranch("print.", getter_AddRefs(mPrefBranch)); + char* realwidth; + char* realheight; + mPrefBranch->GetCharPref("printer_PostScript/printer.print_paper_width", &realwidth); + mPrefBranch->GetCharPref("printer_PostScript/printer.print_paper_height", &realheight); + mPrintSetup->width = NS_MILLIMETERS_TO_TWIPS(atoi(realwidth)); + mPrintSetup->height = NS_MILLIMETERS_TO_TWIPS(atoi(realheight)); + + } else if (paper.Find(mPrintSetup->paper_name)) { + mPrintSetup->width = NS_MILLIMETERS_TO_TWIPS(paper.Width_mm()); + mPrintSetup->height = NS_MILLIMETERS_TO_TWIPS(paper.Height_mm()); + } else return NS_ERROR_GFX_PRINTER_PAPER_SIZE_NOT_SUPPORTED; aSpec->GetLandscape( landscape ); - mPrintSetup->width = NS_MILLIMETERS_TO_TWIPS(paper.Width_mm()); - mPrintSetup->height = NS_MILLIMETERS_TO_TWIPS(paper.Height_mm()); - if (landscape) { nscoord temp = mPrintSetup->width; mPrintSetup->width = mPrintSetup->height; ./gfx/src/ps/nsPaperPS.cpp @@ -50,6 +50,7 @@ { "A5", SIZE_MM(148), SIZE_MM(210), PR_TRUE }, { "A4", SIZE_MM(210), SIZE_MM(297), PR_TRUE }, { "A3", SIZE_MM(297), SIZE_MM(420), PR_TRUE }, + { "Custom", SIZE_MM(0), SIZE_MM(0), PR_TRUE }, { "Letter", SIZE_INCH(8.5), SIZE_INCH(11), PR_FALSE }, { "Legal", SIZE_INCH(8.5), SIZE_INCH(14), PR_FALSE }, { "Executive", SIZE_INCH(7.5), SIZE_INCH(10), PR_FALSE }, ./toolkit/components/printing/content/printjoboptions.js @@ -99,6 +99,9 @@ dialog.paperList = document.getElementById("paperList"); dialog.paperGroup = document.getElementById("paperGroup"); + dialog.paperWidth = document.getElementById("paperWidth"); + dialog.paperHeight = document.getElementById("paperHeight"); + dialog.plexList = document.getElementById("plexList"); dialog.plexGroup = document.getElementById("plexGroup"); @@ -538,6 +541,9 @@ gPrintSettings = window.arguments[0].QueryInterface(gPrintSetInterface); paramBlock = window.arguments[1].QueryInterface(Components.interfaces.nsIDialogParamBlock); + dialog.paperWidth.value = gPrintSettings.paperWidth; + dialog.paperHeight.value = gPrintSettings.paperHeight; + if (doDebug) { if (gPrintSettings == null) alert("PrintSettings is null!"); if (paramBlock == null) alert("nsIDialogParam is null!"); @@ -572,14 +578,19 @@ print_paper_name = gPaperArray[paperSelectedInx].name; print_plex_name = gPlexArray[plexSelectedInx].name; gPrintSettings.paperSize = gPaperArray[paperSelectedInx].paperSize; // deprecated - - gPrintSettings.paperSizeType = print_paper_type; - gPrintSettings.paperSizeUnit = print_paper_unit; - gPrintSettings.paperWidth = print_paper_width; - gPrintSettings.paperHeight = print_paper_height; - gPrintSettings.paperName = print_paper_name; - gPrintSettings.plexName = print_plex_name; - + + gPrintSettings.paperName = print_paper_name; + if(print_paper_name != "Custom") { + gPrintSettings.paperSizeType = print_paper_type; + gPrintSettings.paperSizeUnit = print_paper_unit; + gPrintSettings.paperWidth = print_paper_width; + gPrintSettings.paperHeight = print_paper_height; + gPrintSettings.plexName = print_plex_name; + } else { + gPrintSettings.paperWidth = dialog.paperWidth.value; + gPrintSettings.paperHeight = dialog.paperHeight.value; + } + // save these out so they can be picked up by the device spec gPrintSettings.printInColor = dialog.colorRadio.selected; gPrintSettings.printCommand = dialog.cmdInput.value; ./toolkit/components/printing/content/printjoboptions.xul @@ -71,7 +71,14 @@ <menupopup/> </menulist> </row> - + <row id="widthGroup"> + <label value="Paper width"/> + <textbox id="paperWidth" size="5" onfocus="this.select()" tabindex="2"/> + </row> + <row id="heightGroup"> + <label value="Paper height"/> + <textbox id="paperHeight" size="5" onfocus="this.select()" tabindex="1"/> + </row> <row id="plexGroup"> <hbox align="center" pack="end"> <label id="plexLabel" value="&plexInput.label;"/>
Assignee: query-and-buglist → guifeatures
Component: Query/Bug List → XP Apps: GUI Features
Product: Bugzilla → Mozilla Application Suite
QA Contact: default-qa
Summary: enhancement: Paper Size Setup in Mozilla Browser → enhancement: Paper Size Setup in Mozilla Browser
Version: unspecified → 1.7 Branch
please attach patches using the "Create a new attachment" url here (https://bugzilla.mozilla.org/attachment.cgi?bugid=306653&action=enter)
Assignee: guifeatures → printing
Component: XP Apps: GUI Features → Printing
Product: Mozilla Application Suite → Core
I think you'll need to patch the SeaMonkey suite files if you want this for SeaMonkey as well, toolkit files are for Firefox/Thunderbird (unless they're shared nowadays?): xpfe/global/resources/content/unix/printjoboptions.js xpfe/global/resources/content/unix/printjoboptions.xul
Assignee: printing → nobody
QA Contact: printing
In the 13 years since this bug was filed there have been 2 CCs. Since the demand for this is very small we won't be complicating the UI to cater for this use case. Users can add new paper sizes in their system settings.
Summary: enhancement: Paper Size Setup in Mozilla Browser → [UX] enhancement: Paper Size Setup in Mozilla Browser
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: