Render sale invoices as PDF

Retrieving sale invoices in PDF format

Date Released: Nov 2013 Date Updated: Nov 2020
Supported from AccountRight Only

Retrieve sale invoices in PDF format, customers using your application can now use the same Invoice PDF in AccountRight Live. Templates can either be custom designed or default ones held inside AccountRight Live. What are custom forms?

PDF Format

How to request a PDF

Firstly we need to tell the API we want to access the pdf format, this can be achieved two different ways, you can pass an additional HEADER Accept: Application/PDF or explicitly tell the API to return the PDF format at the end of your URL request ?format=pdf You only need to use one of these methods to complete successful requests.

HTTP GET is the only supported method, to make a request your URL should look like {cf_uri}/Sale/Invoice/{type}/{uid}/?format=pdf&templatename=Pre-Printed Invoice

For information on templates and the templatename keyword click below.

{type} is defined as either Item, Service or Professional.
{uid} is defined as the invoice unique identifier in the form of a guid.
Hypermedia in the MYOB Business API

The {cf_uri} is provided by the Company File endpoint.

Read more about Hypermedia in the MYOB Business API in our best practice guide.

Sale invoice types

Which sale invoice types are supported?

Rendering sale invoices into pdf format can be processed for the Item, Service, TimeBilling and Professional layout types. The miscellaneous invoice type does not have printing capabilities in AccountRight Live.

Please note: /Sale/Invoice/{uid} is not supported because a template can only be uniquely identified using the invoice layout type.

{uid} is defined as the invoice unique identifier in the form of a guid.

Template forms

Default and custom form templates

A template parameter templatename= can be passed to explicitly tell the API which custom form to render the invoice with i.e. templatename=Pre-Printed Invoice. This is not mandatory to include as the sale layout and printed form set on the customer contact card will default instead.

If the customer contact card does not contain a default sale layout and printed form, the template will default to the standard AccountRight Live Plain Paper Invoice for the invoice type the sale belongs to.

Updated: To retrieve a list of sale custom form templates (AccountRight 2014.3 cloud, desktop 2014.4) please refer to the new /Company/FormTemplate endpoint documented here

Each sale layout type has it's own specific set of templates and forms that are unique to it, therefore if you create a custom form template for an invoice type of item, you cannot use this to print or render a service or professional invoice, only item.

Note: custom form template names are not case sensitive when passing through.