GetInvoicePDFByTransactionID - accountsIQ/API-Wiki GitHub Wiki
The GetInvoicePDFByTransactionID function will return a byte array of a Sales Invoice, that can be saved as a PDF. Purchases Invoices won't work.
When a PDF sales invoice is required, a transaction can be provided to this function and a PDF sales invoice in a byte array will be returned and then can be saved as a PDF.
public WSResult2<Byte[]> GetInvoicePDFByTransactionID(String token, Int32 transactionID)
Parameter | Type | Description |
---|---|---|
token | String | The session token retrieved during authentication. |
transactionID | Int32 | The ID of the transaction for the sales invoice you want a PDF for. |
The following example will generate a invoice in a byte array and save it as a Pdf.
Integration ws = new Integration();
string authToken = ws.Login(entityID, partnerKey, userKey);
if (authToken != null)
{
int salesInvoiceTransactionId = 1486;
WSResult2OfArrayOfByte response= ws.GetInvoicePDFByTransactionID(authToken, salesInvoiceTransactionId);
System.IO.File.WriteAllBytes($"SalesInvoice-{salesInvoiceTransactionId}.pdf", response.Result);
}