Closed Bug 465305 Opened 14 years ago Closed 13 years ago

Save page


(Firefox for Android Graveyard :: General, enhancement)

Not set


(Not tracked)



(Reporter: christian.bugzilla, Assigned: vingtetun)



(Keywords: uiwanted)


(1 file, 2 obsolete files)

No description provided.
It's worth thinking about what use-case this serves, I think.  Why do we think that users will be saving pages on their mobile devices?

- is it to keep being able to use a page's content when they're out of network range?  would a "use this page while offline?" option be better?

- is it to save something like a boarding pass or receipt?  (maybe this is just a subcase of the first one) -- something like save as PDF might be more appropriate?
What I had in mind was to be able to access a page while offline and something that is a one-time URL like you mentioned e.g. boarding pass, receipts, confirmations for posted data, etc.
Flags: wanted-fennec1.0?
Target Milestone: Fennec A2 → Fennec A3
Blocks: 477628
tracking-fennec: --- → 1.0b2+
tracking-fennec: 1.0b2+ → 1.0b3+
Assignee: nobody → madhava
tracking-fennec: 1.0b3+ → ---
Flags: wanted-fennec1.0? → wanted-fennec1.0+
Save page as PDF would be best use case in mobile devices so that the you can get "hard" copy of pages such as tickets, boarding passes etc. Also sharing of saved pages via email or via some service would make sense.
For the addition of this item to the site menu, let's use

"Save as PDF"

for the menu item.
Attached patch wip (obsolete) — Splinter Review
This wip add a new action in the site menu to "print" a document as PDF.

bug 162659#c51 give me doubt about the fact that this simply works as if on device because of the lack of installed printer(s).
Comment on attachment 434748 [details] [diff] [review]

>diff -r 3bca60979f8e chrome/content/browser-ui.js

>+  _savePageAsPDF: function saveAsPDF() {
>+    let content = getBrowser().contentWindow;

Can we call this "contentWindow"? There is a special "content" property I don't want to confuse. And use "Browser.selectedBrowser" instead of getBrowser(). I'd like to remove getBrowser() someday.

>+    let nsIFilePicker = Components.interfaces.nsIFilePicker;

Remove this line. We can use "Ci.nsIFilePicker" just as easily

>+    let picker = Components.classes[";1"].createInstance(nsIFilePicker);

Use Cc and Ci.nsIFilePicker

>+    // XXX change that
>+    picker.init(window, "Save As PDF", nsIFilePicker.modeSave);
>+    picker.appendFilter("PDF", "*.pdf");
>+    picker.defaultExtension = "pdf";
>+    picker.defaultString = content.document.title;

Also, when testing this on my N900, the filename did not have ".pdf" appended by the file picker. You might want to manually append it yourself.

>+    let webBrowserPrint = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
>+                                 .getInterface(Components.interfaces.nsIWebBrowserPrint);
>+    let PSSVC = Components.classes[";1"]
>+                          .getService(Components.interfaces.nsIPrintSettingsService);

More Cc and Ci

>+    let printSettings = PSSVC.newPrintSettings;
>+    printSettings.printSilent     = true;
>+    printSettings.showPrintProgress = false;
>+    printSettings.printBGImages   = true;
>+    printSettings.printBGColors   = true;
>+    printSettings.printToFile     = true;
>+    printSettings.toFileName      = picker.file.path;
>+    printSettings.outputFormat    = Components.interfaces.nsIPrintSettings.kOutputFormatPDF;

Use Ci.

And I think we want to use printSettings.printFrameType = Ci.nsIPrintSettings.kFramesAsIs

We should also get the pagecommand "type" thing working soon so we don't need to add and remove the command.
Attached patch Patch (obsolete) — Splinter Review
Address comments.

> We should also get the pagecommand "type" thing working soon so we don't need
> to add and remove the command.

I'll add support for the "type" attribute into bug bug 552526.
Also after playing with it I think this command need to disappear sometimes (or do we want to disabled it? - asking question into bug 552526) because this don't work for XUL pages as example (bug 136185)
Attachment #434748 - Attachment is obsolete: true
Attachment #434850 - Flags: review?(mark.finkle)
Attached patch Patch v0.2Splinter Review
This patch add some codes to remove the footer/header.
Assignee: madhava → 21
Attachment #434850 - Attachment is obsolete: true
Attachment #435238 - Flags: review?(mark.finkle)
Attachment #434850 - Flags: review?(mark.finkle)
Comment on attachment 435238 [details] [diff] [review]
Patch v0.2

works on n900, linux and windows
Attachment #435238 - Flags: review?(mark.finkle) → review+
Closed: 13 years ago
Resolution: --- → FIXED
Flags: in-litmus?
verified FIXED on builds:

Mozilla/5.0 (X11; U; Linux armv7l; Nokia N900; en-US; rv: Gecko/20100329 Namoroka/3.6.3pre Fennec/1.1a2pre


Mozilla/5.0 (X11; U; Linux armv7l; Nokia N900; en-US; rv:1.9.3a4pre) Gecko/20100329 Namoroka/3.7a4pre Fennec/1.1a2pre

folow-up bugs:

We need a new BFT that references these test cases on the site panel. There's some security testcases for that panel in the Security BFT that we'll also need to move over to the new BFT.
litmus testcase created to regression test this bug
Flags: in-litmus? → in-litmus+
You need to log in before you can comment on or make changes to this bug.