|
5 | 5 | #include "..\NetWebView2Lib.au3" |
6 | 6 |
|
7 | 7 | ; Global objects |
8 | | -Global $hGUI, $idLabelStatus |
| 8 | +Global $hGUI |
9 | 9 |
|
10 | | -Main() |
| 10 | +_Example() |
11 | 11 |
|
12 | | -Func Main() |
| 12 | +Func _Example() |
13 | 13 | Local $oMyError = ObjEvent("AutoIt.Error", __NetWebView2_COMErrFunc) |
14 | 14 | #forceref $oMyError |
15 | 15 |
|
@@ -45,7 +45,7 @@ Func Main() |
45 | 45 | Local $dPDF_asBase64 = _NetWebView2_PrintToPdfStream($_g_oWeb) |
46 | 46 |
|
47 | 47 | ; decode Base64 encoded data do Binary |
48 | | - Local $dBinaryDataToWrite = _Base64Decode($dPDF_asBase64) |
| 48 | + Local $dBinaryDataToWrite = _NetWebView2_DecodeB64($_g_oWeb, $dPDF_asBase64) |
49 | 49 |
|
50 | 50 | ; finally save PDF to FILE |
51 | 51 | Local $hFile = FileOpen($s_PDF_FileFullPath, $FO_OVERWRITE + $FO_UTF8_NOBOM + $FO_BINARY) |
@@ -83,53 +83,4 @@ Func Main() |
83 | 83 | #EndRegion ; GUI Loop |
84 | 84 |
|
85 | 85 | _NetWebView2_CleanUp($oWebV2M, $oJSBridge) |
86 | | -EndFunc ;==>Main |
87 | | - |
88 | | -; #FUNCTION# ==================================================================================================================== |
89 | | -; Name ..........: _Base64Decode |
90 | | -; Description ...: |
91 | | -; Syntax ........: _Base64Decode($input_string) |
92 | | -; Parameters ....: $input_string - An integer value. |
93 | | -; Return values .: None |
94 | | -; Author ........: trancexx |
95 | | -; Modified ......: |
96 | | -; Remarks .......: |
97 | | -; Related .......: |
98 | | -; Link ..........: http://www.autoitscript.com/forum/topic/81332-base64encode-base64decode |
99 | | -; Example .......: yes |
100 | | -; =============================================================================================================================== |
101 | | -Func _Base64Decode($input_string) |
102 | | - |
103 | | - Local $struct = DllStructCreate("int") |
104 | | - |
105 | | - Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _ |
106 | | - "str", $input_string, _ |
107 | | - "int", 0, _ |
108 | | - "int", 1, _ |
109 | | - "ptr", 0, _ |
110 | | - "ptr", DllStructGetPtr($struct, 1), _ |
111 | | - "ptr", 0, _ |
112 | | - "ptr", 0) |
113 | | - |
114 | | - If @error Or Not $a_Call[0] Then |
115 | | - Return SetError(1, 0, "") ; error calculating the length of the buffer needed |
116 | | - EndIf |
117 | | - |
118 | | - Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]") |
119 | | - |
120 | | - $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _ |
121 | | - "str", $input_string, _ |
122 | | - "int", 0, _ |
123 | | - "int", 1, _ |
124 | | - "ptr", DllStructGetPtr($a), _ |
125 | | - "ptr", DllStructGetPtr($struct, 1), _ |
126 | | - "ptr", 0, _ |
127 | | - "ptr", 0) |
128 | | - |
129 | | - If @error Or Not $a_Call[0] Then |
130 | | - Return SetError(2, 0, "") ; error decoding |
131 | | - EndIf |
132 | | - |
133 | | - Return DllStructGetData($a, 1) |
134 | | - |
135 | | -EndFunc ;==>_Base64Decode |
| 86 | +EndFunc ;==>_Example |
0 commit comments