Skip to content

Commit 80bd7ae

Browse files
committed
Deprecate printToFile in favor of File IO. Per #730
1 parent 572191a commit 80bd7ae

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

js/qz-tray.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ var qz = (function() {
921921
* Set the printer assigned to this config.
922922
* @param {string|Object} newPrinter Name of printer. Use object type to specify printing to file or host.
923923
* @param {string} [newPrinter.name] Name of printer to send printing.
924-
* @param {string} [newPrinter.file] Name of file to send printing.
924+
* @param {string} [newPrinter.file] DEPRECATED: Name of file to send printing.
925925
* @param {string} [newPrinter.host] IP address or host name to send printing.
926926
* @param {string} [newPrinter.port] Port used by <printer.host>.
927927
*/
@@ -930,6 +930,13 @@ var qz = (function() {
930930
newPrinter = { name: newPrinter };
931931
}
932932

933+
if(newPrinter && newPrinter.file) {
934+
// TODO: Warn for UNC paths too https://github.com/qzind/tray/issues/730
935+
if(newPrinter.file.indexOf("\\\\") != 0) {
936+
_qz.log.warn("Printing to file is deprecated. See https://github.com/qzind/tray/issues/730");
937+
}
938+
}
939+
933940
this.printer = newPrinter;
934941
};
935942

sample.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,9 @@ <h4 class="panel-title">Options</h4>
11931193
<div class="form-group">
11941194
<label for="askFile">File:</label>
11951195
<input type="text" id="askFile" class="form-control" value="C:\tmp\example-file.txt" />
1196+
<hr />
1197+
<p><span class="text-danger" style="font-weight:bold;"><span class="fa fa-warning"></span> WARNING:</span> This feature has been deprecated. Please configure a local raw <code>FILE:</code> printer, or use <code>File IO</code></a> instead. For more
1198+
information please see <a href="https://github.com/qzind/tray/issues/730">issue&nbsp;<code>#730</code>.</a></p>
11961199
</div>
11971200
</div>
11981201
<div class="modal-footer">

0 commit comments

Comments
 (0)