Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) PDF File Encoding to Base64Demonstrates how to encode a PDF file to base64, and then decode.
integer li_rc oleobject loo_PdfData integer li_Success string ls_B64 oleobject loo_PdfData2 loo_PdfData = create oleobject // Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0 li_rc = loo_PdfData.ConnectToNewObject("Chilkat.BinData") if li_rc < 0 then destroy loo_PdfData MessageBox("Error","Connecting to COM object failed") return end if li_Success = loo_PdfData.LoadFile("qa_data/helloWorld.pdf") if li_Success <> 1 then Write-Debug "failed to load PDF file." destroy loo_PdfData return end if // Encode the PDF to base64 // Note: to produce base64 on multiple lines (as it would appear in the MIME of an email), // pass the string "base64_mime" instead of "base64". ls_B64 = loo_PdfData.GetEncoded("base64") Write-Debug ls_B64 // Decode from base64 PDF. loo_PdfData2 = create oleobject // Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0 li_rc = loo_PdfData2.ConnectToNewObject("Chilkat.BinData") loo_PdfData2.AppendEncoded(ls_B64,"base64") li_Success = loo_PdfData2.WriteFile("qa_output/helloWorld2.pdf") if li_Success <> 1 then Write-Debug "failed to write PDF file." destroy loo_PdfData destroy loo_PdfData2 return end if destroy loo_PdfData destroy loo_PdfData2 |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.