You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-4Lines changed: 39 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This action will automatically render any local webpage into a PDF.
4
4
5
5
Because it integrates its own web-server, it has no problems importing css, js and fonts (whether available locally or referenced online, including from websites like google fonts), and will wait for everything to render properly before rending the output to a PDF. It means your webpage doesn't have to be a static HTML page, but can also use any javascript framework.
6
6
7
-
The action internally uses chromium, so the rendered PDF won't have any of the weird problems that exist with Firefox or WebKit, like:
7
+
The action internally uses chromium, so the rendered PDF won't have any of the weird problems that can sometimes exist like:
8
8
- font kerning
9
9
- missing styles or resources
10
10
- javascript not executed before rendering
@@ -14,12 +14,47 @@ Here is an example on how to use the action:
14
14
15
15
```yml
16
16
- name: HTML website to PDF converter
17
-
uses: ferdinandkeller/html-to-pdf-action@v1
17
+
uses: ferdinandkeller/html-to-pdf-action@v2
18
18
with:
19
-
- source-path: './dist'
20
-
- destination-path: './out.pdf'
19
+
- source-path: "./dist"
20
+
- destination-path: "./out.pdf"
21
21
```
22
22
23
23
The `source-path` parameter specify which directory contains your builded html (your main file must be called `index.html`), while `destination-path` is the path where you want to put your PDF.
24
24
25
+
With a bit more context:
26
+
27
+
```yml
28
+
name: Convert HTML to PDF
29
+
30
+
on:
31
+
push:
32
+
branches:
33
+
- main
34
+
workflow_dispatch: # allows manual trigger of the action
35
+
36
+
jobs:
37
+
convert-html:
38
+
runs-on: ubuntu-latest
39
+
40
+
steps:
41
+
# Checkout the repository
42
+
- name: Checkout code
43
+
uses: actions/checkout@v4
44
+
45
+
# Run the HTML to PDF converter action
46
+
- name: HTML website to PDF converter
47
+
uses: ferdinandkeller/html-to-pdf-action@v2
48
+
with:
49
+
source-path: "./dist"
50
+
destination-path: "./out.pdf"
51
+
52
+
# Upload the PDF as an artifact
53
+
- name: Upload PDF
54
+
uses: actions/upload-artifact@v4
55
+
with:
56
+
name: generated-pdf
57
+
path: ./out.pdf
58
+
```
59
+
25
60
Even though puppeteer (which this generator uses) only supports `AMD64`, thanks to some tweeking this Dockerfile and this GitHub action can work on pretty much any architecture supported by chromium, including on `AMD64` and `ARM64`.
0 commit comments