Xojo Plugin
Xojo Plugin
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 Xojo Plugin Downloads
Dim success As Boolean
success = False
Dim json As New Chilkat.JsonObject
// Load the JSON.
success = json.LoadFile("qa_data/json/JSR5U.json")
If (success <> True) Then
System.DebugLog(json.LastErrorText)
Return
End If
// The JSON we loaded contains this:
// {
// ...
// ...
// "data": {
// "content": "JVBERi0xLjQ..."
// }
// ...
// ...
// }
Dim sb As New Chilkat.StringBuilder
success = json.StringOfSb("data.content",sb)
Dim bd As New Chilkat.BinData
success = bd.AppendEncodedSb(sb,"base64")
success = bd.WriteFile("qa_output/a0015.pdf")