1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "html": `<!doctype html>
12<html><head><meta charset="utf-8"><title>Invoice 1001</title>
13<style>
14 body { font-family: Helvetica, Arial, sans-serif; color: #222; margin: 0; }
15 h1 { color: #0f766e; margin: 0 0 4px; }
16 .muted { color: #666; }
17 table { width: 100%; border-collapse: collapse; margin-top: 24px; }
18 th { background: #0f766e; color: #fff; text-align: left; padding: 8px; }
19 td { border-bottom: 1px solid #ddd; padding: 8px; }
20 .right { text-align: right; }
21 .total td { font-weight: bold; border-bottom: none; }
22</style></head>
23<body>
24 <h1>Invoice 1001</h1>
25 <div class="muted">Issued 10 November 2026 · Due 10 December 2026</div>
26 <p><b>Acme Studio Ltd</b><br>1 Example Street, London</p>
27 <p>Billed to: <b>Example Corp</b></p>
28 <table>
29 <tr><th>Item</th><th class="right">Qty</th><th class="right">Price</th><th class="right">Amount</th></tr>
30 <tr><td>Website design</td><td class="right">1</td><td class="right">$1,200.00</td><td class="right">$1,200.00</td></tr>
31 <tr><td>Hosting, 12 months</td><td class="right">12</td><td class="right">$15.00</td><td class="right">$180.00</td></tr>
32 <tr class="total"><td colspan="3" class="right">Total</td><td class="right">$1,380.00</td></tr>
33 </table>
34</body></html>`,
35 "documents": []
36};
37
38
39const run = await client.actor("pikoulas/html-to-pdf").call(input);
40
41
42console.log('Results from dataset');
43console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
44const { items } = await client.dataset(run.defaultDatasetId).listItems();
45items.forEach((item) => {
46 console.dir(item);
47});
48
49