Skip to content

Commit 4bb63a4

Browse files
authored
Update 014-pdfJS-Static_PDF_Viewer.au3
1 parent 84e3500 commit 4bb63a4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

examples/014-pdfJS-Static_PDF_Viewer.au3

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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 ;)

0 commit comments

Comments
 (0)