1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "html": "<!doctype html><html><head><title>Example PDF</title></head><body><h1>Hello from Apify</h1><p>This HTML will be rendered as a PDF.</p></body></html>",
10 "url": "https://example.com",
11 "fileName": "output.pdf",
12 "format": "A4",
13 "printBackground": True,
14 "landscape": False,
15 "margin": {
16 "top": "0.4in",
17 "right": "0.4in",
18 "bottom": "0.4in",
19 "left": "0.4in",
20 },
21 "viewportWidth": 1280,
22 "viewportHeight": 720,
23 "waitForMillis": 0,
24}
25
26
27run = client.actor("rainminer/test-actor-2").call(run_input=run_input)
28
29
30print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
31for item in client.dataset(run["defaultDatasetId"]).iterate_items():
32 print(item)
33
34