Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*~
src/install.rdf
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Firefox Extension for Command-Line Print
========================================

This is a fork of Torisugari's code, which adds a `-noheadfoot`
option. See [his documentation of an older
version](http://sites.google.com/site/torisugari/commandlineprint2).

When this extension is installed in your Firefox you can use it like this:

firefox -print http://www.example.com/index.html
firefox -print http://www.example.com/index.html -printmode PNG
firefox -print http://www.example.com/index.html -printdelay 10
firefox -print http://www.example.com/index.html -printmode pdf -printfile ../foo.pdf
firefox -print http://www.example.com/index.html -printmode pdf -printfile ../foo.pdf -noheadfoot

The new `-noheadfoot` options suppresses the header and footer that
would otherwise be added to the printed page.
Binary file not shown.
15 changes: 14 additions & 1 deletion src/chrome/content/mininav.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ function printmode() {
return mode;
}

function noheadfoot() {
return window.arguments && window.arguments[5];
}

function printWithCanvas() {
var canvas = document.createElementNS("http://www.w3.org/1999/xhtml",
"canvas");
Expand Down Expand Up @@ -353,7 +357,7 @@ function delayedPrintPageLoadComplete() {
}

// We can't convert from XUL to printable format.
if (content.document.contentType = "text/xul") {
if (content.document.contentType == "text/xul") {
delayedShutdown();
return;
}
Expand Down Expand Up @@ -410,6 +414,15 @@ function delayedPrintPageLoadComplete() {
*/
settings.printerName = printerName;

if ( noheadfoot() ) {
settings.headerStrLeft = "";
settings.headerStrCenter = "";
settings.headerStrRight = "";
settings.footerStrLeft = "";
settings.footerStrCenter = "";
settings.footerStrRight = "";
}

/* We have no interest on those other than prefs. */
printSettingsService.initPrintSettingsFromPrefs
(settings, true, Components.interfaces.nsIPrintSettings.kInitSaveAll);
Expand Down
4 changes: 3 additions & 1 deletion src/components/cmdlnprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ var gComponent = {

param = aCmdLine.handleFlagWithParam("printprinter", false);
var printer = param;

var noheadfoot = aCmdLine.handleFlag("noheadfoot",false);

openWindow(null, "chrome://cmdlnprint/content/mininav.xul", "_blank",
"chrome,dialog=no,all",
[uri.spec, mode.toString(), path, delay, printer]);
[uri.spec, mode.toString(), path, delay, printer, noheadfoot]);
}
},

Expand Down
2 changes: 1 addition & 1 deletion src/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.0
0.6.0.eobrain-2