Actor picture

PDF Generator

yinka/pdf-generator

A fork of Jancurn's url-to-pdf act with added name input & and delay until network is idle. Opens a web page in headless Chrome using Puppeteer and prints it to PDF. The input is a JSON object such as: { "url": "https://wiki.org", "pdfOptions": { "format": "a4", "printBackground": true }, "name": "Wiki.pdf" } The "pdfOptions" object is passed to Puppeteer's page.pdf() function - see https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions Output is a PDF file.

You need to have an Apify account with an API token.

  1. To run the actor from your program externally, copy-paste the code below into your program (based on programming language)

  2. Replace <YOUR_API_TOKEN> with your own token (you can find it here)

1
2
3
4
5
6
7
8
const Apify = require('Apify');

Apify.client.setOptions({ token: '<YOUR_API_TOKEN>' });

const run = await Apify.call('yinka/pdf-generator', { });

console.log('Actor finished, here is the output:');
console.dir(run.output);
  • Modified
  • Last run
  • Used3358 times
  • Used by22 users
Categories