@@ -133,15 +133,15 @@ app.on('activate', function () {
133133} )
134134
135135// starts the printing process
136- ipc . on ( 'print' , function ( event , data ) {
136+ ipc . on ( 'print' , function ( event , data , dataMan ) {
137137 savedData = data
138138 if ( savedData . big || savedData . small ) {
139139 try {
140140 if ( savedData . big ) {
141- printBig ( savedData . big )
141+ printBig ( savedData . big , dataMan )
142142 }
143143 if ( savedData . small ) {
144- printSmall ( savedData . small )
144+ printSmall ( savedData . small , dataMan )
145145 }
146146 // mainWindow.webContents.send('printed', true)
147147 } catch ( error ) {
@@ -162,7 +162,7 @@ ipc.on('printed', function (event) {
162162} )
163163
164164// invokes the generating and printing of printBig.pdf
165- function printBig ( data ) {
165+ function printBig ( data , dataMan ) {
166166 let winBig = null
167167 winBig = new BrowserWindow ( { heihgt : 350 , width : 500 , show : false } )
168168 winBig . loadURL ( url . format ( {
@@ -171,7 +171,7 @@ function printBig (data) {
171171 slashes : true
172172 } ) )
173173 winBig . once ( 'ready-to-show' , ( ) => {
174- winBig . webContents . send ( 'toPrint' , data )
174+ winBig . webContents . send ( 'toPrint' , data , dataMan )
175175
176176 // generates a pdf file which is then printed silently via Foxit Reader v6.2.3.0815
177177 winBig . webContents . printToPDF ( { marginsType : 2 , landscape : true , pageSize : { width : config . store . big . label . height , height : config . store . big . label . width } } , ( error , data ) => {
@@ -198,7 +198,7 @@ function printBig (data) {
198198}
199199
200200// invokes the generating and printing of printSmall.pdf
201- function printSmall ( data ) {
201+ function printSmall ( data , dataMan ) {
202202 let winSmall = null
203203 winSmall = new BrowserWindow ( { width : 350 , height : 500 , show : false } )
204204 winSmall . loadURL ( url . format ( {
@@ -207,7 +207,7 @@ function printSmall (data) {
207207 slashes : true
208208 } ) )
209209 winSmall . once ( 'ready-to-show' , ( ) => {
210- winSmall . webContents . send ( 'toPrint' , data )
210+ winSmall . webContents . send ( 'toPrint' , data , dataMan )
211211 winSmall . webContents . printToPDF ( { marginsType : 2 , landscape : true , pageSize : { width : config . store . small . label . height , height : config . store . small . label . width } } , ( error , data ) => {
212212 if ( error ) throw error
213213 fs . writeFile ( './tmp/' + config . store . small . pdfName , data , ( error ) => {
@@ -231,11 +231,11 @@ function printSmall (data) {
231231 } )
232232}
233233
234- ipc . on ( 'openManually' , function ( event ) {
235- createManualWindow ( )
234+ ipc . on ( 'openManually' , function ( event , objMan ) {
235+ createManualWindow ( objMan )
236236} )
237237
238- function createManualWindow ( ) {
238+ function createManualWindow ( objMan ) {
239239 winManual = new BrowserWindow ( { width : 600 , height : 300 , show : false } )
240240 winManual . loadURL ( url . format ( {
241241 pathname : path . join ( __dirname , 'html/manual.html' ) ,
@@ -244,19 +244,20 @@ function createManualWindow () {
244244 } ) )
245245 winManual . once ( 'ready-to-show' , ( ) => {
246246 winManual . show ( )
247+ winManual . webContents . send ( 'objMan' , objMan )
247248 } )
248249}
249250
250251ipc . on ( 'closeManual' , function ( event ) {
251252 winManual . close ( )
252253 winManual = null
254+ mainWindow . webContents . send ( 'removeManual' )
253255} )
254256
255257ipc . on ( 'saveManual' , function ( event , data ) {
256258 winManual . close ( )
257259 winManual = null
258260 mainWindow . webContents . send ( 'manual' , data )
259- console . log ( data , data . length )
260261} )
261262
262263// In this file you can include the rest of your app's specific main process
0 commit comments