Skip to content

Commit 070c04b

Browse files
authored
Update NetWebView2Lib.au3 - _NetWebView2_PrintToPdfStream
1 parent 4b08766 commit 070c04b

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

NetWebView2Lib.au3

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,10 @@ EndFunc ;==>_NetWebView2_ExportPageData
491491
; #FUNCTION# ====================================================================================================================
492492
; Name ..........: _NetWebView2_PrintToPdfStream
493493
; Description ...:
494-
; Syntax ........: _NetWebView2_PrintToPdfStream($oWebV2M)
495-
; Parameters ....: $oWebV2M - an object.
496-
; Return values .: Success - String with Base64 encoded binary content of the PDF
494+
; Syntax ........: _NetWebView2_PrintToPdfStream($oWebV2M, $b_TBinary_FBase64)
495+
; Parameters ....: $oWebV2M - an object.
496+
; $b_TBinary_FBase64 - a boolean value.
497+
; Return values .: Success - binary or string with Base64 encoded binary content of the PDF
497498
; Failure - string with error description "ERROR: ........." and set @error to 1
498499
; Author ........: mLipok
499500
; Modified ......:
@@ -502,15 +503,20 @@ EndFunc ;==>_NetWebView2_ExportPageData
502503
; Link ..........:
503504
; Example .......: No
504505
; ===============================================================================================================================
505-
Func _NetWebView2_PrintToPdfStream($oWebV2M)
506-
Local Const $s_Prefix = "[_NetWebView2_PrintToPdfStream]:"
506+
Func _NetWebView2_PrintToPdfStream($oWebV2M, $b_TBinary_FBase64)
507+
Local Const $s_Prefix = "[_NetWebView2_PrintToPdfStream]: TBinary_FBase64:" & $b_TBinary_FBase64
507508
Local $oMyError = ObjEvent("AutoIt.Error", __NetWebView2_COMErrFunc) ; Local COM Error Handler
508509
#forceref $oMyError
509510

510511
Local $s_Result = $oWebV2M.PrintToPdfStream()
511512
__NetWebView2_Log(@ScriptLineNumber, $s_Prefix, 1)
512513
If StringInStr($s_Result, 'ERROR:') Then SetError(1)
513514

515+
If $b_TBinary_FBase64 Then
516+
; decode Base64 encoded data do Binary
517+
$s_Result = _NetWebView2_DecodeB64ToBinary($oWebV2M, $s_Result)
518+
EndIf
519+
514520
__NetWebView2_Log(@ScriptLineNumber, $s_Prefix & " RESULT:" & ((@error) ? ($s_Result) : ("SUCCESS")), 1)
515521
Return SetError(@error, @extended, $s_Result)
516522
EndFunc ;==>_NetWebView2_PrintToPdfStream

0 commit comments

Comments
 (0)