Documentation Index
Fetch the complete documentation index at: https://adro.codes/llms.txt
Use this file to discover all available pages before exploring further.
const result = await fetch("https://pdf.service", {
headers: {
Accept: "application/pdf"
}
})
// Do your error handling
response.writeHead(200, {
'Content-Type': 'application/pdf',
'Content-Disposition': 'attachment; filename="filename.pdf"'
})
response.end(
Buffer.from(await result.arrayBuffer())
)
This will take the incoming PDF from a service and forward the response to the User. Setting the Content-Disposition in this way will result in the PDF being downloaded. Removing attachment will serve the PDF in browser.