@@ -50,7 +50,7 @@ Func _Example()
5050 #EndRegion ; GUI CREATION
5151
5252 ; navigate to the page
53- __SetupStaticPDF($oWeb , @ScriptDir & " \invoice-plugin-sample.pdf" , True , False )
53+ __SetupStaticPDF($oWeb , @ScriptDir & " \invoice-plugin-sample.pdf" , True , False , True )
5454
5555 _NetWebView2_ExecuteScript($oWeb , " extractPDFText();" , $NETWEBVIEW2_EXECUTEJS_MODE0_FIREANDFORGET )
5656
@@ -111,7 +111,7 @@ Func __MyEVENTS_Bridge_OnMessageReceived($sMsg)
111111 EndIf
112112EndFunc ; ==>__MyEVENTS_Bridge_OnMessageReceived
113113
114- Func __SetupStaticPDF(ByRef $oWeb , $s_PDF_Path , $bBlockLinks = False , $bBlockSelection = False )
114+ Func __SetupStaticPDF(ByRef $oWeb , $s_PDF_Path , $bBlockLinks = False , $bBlockSelection = False , $bShowToolbar = False )
115115 ; 🏆 https://mozilla.github.io/pdf.js/
116116
117117 Local $sBlockLinksJS = " "
@@ -168,15 +168,15 @@ Func __SetupStaticPDF(ByRef $oWeb, $s_PDF_Path, $bBlockLinks = False, $bBlockSel
168168 " setTimeout(runExtraction, 500);" & _
169169 " }" & _
170170 " } catch (e) {" & _
171- " window.chrome.webview.postMessage('ERROR| ' + e.message);" & _
171+ " window.chrome.webview.postMessage('JS_ERROR|extractPDFText() SLN= " & @ScriptLineNumber & " ' + e.message);" & _
172172 " }" & _
173173 " };" & _
174174 " runExtraction();" & _
175175 " };" & _
176176 " /* 3. Style Injection */ " & _
177177 " window.addEventListener('DOMContentLoaded', () => {" & _
178178 " const style = document.createElement('style');" & _
179- " style.innerHTML = '#toolbarContainer, #sidebarContainer { display: none !important; } ' + " & _
179+ " style.innerHTML = " & (( $bShowToolbar ) ? ( " " ) : ( " '#toolbarContainer, #sidebarContainer { display: none !important; } ' + " )) & _
180180 " '#viewerContainer { top: 0 !important; bottom: 0 !important; overflow: hidden !important; } ' + " & _
181181 " '" & $sBlockLinksCSS & " ' + " & _
182182 " '" & $sSelectionCSS & " ' + " & _
0 commit comments