PDF Generation from a template via API
How to generate PDF from a template using the TTA HTTP API.
Generate PDFs via API
const axios = require('axios');
const options = {
method: 'POST',
url: 'https://text-to-anything.p.rapidapi.com/generatePDF/template',
headers: {
'x-rapidapi-key': '{Your-RapidAPI-Key}',
'Content-Type': 'application/json'
},
data: {
templateID: TEMPLATE_ID,
templateData: {
// Your template data
}
}
};
const response = await axios.request(options);
console.log(response.data);
Inside of the body you have the following options:
Option | Type | Description |
---|---|---|
templateID | number | The ID of the template for the PDF |
templateData | JSON object | The JSON data that should be used within the PDF |
Output
The API will respond with the file.