Skip to content

Commit a493a59

Browse files
committed
fixed error with the file path and PS under win10
1 parent bbe3afb commit a493a59

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

signaturenDruck/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,24 +242,24 @@ function printData (format, data, dataMan) {
242242
winPrint.webContents.printToPDF({marginsType: 1, landscape: true, pageSize: { width: formats[format].paper.height, height: formats[format].paper.width }}, (error, data) => {
243243
if (error) throw error
244244
let fileName = formats[format].name + '_' + new Date().getTime() + '.pdf'
245-
fs.writeFile('./tmp/' + fileName, data, (error) => {
245+
fs.writeFile('C:\\Export\\SignaturenDruck\\' + fileName, data, (error) => {
246246
if (error) throw error
247247
let ps = new Shell({
248248
executionPolicy: 'Bypass',
249249
noProfile: true
250250
})
251251
if (!config.store.devMode) {
252-
ps.addCommand('Start-Process "' + path.join(__dirname, '.\\tmp\\' + fileName) + '" -Verb PrintTo "' + formats[format].printer + '" -PassThru | %{sleep 4;$_} | kill')
252+
ps.addCommand('Start-Process -file "' + 'C:\\Export\\SignaturenDruck\\' + fileName + '" -Verb PrintTo "' + formats[format].printer + '" -PassThru | %{sleep 4;$_} | kill')
253253
ps.invoke().then(output => {
254-
fs.unlinkSync(path.join(__dirname, '.\\tmp\\' + fileName))
254+
fs.unlinkSync('C:\\Export\\SignaturenDruck\\' + fileName)
255255
mainWindow.webContents.send('printMsg', true)
256256
}).catch(err => {
257257
electron.dialog.showErrorBox('Es ist ein Fehler aufgetreten.', err)
258258
mainWindow.webContents.send('printMsg', false)
259259
ps.dispose()
260260
})
261261
} else {
262-
ps.addCommand('Start-Process "' + path.join(__dirname, '.\\tmp\\' + fileName) + '"')
262+
ps.addCommand('Start-Process -file "' + 'C:\\Export\\SignaturenDruck\\' + fileName + '"')
263263
ps.invoke().then(output => { mainWindow.webContents.send('printMsg', true); ps.dispose() }).catch(err => {
264264
electron.dialog.showErrorBox('Es ist ein Fehler aufgetreten.', err)
265265
mainWindow.webContents.send('printMsg', false)

signaturenDruck/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "SignaturenDruck_neu",
3-
"version": "1.0.4b",
3+
"version": "1.0.4c",
44
"description": "SignaturenDruck der ThULB",
55
"main": "main.js",
66
"scripts": {

0 commit comments

Comments
 (0)