Chilkat • HOME • Android™ • AutoIt • C • C# • C++ • Chilkat2-Python • CkPython • Classic ASP • DataFlex • Delphi DLL • Go • Java • Node.js • Objective-C • PHP Extension • Perl • PowerBuilder • PowerShell • PureBasic • Ruby • SQL Server • Swift • Tcl • Unicode C • Unicode C++ • VB.NET • VBScript • Visual Basic 6.0 • Visual FoxPro • Xojo Plugin
(Visual FoxPro) Extract PDF from JSONDemonstrates 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.
LOCAL loJson LOCAL lnSuccess LOCAL loSb LOCAL loBd * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJson = CreateObject('Chilkat.JsonObject') * Load the JSON. lnSuccess = loJson.LoadFile("qa_data/json/JSR5U.json") IF (lnSuccess <> 1) THEN ? loJson.LastErrorText RELEASE loJson CANCEL ENDIF * The JSON we loaded contains this: * { * ... * ... * "data": { * "content": "JVBERi0xLjQ..." * } * ... * ... * } * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder') loSb = CreateObject('Chilkat.StringBuilder') loJson.StringOfSb("data.content",loSb) * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.BinData') loBd = CreateObject('Chilkat.BinData') loBd.AppendEncodedSb(loSb,"base64") lnSuccess = loBd.WriteFile("qa_output/a0015.pdf") RELEASE loJson RELEASE loSb RELEASE loBd |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.