@fto-consult/expo-ui 7.4.61 → 7.4.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/electron/index.js
CHANGED
@@ -127,6 +127,7 @@ function createBrowserWindow (options){
|
|
127
127
|
if(showOnLoad){
|
128
128
|
_win.once('ready-to-show', () => {
|
129
129
|
_win.show();
|
130
|
+
ipcMain.send("window-ready-to-show",JSON.stringify(options.readyToShowOptions));
|
130
131
|
if(options.devTools){
|
131
132
|
_win.webContents.openDevTools();
|
132
133
|
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
const {ipcRenderer} = require('electron')
|
3
|
+
|
4
|
+
ipcRenderer.on('print-document', (...args) => {
|
5
|
+
console.log("willl print document ",window.PDFObject)
|
6
|
+
});
|
7
|
+
ipcRenderer.on("window-ready-to-show",(...args)=>{
|
8
|
+
console.log("window is ready to show ",...args,window.PDFObject);
|
9
|
+
});
|
10
|
+
function test(){
|
11
|
+
const container = `#pdf-container`;
|
12
|
+
const title = document.querySelector(`document-title`)
|
13
|
+
// Get a URLSearchParams object from the URL object
|
14
|
+
const params = Object.assign({},url.searchParams);
|
15
|
+
params.width = params.width ||"100%";
|
16
|
+
params.height = params.height || "100%";
|
17
|
+
if(params.fileName && title){
|
18
|
+
title.innerHTML = `${params.fileName}`
|
19
|
+
} else if(params.title && title){
|
20
|
+
title.innerHTML = `${params.title}`
|
21
|
+
}
|
22
|
+
alert(JSON.stringify(params)," is params heeein");
|
23
|
+
alert(params.file," is paraments fieleeeeee");
|
24
|
+
if(params.file){
|
25
|
+
PDFObject.embed(params.file,container,params);
|
26
|
+
} else if(params.dataURL){
|
27
|
+
PDFObject.embed(params.dataURL,container,params);
|
28
|
+
}
|
29
|
+
}
|
@@ -10,27 +10,5 @@
|
|
10
10
|
|
11
11
|
<body>
|
12
12
|
<div id="pdf-container"></div>
|
13
|
-
<script type="text/javascript">
|
14
|
-
const url = new URL(window.location.href);
|
15
|
-
const container = `#pdf-container`;
|
16
|
-
const title = document.querySelector(`document-title`)
|
17
|
-
// Get a URLSearchParams object from the URL object
|
18
|
-
const params = Object.assign({},url.searchParams);
|
19
|
-
params.width = params.width ||"100%";
|
20
|
-
params.height = params.height || "100%";
|
21
|
-
if(params.fileName && title){
|
22
|
-
title.innerHTML = `${params.fileName}`
|
23
|
-
} else if(params.title && title){
|
24
|
-
title.innerHTML = `${params.title}`
|
25
|
-
}
|
26
|
-
alert(JSON.stringify(params)," is params heeein");
|
27
|
-
alert(params.file," is paraments fieleeeeee");
|
28
|
-
if(params.file){
|
29
|
-
PDFObject.embed(params.file,container,params);
|
30
|
-
} else if(params.dataURL){
|
31
|
-
PDFObject.embed(params.dataURL,container,params);
|
32
|
-
}
|
33
|
-
console.log(params," is params heeein marrrrrrrrrrr ",window.location,url.searchParams);
|
34
|
-
</script>
|
35
13
|
</body>
|
36
14
|
</html>
|
package/electron/preload.js
CHANGED
@@ -385,13 +385,20 @@ const ELECTRON = {
|
|
385
385
|
return createPDFFile(options).then(({path:mainPath,filePathUrl,fileName})=>{
|
386
386
|
const urlPath = path.resolve(__dirname,"pdf-viewer","viewer.html");
|
387
387
|
if(fs.existsSync(mainPath)){
|
388
|
+
const queryString = `file=${filePathUrl}&locale=fr&fileName=${fileName}`;
|
388
389
|
const opts = {
|
389
|
-
loadURL : `file://${urlPath}
|
390
|
+
//loadURL : `file://${urlPath}?${queryString}`,
|
391
|
+
file : mainPath,
|
392
|
+
fileName,
|
393
|
+
filePathUrl,
|
394
|
+
queryString,
|
395
|
+
pdfFilePath : mainPath,
|
390
396
|
showOnLoad : true,
|
391
397
|
devTools : true,
|
392
398
|
webPreferences : {
|
393
399
|
devTools : true,
|
394
|
-
webSecurity: false,
|
400
|
+
//webSecurity: false,
|
401
|
+
preload : path.resolve(__dirname,"pdf-viewer",'preload.js'),
|
395
402
|
...Object.assign({},options.webPreferences),
|
396
403
|
},
|
397
404
|
fileName
|
@@ -402,7 +409,10 @@ const ELECTRON = {
|
|
402
409
|
}
|
403
410
|
});
|
404
411
|
console.log("will print options ",opts);
|
405
|
-
return this.createPDFWindow(
|
412
|
+
return this.createPDFWindow({
|
413
|
+
...opts,
|
414
|
+
readyToShowOptions : opts,
|
415
|
+
})
|
406
416
|
}
|
407
417
|
})
|
408
418
|
}
|