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
(Unicode C) Extract PDF from General Ledger Transactions XMLSee more Office365 ExamplesDemonstrates how to extract the base64 data representing a PDF file from a General Ledger Transactions XML.
#include <C_CkXmlW.h> void ChilkatSample(void) { HCkXmlW xml; BOOL success; const wchar_t *pdfFilename; HCkXmlW binaryDataElem; // The General Ledger Transactions XML contains the following: // <?xml version="1.0" encoding="utf-8" ?> // <eExact xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="eExact-XML.xsd"> // <GLTransactions> // <GLTransaction entry="100000095"> // <TransactionType number="20" /> // <Journal type="20" code="VK"> // <Description termid="90003">Verkopen</Description> // <GLAccount type="20" code="400000" /> // <Currency code="EUR" /> // </Journal> // <Date>2022-04-05</Date> // <Document> // <Subject>100000095</Subject> // <DocumentType number="10" /> // <Account code="0001" status="C" /> // <Amount> // <Currency code="EUR" /> // <Value>1382.91</Value> // </Amount> // <References> // <InvoiceNumber>100000095</InvoiceNumber> // </References> // <Attachments> // <Attachment> // <Name>F_100000095.PDF</Name> // <BinaryData>BASE64_ENCODED_PDF_BYTES_HERE</BinaryData> // </Attachment> // </Attachments> // </Document> // <GLTransactionLine type="20" status="20" line="0" linetype="0"> // <Date>2022-04-05</Date> // <VATType>S</VATType> // <FinYear number="2022" /> // <FinPeriod number="4" /> // <GLAccount type="20" code="400000" /> // <Description>100000095</Description> // <DueDate>2022-05-05</DueDate> // <Account code="0001" status="C"> // <Name>90 Degrees & co</Name> // </Account> // <Amount> // <Currency code="EUR" /> // <Value>1382.91</Value> // </Amount> // <ForeignAmount> // <Currency code="EUR" /> // <Value>1382.91</Value> // <Rate>1</Rate> // </ForeignAmount> // <References> // <InvoiceNumber>100000095</InvoiceNumber> // </References> // </GLTransactionLine> // <PaymentTerms> // <PaymentTerm entry="100000095" type="20" line="0" paymentMethod="B"> // <Description>20</Description> // <GLAccount type="20" code="400000" /> // <Amount> // <Currency code="EUR" /> // <Debit>1382.91</Debit> // <Credit>0</Credit> // </Amount> // <ForeignAmount> // <Currency code="EUR" /> // <Debit>1382.91</Debit> // <Credit>0</Credit> // </ForeignAmount> // <Reference /> // <YourRef /> // <InvoiceNumber>100000095</InvoiceNumber> // <InvoiceDate>2022-04-05</InvoiceDate> // <DueDate>2022-05-05</DueDate> // <PaymentDate>2022-05-05</PaymentDate> // </PaymentTerm> // </PaymentTerms> // </GLTransaction> // </GLTransactions> // </eExact> xml = CkXmlW_Create(); success = CkXmlW_LoadXmlFile(xml,L"c:/temp/example.xml"); if (success == FALSE) { wprintf(L"%s\n",CkXmlW_lastErrorText(xml)); CkXmlW_Dispose(xml); return; } pdfFilename = CkXmlW_getChildContent(xml,L"GLTransactions|GLTransaction|Document|Attachments|Attachment|Name"); if (CkXmlW_getLastMethodSuccess(xml) == FALSE) { wprintf(L"No XML element at the given path.\n"); CkXmlW_Dispose(xml); return; } wprintf(L"PDF Filename = %s\n",pdfFilename); binaryDataElem = CkXmlW_GetChildWithTag(xml,L"GLTransactions|GLTransaction|Document|Attachments|Attachment|BinaryData"); if (CkXmlW_getLastMethodSuccess(xml) == FALSE) { wprintf(L"No XML element at the given path.\n"); CkXmlW_Dispose(xml); return; } // Decode the base64 data and save to a file. success = CkXmlW_SaveBinaryContent(binaryDataElem,pdfFilename,FALSE,FALSE,L""); if (success == FALSE) { wprintf(L"%s\n",CkXmlW_lastErrorText(binaryDataElem)); } else { wprintf(L"Success.\n"); } CkXmlW_Dispose(binaryDataElem); CkXmlW_Dispose(xml); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.