1010; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1111; ⚠️ to make this work, download pdfJS library from https://mozilla.github.io/pdf.js/
1212; for example:
13- ; https://github.com/mozilla/pdf.js/releases/download/v5.4.624 /pdfjs-5.4.624 -dist.zip
13+ ; https://github.com/mozilla/pdf.js/releases/download/v5.6.205 /pdfjs-5.6.205 -dist.zip
1414; and unzip to: @ScriptDir & "\JS_Lib\pdfjs\"
1515; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1616
@@ -57,9 +57,10 @@ Func _Example()
5757
5858 ; navigate to the page
5959 Local $sFileName = " invoice-plugin-sample.pdf"
60- Local $sRegExp_Title = " (?i) - " & $sFileName
60+ Local $sRegExp_Title = " (?i).*? " & $sFileName
6161
6262 __SetupStaticPDF($oWeb , @ScriptDir & " \" & $sFileName , $sRegExp_Title , True , False , True )
63+ ConsoleWrite (" After __SetupStaticPDF() RegExp_Title=" & $sRegExp_Title & @CRLF )
6364
6465 #Region ; now we can call the script directly from the JavaScript library "NetWebView2Lib_pdfjs_Tools.js" - some pdfjs magic stuff ;)
6566 Local $s_JavaScript_snipp = ' '
@@ -130,15 +131,21 @@ Func _Example()
130131 _NetWebView2_ExecuteScript($oWeb , $s_JavaScript_snipp , $NETWEBVIEW2_EXECUTEJS_MODE0_FIREANDFORGET )
131132 MsgBox ($MB_TOPMOST , " TEST #" & @ScriptLineNumber , " After:" & @CRLF & $s_JavaScript_snipp )
132133
134+ $sRegExp_Title = " (?i).*?" & " dummy.pdf"
133135 $s_JavaScript_snipp = ' PDFViewerApplication.open({ url: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" });'
134136 _NetWebView2_ExecuteScript($oWeb , $s_JavaScript_snipp , $NETWEBVIEW2_EXECUTEJS_MODE0_FIREANDFORGET )
137+ _NetWebView2_LoadWait($oWeb , $NETWEBVIEW2_MESSAGE__TITLE_CHANGED , $sRegExp_Title , 5000 )
138+ ConsoleWrite (" After _NetWebView2_LoadWait() RegExp_Title=" & $sRegExp_Title & @CRLF )
135139 MsgBox ($MB_TOPMOST , " TEST #" & @ScriptLineNumber , " After:" & @CRLF & $s_JavaScript_snipp )
136140
137141; ~ $s_JavaScript_snipp = FileRead(@ScriptDir & '\JS_Lib\PDFViewerApplicationEvents.js')
138142; ~ _NetWebView2_ExecuteScript($oWeb, $s_JavaScript_snipp, $NETWEBVIEW2_EXECUTEJS_MODE2_RESULT)
139143
144+ $sRegExp_Title = " (?i).*? - " & " PDF32000_2008.pdf"
140145 $s_JavaScript_snipp = ' PDFViewerApplication.open({ url: "https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf" });'
141146 _NetWebView2_ExecuteScript($oWeb , $s_JavaScript_snipp , $NETWEBVIEW2_EXECUTEJS_MODE0_FIREANDFORGET )
147+ _NetWebView2_LoadWait($oWeb , $NETWEBVIEW2_MESSAGE__TITLE_CHANGED , $sRegExp_Title , 5000 )
148+ ConsoleWrite (" After _NetWebView2_LoadWait() RegExp_Title=" & $sRegExp_Title & @CRLF )
142149 MsgBox ($MB_TOPMOST , " TEST #" & @ScriptLineNumber , " After:" & @CRLF & $s_JavaScript_snipp )
143150
144151 #EndRegion ; now we can call the script directly from the JavaScript library "NetWebView2Lib_pdfjs_Tools.js" - some pdfjs magic stuff ;)
@@ -151,8 +158,8 @@ Func _Example()
151158 EndSwitch
152159 WEnd
153160
154- GUIDelete ($hGUI )
155161 _NetWebView2_CleanUp($oWeb , $oBridge )
162+ GUIDelete ($hGUI )
156163EndFunc ; ==>_Example
157164
158165; Handles custom messages from JavaScript (window.chrome.webview.postMessage)
0 commit comments