Repository
Current version released
3 years ago
Dependencies
deno.land/x
Versions
Gotenberg Deno Client
API
We have 4 types of exported functions:
- File-Loader helper (
readFile
) RequestInfo
creator (office
,merge
,convert
,url
,markdown
,url
)- Executoren (
executor
,webhookExecutor
) - Response handler (
handleZipResponse
,handleResponse
)
To create a request:
- create a (global) execcutor wich can be used for multiple requests (we provide 2 one with webhook options). You might use multiple executoren in your project!
- create the RequestInfo object by calling the corresponding function depending on your use case.
- pass the RequestInfo to the executor it returns a
Promise<Response>
. - pass the Promise (or the Response) to one of the response handler. If you
expect more than one pdf file use
handleZipResponse
. If you expect a single PDF usehandleResponse
Basic example:
import {
executor,
handleResponse,
office,
readFile,
} from "https://deno.land/x/gotenberg/mod.ts";
const gotenberg = executor("http://gotenberg:3000");
const { filename, content } = await handleResponse(
gotenberg(
office([await readFile("./path/to/file.docx")], {
landscape: true,
}),
),
);
API Documentation
The generated API documentaion you can find here: https://doc.deno.land/https://deno.land/x/gotenberg/mod.ts