Open PDFs inline in the browser
Use a new query parameter to determine whether generated URLs for PDFs should download the file as an attachment saved locally, or open it inline in the browser.
What's new?
We added a new disposition
query parameter that you can use when working with get a PDF invoice for a transaction operation to determine how the generated URL should open.
Determine whether the generated URL should download the PDF as an attachment saved locally, or open it inline in the browser.
Default: attachment
.
How it works
You can generate a link to an invoice PDF for a transaction using the get a PDF invoice for a transaction operation.
HTTP responses include a Content-Disposition
header indicating whether the content is intended for display inline in the browser or downloaded as an attachment.
Previously, the Content-Disposition
for links to PDFs generated by the API was attachment
. This means that the generated link typically downloaded and saved the PDF locally.
Use the new disposition
query parameter to set the Content-Disposition
is for the generated link. As well as attachment
, you can pass inline
to instruct browsers to open the PDF inline in the browser. Typically, this means browsers open the PDF in the current tab.
Next steps
This change is available in version 1
of the Paddle API.
It's a non-breaking change, meaning it doesn't impact existing integrations.
You can get a PDF invoice for a transaction using the API to start using the new query parameter.