AutoIt
AutoIt
Extract PDF from JSON
See more JSON Examples
Demonstrates how to extract a PDF file contained within JSON. The file is represented as a base64 string within the JSON. Note: This example can extract any type of file, not just a PDF file.Chilkat AutoIt Downloads
Local $bSuccess = False
$oJson = ObjCreate("Chilkat.JsonObject")
; Load the JSON.
$bSuccess = $oJson.LoadFile("qa_data/json/JSR5U.json")
If ($bSuccess <> True) Then
ConsoleWrite($oJson.LastErrorText & @CRLF)
Exit
EndIf
; The JSON we loaded contains this:
; {
; ...
; ...
; "data": {
; "content": "JVBERi0xLjQ..."
; }
; ...
; ...
; }
$oSb = ObjCreate("Chilkat.StringBuilder")
$oJson.StringOfSb("data.content",$oSb)
$oBd = ObjCreate("Chilkat.BinData")
$oBd.AppendEncodedSb($oSb,"base64")
$bSuccess = $oBd.WriteFile("qa_output/a0015.pdf")