diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5113569 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +src/install.rdf diff --git a/README.md b/README.md new file mode 100644 index 0000000..88c60c9 --- /dev/null +++ b/README.md @@ -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. diff --git a/dist/cmdlnprint_0.6.0_.xpi b/dist/cmdlnprint_0.6.0.eobrain-2_.xpi similarity index 91% rename from dist/cmdlnprint_0.6.0_.xpi rename to dist/cmdlnprint_0.6.0.eobrain-2_.xpi index d71ec4d..39a6fca 100644 Binary files a/dist/cmdlnprint_0.6.0_.xpi and b/dist/cmdlnprint_0.6.0.eobrain-2_.xpi differ diff --git a/src/chrome/content/mininav.js b/src/chrome/content/mininav.js index 6fe8175..bbfbfb7 100644 --- a/src/chrome/content/mininav.js +++ b/src/chrome/content/mininav.js @@ -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"); @@ -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; } @@ -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); diff --git a/src/components/cmdlnprint.js b/src/components/cmdlnprint.js index 704c687..01496c9 100644 --- a/src/components/cmdlnprint.js +++ b/src/components/cmdlnprint.js @@ -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]); } }, diff --git a/src/version.txt b/src/version.txt index a918a2a..033c855 100644 --- a/src/version.txt +++ b/src/version.txt @@ -1 +1 @@ -0.6.0 +0.6.0.eobrain-2