Install
Download the Node.js SDK using your favorite package manager.The package needs to be configured with your organizations API key, which is
available on your organizations settings page.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Learn how to use Doczilla with Remix.
npm install @doczilla/node
yarn add @doczilla/node
pnpm add @doczilla/node
// app/routes/api.pdf.ts -> /api/pdf
import { LoaderFunctionArgs } from '@remix-run/node'
import Doczilla from '@doczilla/node'
const doczilla = new Doczilla('doczilla-...')
export async function loader(args: LoaderFunctionArgs) {
const pdfBuffer = await doczilla.pdf.direct({
page: {
html: '<div>Your first Doczilla PDF</div>'
}
})
return new Response(pdfBuffer, {
headers: {
'Content-Type': 'application/pdf'
}
})
}
// app/routes/api.pdf.ts -> /api/pdf
import { ActionFunctionArgs, json } from '@remix-run/node'
import Doczilla from '@doczilla/node'
const doczilla = new Doczilla('doczilla-...')
export async function action({ request }: ActionFunctionArgs) {
// Ensure this is a POST request
if (request.method.toUpperCase() !== "POST") {
return { status: 405, body: "Method Not Allowed" };
}
const pdfBuffer = await doczilla.pdf.direct({
page: {
html: '<div>Your first Doczilla PDF</div>'
}
})
// Or pass the options down in the request
// const pdfBuffer = await doczilla.pdf.direct(await request.json())
return new Response(pdfBuffer, {
headers: {
'Content-Type': 'application/pdf'
}
})
}
Was this page helpful?