Skip to content

Instantly share code, notes, and snippets.

View rlataguerra's full-sized avatar
:bowtie:

Renaud Lataguerra rlataguerra

:bowtie:
View GitHub Profile
@rlataguerra
rlataguerra / doppio-header-footer.sh
Created October 3, 2023 20:47
Doppio.sh Header and Footer
@rlataguerra
rlataguerra / doppio-direct-axios.js
Created August 24, 2023 15:37
An example for doppio.sh (direct render) with node.js and axios
const axios = require('axios');
async function renderPdfWithDoppio() {
try {
const sourceHtml = "<h1>Hello Doppio</h1>"
const htmlAsBase64 = new Buffer.from(sourceHtml, 'utf8').toString('base64')
const options = {
method: 'POST',
url: 'https://api.doppio.sh/v1/render/pdf/direct',
@rlataguerra
rlataguerra / fetch-doppio.js
Created August 7, 2023 20:56
Doppio.sh - Fetch from node.js
const fetch = import('node-fetch');
const myHeaders = {
"Authorization": "Bearer xxxxxxxxxxxxxxx",
"Content-Type": "application/json"
};
const raw = JSON.stringify({
"page": {
"goto": {
@rlataguerra
rlataguerra / generatepdf.ts
Last active February 24, 2023 11:14
Doppio example - node.js/nest.js/TypeScript (doppio.sh 👋)
async generatePdf(link: string, token: string): Promise<string> {
const doppioApiUrl = this.configService.get<string>('DOPPIO_API_URL');
const doppioApiKey = this.configService.get<string>('DOPPIO_API_KEY');
const data = {
page: {
pdf: {
printBackground: true,
},
goto: {
@rlataguerra
rlataguerra / presigned url (doppio.sh 👋).js
Last active May 28, 2023 17:11
An example to create a presigned url with Node.js
const { getSignedUrl } = require('@aws-sdk/s3-request-presigner');
const { S3Client, PutObjectCommand } = require('@aws-sdk/client-s3');
const connectedClient = new S3Client({
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
},
endpoint: `https://${process.env.S3_ENDPOINT}`,
region: 'eu-east-1',