客户端打印设置与打包设置
This commit is contained in:
@ -157,7 +157,11 @@ let main ={
|
||||
click: () => {
|
||||
this.exitSoft(respath);
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
label:'版本号:2.1.5',
|
||||
icon: respath + path.sep+ "static"+ path.sep+"images"+ path.sep+"paste.png",
|
||||
},]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# For documentation, see https://www.sumatrapdfreader.org/settings/settings3.2.html
|
||||
# For documentation, see https://www.sumatrapdfreader.org/settings/settings3-3-1.html
|
||||
|
||||
MainWindowBackground = #80fff200
|
||||
EscToExit = false
|
||||
@ -13,6 +13,7 @@ FixedPageUI [
|
||||
SelectionColor = #f5fc0c
|
||||
WindowMargin = 2 4 2 4
|
||||
PageSpacing = 4 4
|
||||
HideScrollbars = false
|
||||
]
|
||||
EbookUI [
|
||||
FontName = Georgia
|
||||
@ -46,6 +47,9 @@ ForwardSearch [
|
||||
HighlightColor = #6581ff
|
||||
HighlightPermanent = false
|
||||
]
|
||||
Annotations [
|
||||
HighlightColor = #ffff00
|
||||
]
|
||||
CustomScreenDPI = 0
|
||||
|
||||
RememberStatePerDocument = true
|
||||
@ -63,6 +67,7 @@ WindowPos = 0 0 0 0
|
||||
ShowToc = true
|
||||
SidebarDx = 0
|
||||
TocDy = 0
|
||||
TreeFontSize = 0
|
||||
ShowStartPage = true
|
||||
UseTabs = true
|
||||
|
||||
@ -71,6 +76,6 @@ FileStates [
|
||||
SessionData [
|
||||
]
|
||||
TimeOfLastUpdateCheck = 0 0
|
||||
OpenCountWeek = 523
|
||||
OpenCountWeek = 604
|
||||
|
||||
# Settings after this line have not been recognized by the current version
|
||||
|
||||
BIN
src/js/module/pdf-to-printer/dist/SumatraPDF.exe
vendored
BIN
src/js/module/pdf-to-printer/dist/SumatraPDF.exe
vendored
Binary file not shown.
3
src/js/module/pdf-to-printer/dist/bundle.js
vendored
3
src/js/module/pdf-to-printer/dist/bundle.js
vendored
File diff suppressed because one or more lines are too long
11
src/js/module/pdf-to-printer/dist/types.d.ts
vendored
11
src/js/module/pdf-to-printer/dist/types.d.ts
vendored
@ -1,11 +0,0 @@
|
||||
export interface Options {
|
||||
printer?: string;
|
||||
unix?: string[];
|
||||
win32?: string[];
|
||||
}
|
||||
|
||||
export function print(path: string, options?: any): Promise<void>;
|
||||
|
||||
export function getPrinters(): Promise<string[]>;
|
||||
|
||||
export function getDefaultPrinter(): Promise<string>;
|
||||
@ -8,6 +8,8 @@ const screen = electron.screen;
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const ipcMain = electron.ipcMain;
|
||||
const print_operation=require("."+path.sep+"print_operation");
|
||||
const os = require('os');
|
||||
const fs = require("fs");
|
||||
|
||||
let print_monitor={
|
||||
printerList_win:null,
|
||||
@ -62,15 +64,40 @@ let print_monitor={
|
||||
return listPrinter
|
||||
}).then(listPrinter => {
|
||||
print_operation.getDefaultPrinter().then(defaultPrinter => {
|
||||
let data = {
|
||||
listPrinter: listPrinter,
|
||||
defaultPrinter: defaultPrinter,
|
||||
pdf_url: pdf_url
|
||||
let data ={}
|
||||
//获取打印缓存
|
||||
print_url = os.homedir()+path.sep+"AppData/Local/justarData/print/print.json"
|
||||
log.info("打印机缓存文件:"+print_url);
|
||||
if(fs.existsSync(print_url)){
|
||||
fs.readFile(print_url,'utf8',(err,data) =>{
|
||||
if(err){
|
||||
log.error("获取打印机缓存失败");
|
||||
}else {
|
||||
let printer_json = JSON.parse(data);
|
||||
defaultPrinter = printer_json.printer_name;
|
||||
data = {
|
||||
listPrinter: listPrinter,
|
||||
defaultPrinter: defaultPrinter,
|
||||
pdf_url: pdf_url
|
||||
}
|
||||
win.show();
|
||||
let json_data = JSON.stringify(data);
|
||||
log.info("打印机列表数据【"+json_data+"】")
|
||||
win.webContents.send('printerData', json_data);
|
||||
}
|
||||
})
|
||||
}else{
|
||||
data = {
|
||||
listPrinter: listPrinter,
|
||||
defaultPrinter: defaultPrinter.name,
|
||||
pdf_url: pdf_url
|
||||
}
|
||||
win.show();
|
||||
let json_data = JSON.stringify(data)
|
||||
log.info("打印机列表数据【"+json_data+"】")
|
||||
win.webContents.send('printerData', json_data);
|
||||
}
|
||||
win.show();
|
||||
let json_data = JSON.stringify(data)
|
||||
log.info("打印机列表数据【"+json_data+"】")
|
||||
win.webContents.send('printerData', json_data);
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
@ -25,8 +25,22 @@ let printOperation={
|
||||
const pdfPath = this.saveTemporaryFolder(buffer);
|
||||
log.info("pdf下载完毕, 准备开始打印, 路径:【"+pdfPath+"】")
|
||||
|
||||
//获取打印缓存
|
||||
print_url = os.homedir()+path.sep+"AppData/Local/justarData/print/"
|
||||
log.info("打印机缓存目录:"+print_url);
|
||||
if(!fs.existsSync(print_url)){
|
||||
fs.mkdirSync(print_url);
|
||||
}
|
||||
fs.writeFileSync(print_url+path.sep+"print.json", JSON.stringify({}), function (err) {
|
||||
});
|
||||
let thisItem = {};
|
||||
thisItem.printer_name = printer_name;
|
||||
let jsonstr = JSON.stringify(thisItem);
|
||||
fs.writeFileSync(print_url+path.sep+"print.json", jsonstr, function (err) {
|
||||
log.error("存入打印机失败:" + err);
|
||||
});
|
||||
pdf_printer
|
||||
.print(pdfPath, printer_name)
|
||||
.print(pdfPath, {"printer":printer_name})
|
||||
.then(this.onSuccess(win))
|
||||
.catch(this.onError())
|
||||
.finally(() => this.removePdf(pdfPath));
|
||||
|
||||
@ -99,15 +99,15 @@
|
||||
// 绘制页面
|
||||
let html = [];
|
||||
for (const printer of data.listPrinter) {
|
||||
if (printer === defaultPrinter) {
|
||||
html.push(`<a href="#" class="list-group-item list-group-item-action active" data-name="${printer}">
|
||||
<i class="bi bi-printer-fill"></i> ${printer}
|
||||
if (printer.name === defaultPrinter) {
|
||||
html.push(`<a href="#" class="list-group-item list-group-item-action active" data-name="${printer.name}">
|
||||
<i class="bi bi-printer-fill"></i> ${printer.name}
|
||||
</a>
|
||||
`)
|
||||
continue;
|
||||
}
|
||||
html.push(`<a href="#" class="list-group-item list-group-item-action" data-name="${printer}">
|
||||
<i class="bi bi-printer-fill"></i> ${printer}
|
||||
html.push(`<a href="#" class="list-group-item list-group-item-action" data-name="${printer.name}">
|
||||
<i class="bi bi-printer-fill"></i> ${printer.name}
|
||||
</a>
|
||||
`)
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@
|
||||
//程序更新信息监听
|
||||
ipcRenderer.on("message", (event, args) => {
|
||||
if (args[0] == -1) {
|
||||
$("#update_label").html("<span style='color:red'>" + args[1] + "</span>");
|
||||
$("#update_label").html("<span style='color:#ff0000'>" + args[1] + "</span>");
|
||||
setTimeout(function () {
|
||||
$("#box2").hide();
|
||||
if (!$("#box1").is(":visible") && !$("#box").is(":visible") && !$("#box3").is(":visible")) {
|
||||
|
||||
Reference in New Issue
Block a user