@things-factory/integration-headless 7.0.68 → 7.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/engine/task/headless-pdf-capture-markdown.js +8 -2
- package/dist-server/engine/task/headless-pdf-capture-markdown.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/integration/task/headless-pdf-capture-markdown.ja.md +53 -0
- package/helps/integration/task/headless-pdf-capture-markdown.ko.md +54 -0
- package/helps/integration/task/headless-pdf-capture-markdown.md +53 -0
- package/helps/integration/task/headless-pdf-capture-markdown.ms.md +53 -0
- package/helps/integration/task/headless-pdf-capture-markdown.zh.md +53 -0
- package/package.json +6 -6
- package/server/engine/task/headless-pdf-capture-markdown.ts +8 -2
- package/translations/en.json +1 -0
- package/translations/ja.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
### Headless Markdown Capture Board Task
|
|
2
|
+
|
|
3
|
+
**Headless Markdown Capture Board Task**は、指定されたマークダウン文書をPDFとしてキャプチャし、PDF文書に追加する作業です。この作業では、`headless-pdf-open`タスクで生成されたPDF文書にボードの内容をレンダリングし、新しいページを追加することができ、ヘッダー、フッター、透かしなどの設定を含めることができます。
|
|
4
|
+
|
|
5
|
+
#### パラメータの説明
|
|
6
|
+
|
|
7
|
+
- **accessor**: マークダウンに適用するデータを取得するためのパスを指定します。このパスは、データ構造からボードに関連する情報を抽出するために使用されます。
|
|
8
|
+
|
|
9
|
+
- **board**: キャプチャするボードを指定します。ボードの`id`を含むオブジェクトを渡す必要があり、この`id`を使用して指定されたボードがレンダリングされます。
|
|
10
|
+
|
|
11
|
+
- **draft**: `true`に設定すると、現在作業中のボードのバージョンが使用され、`false`に設定すると、最後にリリースされたボードのバージョンが使用されます。デフォルト値は`false`です。
|
|
12
|
+
|
|
13
|
+
- **format**: PDFページのサイズを指定します。`A4`、`A3`、`Letter`、`Legal`などのオプションから選択できます。
|
|
14
|
+
|
|
15
|
+
- **width**: ページの幅を指定します。例: `"8.5in"`、`"21cm"`、`"600px"`。指定されていない場合、`format`に基づいて自動的に設定されます。
|
|
16
|
+
|
|
17
|
+
- **height**: ページの高さを指定します。例: `"11in"`、`"29.7cm"`、`"800px"`。指定されていない場合、`format`に基づいて自動的に設定されます。
|
|
18
|
+
|
|
19
|
+
- **marginTop**: ページの上部余白を指定します。例: `"0.5in"`、`"1cm"`、`"100px"`。
|
|
20
|
+
|
|
21
|
+
- **marginBottom**: ページの下部余白を指定します。例: `"0.5in"`、`"1cm"`、`"100px"`。
|
|
22
|
+
|
|
23
|
+
- **marginLeft**: ページの左余白を指定します。例: `"0.5in"`、`"1cm"`、`"100px"`。
|
|
24
|
+
|
|
25
|
+
- **marginRight**: ページの右余白を指定します。例: `"0.5in"`、`"1cm"`、`"100px"`。
|
|
26
|
+
|
|
27
|
+
- **scale**: ページコンテンツのスケールを調整します。デフォルト値は`1`で、値が大きいほどコンテンツが拡大されます。
|
|
28
|
+
|
|
29
|
+
- **printBackground**: `true`に設定すると、HTMLページの背景画像や色が含まれます。デフォルト値は`true`です。
|
|
30
|
+
|
|
31
|
+
- **landscape**: `true`に設定すると、PDFが横向きで生成されます。デフォルト値は`false`です。
|
|
32
|
+
|
|
33
|
+
- **preferCSSPageSize**: `true`に設定すると、CSSで定義されたページサイズが優先的に使用されます。デフォルト値は`false`です。
|
|
34
|
+
|
|
35
|
+
- **Markdown Content Accessor**または**Markdown Content**: PDFにキャプチャされるマークダウン文書の内容を指定します。マークダウンコンテンツを出力する別のタスクを指定する場合は、**Markdown Content Accessor**を指定するか、直接**Markdown Content**を指定することもできます。両方が指定されている場合、アクセサが優先されます。
|
|
36
|
+
|
|
37
|
+
#### 主な機能
|
|
38
|
+
|
|
39
|
+
- **ボードレンダリング**: 指定されたマークダウン文書の内容をキャプチャし、PDF文書に追加します。この作業は、ボードの現在の状態をそのまま反映し、ボードのさまざまな視覚要素を含めることができます。
|
|
40
|
+
|
|
41
|
+
- **ヘッダーおよびフッター設定**: 各ページに動的にヘッダーとフッターを挿入できます。ヘッダーとフッターはejsテンプレートで作成され、ページ番号や総ページ数などを動的に含めることができます。
|
|
42
|
+
|
|
43
|
+
- **透かし設定**: PDFページに透かしを追加できます。透かしはテキストで表示され、ページの中央に半透明で配置できます。
|
|
44
|
+
|
|
45
|
+
- **ページ設定**: ページのサイズ、余白、スケールなどを設定して、PDF文書を希望のレイアウトに調整できます。
|
|
46
|
+
|
|
47
|
+
#### 使用上の注意点
|
|
48
|
+
|
|
49
|
+
- **事前に`HeadlessPDFOpen`タスクを実行する必要がある**: `HeadlessPDFCaptureBoard`タスクは、必ず事前に`HeadlessPDFOpen`タスクが実行された後に実行される必要があります。そうしないと、PDF文書が存在しないためエラーが発生します。
|
|
50
|
+
|
|
51
|
+
- **動的データ処理**: ejsテンプレートを通じて動的にHTMLコンテンツを生成でき、テンプレート内で`accessor`を使用してデータにアクセスできます。
|
|
52
|
+
|
|
53
|
+
- **ヘッダー/フッター**: `HeadlessPDFOpen`で設定されたヘッダーとフッターが自動的に含まれる可能性があり、必要に応じて各ページに合わせて調整できます。
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
### Headless Markdown Capture Board Task
|
|
2
|
+
|
|
3
|
+
**Headless Markdown Capture Board Task**는 주어진 마크다운 문서를 PDF로 캡처하여 PDF 문서에 추가하는 작업입니다. 이 작업은 `headless-pdf-open` 작업으로 생성된 PDF 문서에 보드의 내용을 렌더링하여 새로운 페이지를 추가하며, 헤더, 푸터, 워터마크 등의 설정을 포함할 수 있습니다.
|
|
4
|
+
|
|
5
|
+
#### 매개변수 설명
|
|
6
|
+
|
|
7
|
+
- **accessor**: 마크다운에 적용할 데이터를 가져오기 위한 경로를 지정합니다. 이 경로는 데이터 구조에서 보드와 관련된 정보를 추출하는 데 사용됩니다.
|
|
8
|
+
|
|
9
|
+
- **board**: 캡처할 보드를 지정합니다. 보드의 `id`를 포함하는 객체를 전달해야 하며, 이 `id`를 사용하여 지정된 보드가 렌더링됩니다.
|
|
10
|
+
|
|
11
|
+
- **draft**: `true`로 설정하면 현재 작업 중인 보드의 버전을, `false`로 설정하면 마지막으로 릴리즈된 보드의 버전을 사용합니다. 기본값은 `false`입니다.
|
|
12
|
+
|
|
13
|
+
- **format**: PDF 페이지의 크기를 지정합니다. `A4`, `A3`, `Letter`, `Legal` 등의 값 중에서 선택할 수 있습니다.
|
|
14
|
+
|
|
15
|
+
- **width**: 페이지의 폭을 지정합니다. 예: `"8.5in"`, `"21cm"`, `"600px"`. 지정하지 않으면 `format`에 따라 자동으로 설정됩니다.
|
|
16
|
+
|
|
17
|
+
- **height**: 페이지의 높이를 지정합니다. 예: `"11in"`, `"29.7cm"`, `"800px"`. 지정하지 않으면 `format`에 따라 자동으로 설정됩니다.
|
|
18
|
+
|
|
19
|
+
- **marginTop**: 페이지 상단 여백을 지정합니다. 예: `"0.5in"`, `"1cm"`, `"100px"`.
|
|
20
|
+
|
|
21
|
+
- **marginBottom**: 페이지 하단 여백을 지정합니다. 예: `"0.5in"`, `"1cm"`, `"100px"`.
|
|
22
|
+
|
|
23
|
+
- **marginLeft**: 페이지 왼쪽 여백을 지정합니다. 예: `"0.5in"`, `"1cm"`, `"100px"`.
|
|
24
|
+
|
|
25
|
+
- **marginRight**: 페이지 오른쪽 여백을 지정합니다. 예: `"0.5in"`, `"1cm"`, `"100px"`.
|
|
26
|
+
|
|
27
|
+
- **scale**: 페이지 콘텐츠의 스케일을 조정합니다. 기본값은 `1`이며, 값이 클수록 콘텐츠가 확대됩니다.
|
|
28
|
+
|
|
29
|
+
- **printBackground**: `true`로 설정하면, HTML 페이지의 배경 이미지나 색상이 포함됩니다. 기본값은 `true`입니다.
|
|
30
|
+
|
|
31
|
+
- **landscape**: `true`로 설정하면, PDF가 가로 방향으로 생성됩니다. 기본값은 `false`입니다.
|
|
32
|
+
|
|
33
|
+
- **preferCSSPageSize**: `true`로 설정하면, CSS에서 정의된 페이지 크기를 우선시하여 사용합니다. 기본값은 `false`입니다.
|
|
34
|
+
|
|
35
|
+
- **마크다운 본문 접근자** 또는 **마크다운 본문**: PDF에 캡처될 마크다운 문서 본문을 지정합니다. 마크다운 본문을 출력하는 다른 태스크를 지정하려면 **마크다운 본문 접근자**를 지정하고, 직접 **마크다운 본문**을 지정할 수도 있습니다. 두 개가 모두 지정되어 있으면, 접근자를 우선적으로 적용합니다.
|
|
36
|
+
|
|
37
|
+
#### 주요 기능
|
|
38
|
+
|
|
39
|
+
- **보드 렌더링**: 지정된 마크다운 문서의 내용을 캡처하여 PDF 문서에 추가합니다. 이 작업은 보드의 현재 상태를 그대로 반영하며, 보드의 다양한 시각적 요소를 포함할 수 있습니다.
|
|
40
|
+
|
|
41
|
+
- **헤더 및 푸터 설정**: 각 페이지에 동적으로 헤더와 푸터를 삽입할 수 있습니다. 헤더와 푸터는 ejs 템플릿으로 작성되며, 페이지 번호와 총 페이지 수 등을 동적으로 포함할 수 있습니다.
|
|
42
|
+
|
|
43
|
+
- **워터마크 설정**: PDF 페이지에 워터마크를 추가할 수 있습니다. 워터마크는 텍스트로 표시되며, 페이지의 중앙에 반투명으로 배치할 수 있습니다.
|
|
44
|
+
|
|
45
|
+
- **페이지 설정**: 페이지의 크기, 여백, 스케일 등을 설정하여 PDF 문서를 원하는 레이아웃으로 조정할 수 있습니다.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
#### 사용 시 유의사항
|
|
49
|
+
|
|
50
|
+
- **이전에 `HeadlessPDFOpen` 작업이 실행되어야 함**: `HeadlessPDFCaptureBoard` 작업은 반드시 이전에 `HeadlessPDFOpen` 작업이 수행된 후에 실행되어야 합니다. 그렇지 않으면 PDF 문서가 존재하지 않기 때문에 오류가 발생합니다.
|
|
51
|
+
|
|
52
|
+
- **동적 데이터 처리**: ejs 템플릿을 통해 동적으로 HTML 콘텐츠를 생성할 수 있으며, 템플릿에서 `accessor`를 사용하여 데이터에 접근할 수 있습니다.
|
|
53
|
+
|
|
54
|
+
- **헤더/푸터**: `HeadlessPDFOpen`에서 설정된 헤더와 푸터가 자동으로 포함될 수 있으며, 필요에 따라 각 페이지에 맞게 조정할 수 있습니다.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
### Headless Markdown Capture Board Task
|
|
2
|
+
|
|
3
|
+
The **Headless Markdown Capture Board Task** involves capturing a given markdown document as a PDF and adding it to a PDF document. This task renders the contents of the board into the PDF document generated by the `headless-pdf-open` task, adding a new page, and can include settings like headers, footers, and watermarks.
|
|
4
|
+
|
|
5
|
+
#### Parameter Description
|
|
6
|
+
|
|
7
|
+
- **accessor**: Specifies the path to retrieve the data to be applied to the markdown. This path is used to extract information related to the board from the data structure.
|
|
8
|
+
|
|
9
|
+
- **board**: Specifies the board to capture. An object containing the board's `id` must be provided, and the specified board is rendered using this `id`.
|
|
10
|
+
|
|
11
|
+
- **draft**: If set to `true`, the version of the board currently being worked on is used; if set to `false`, the latest released version of the board is used. The default value is `false`.
|
|
12
|
+
|
|
13
|
+
- **format**: Specifies the size of the PDF page. Options include `A4`, `A3`, `Letter`, `Legal`, and others.
|
|
14
|
+
|
|
15
|
+
- **width**: Specifies the width of the page, e.g., `"8.5in"`, `"21cm"`, `"600px"`. If not specified, it is automatically set based on the `format`.
|
|
16
|
+
|
|
17
|
+
- **height**: Specifies the height of the page, e.g., `"11in"`, `"29.7cm"`, `"800px"`. If not specified, it is automatically set based on the `format`.
|
|
18
|
+
|
|
19
|
+
- **marginTop**: Specifies the top margin of the page, e.g., `"0.5in"`, `"1cm"`, `"100px"`.
|
|
20
|
+
|
|
21
|
+
- **marginBottom**: Specifies the bottom margin of the page, e.g., `"0.5in"`, `"1cm"`, `"100px"`.
|
|
22
|
+
|
|
23
|
+
- **marginLeft**: Specifies the left margin of the page, e.g., `"0.5in"`, `"1cm"`, `"100px"`.
|
|
24
|
+
|
|
25
|
+
- **marginRight**: Specifies the right margin of the page, e.g., `"0.5in"`, `"1cm"`, `"100px"`.
|
|
26
|
+
|
|
27
|
+
- **scale**: Adjusts the scale of the page content. The default value is `1`, with higher values enlarging the content.
|
|
28
|
+
|
|
29
|
+
- **printBackground**: If set to `true`, background images or colors from the HTML page are included. The default value is `true`.
|
|
30
|
+
|
|
31
|
+
- **landscape**: If set to `true`, the PDF is generated in landscape orientation. The default value is `false`.
|
|
32
|
+
|
|
33
|
+
- **preferCSSPageSize**: If set to `true`, the page size defined in CSS is prioritized and used. The default value is `false`.
|
|
34
|
+
|
|
35
|
+
- **Markdown Content Accessor** or **Markdown Content**: Specifies the markdown document content to be captured in the PDF. If you want to specify another task that outputs the markdown content, specify **Markdown Content Accessor**, or you can directly specify **Markdown Content**. If both are specified, the accessor takes priority.
|
|
36
|
+
|
|
37
|
+
#### Key Features
|
|
38
|
+
|
|
39
|
+
- **Board Rendering**: Captures the content of the specified markdown document and adds it to the PDF document. This task reflects the current state of the board and can include various visual elements of the board.
|
|
40
|
+
|
|
41
|
+
- **Header and Footer Settings**: Allows dynamic insertion of headers and footers on each page. Headers and footers are written in ejs templates and can dynamically include elements like page numbers and total page count.
|
|
42
|
+
|
|
43
|
+
- **Watermark Settings**: Adds a watermark to the PDF page. The watermark is displayed as text and can be positioned semi-transparently in the center of the page.
|
|
44
|
+
|
|
45
|
+
- **Page Settings**: Configures the size, margins, and scale of the page to adjust the PDF document to the desired layout.
|
|
46
|
+
|
|
47
|
+
#### Usage Notes
|
|
48
|
+
|
|
49
|
+
- **Must Be Preceded by `HeadlessPDFOpen` Task**: The `HeadlessPDFCaptureBoard` task must be executed after the `HeadlessPDFOpen` task has been completed. Otherwise, an error will occur as the PDF document does not exist.
|
|
50
|
+
|
|
51
|
+
- **Dynamic Data Processing**: Allows for dynamic generation of HTML content through ejs templates, with access to data via the `accessor`.
|
|
52
|
+
|
|
53
|
+
- **Header/Footer**: The headers and footers set in `HeadlessPDFOpen` can be automatically included and adjusted as needed for each page.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
### Headless Markdown Capture Board Task
|
|
2
|
+
|
|
3
|
+
**Headless Markdown Capture Board Task** melibatkan menangkap dokumen markdown yang diberikan sebagai PDF dan menambahkannya ke dalam dokumen PDF. Tugas ini merender kandungan papan ke dalam dokumen PDF yang dihasilkan oleh tugas `headless-pdf-open`, menambah halaman baru, dan boleh termasuk tetapan seperti tajuk, kaki, dan watermark.
|
|
4
|
+
|
|
5
|
+
#### Penerangan Parameter
|
|
6
|
+
|
|
7
|
+
- **accessor**: Menentukan laluan untuk mendapatkan data yang akan digunakan pada markdown. Laluan ini digunakan untuk mengekstrak maklumat yang berkaitan dengan papan daripada struktur data.
|
|
8
|
+
|
|
9
|
+
- **board**: Menentukan papan yang akan ditangkap. Objek yang mengandungi `id` papan mesti disediakan, dan papan yang ditentukan akan dirender menggunakan `id` ini.
|
|
10
|
+
|
|
11
|
+
- **draft**: Jika ditetapkan kepada `true`, versi papan yang sedang dalam kerja digunakan; jika ditetapkan kepada `false`, versi papan yang terakhir dikeluarkan digunakan. Nilai lalai ialah `false`.
|
|
12
|
+
|
|
13
|
+
- **format**: Menentukan saiz halaman PDF. Pilihan termasuk `A4`, `A3`, `Letter`, `Legal`, dan lain-lain.
|
|
14
|
+
|
|
15
|
+
- **width**: Menentukan lebar halaman, contoh: `"8.5in"`, `"21cm"`, `"600px"`. Jika tidak dinyatakan, ia akan ditetapkan secara automatik berdasarkan `format`.
|
|
16
|
+
|
|
17
|
+
- **height**: Menentukan ketinggian halaman, contoh: `"11in"`, `"29.7cm"`, `"800px"`. Jika tidak dinyatakan, ia akan ditetapkan secara automatik berdasarkan `format`.
|
|
18
|
+
|
|
19
|
+
- **marginTop**: Menentukan margin atas halaman, contoh: `"0.5in"`, `"1cm"`, `"100px"`.
|
|
20
|
+
|
|
21
|
+
- **marginBottom**: Menentukan margin bawah halaman, contoh: `"0.5in"`, `"1cm"`, `"100px"`.
|
|
22
|
+
|
|
23
|
+
- **marginLeft**: Menentukan margin kiri halaman, contoh: `"0.5in"`, `"1cm"`, `"100px"`.
|
|
24
|
+
|
|
25
|
+
- **marginRight**: Menentukan margin kanan halaman, contoh: `"0.5in"`, `"1cm"`, `"100px"`.
|
|
26
|
+
|
|
27
|
+
- **scale**: Melaraskan skala kandungan halaman. Nilai lalai ialah `1`, dengan nilai yang lebih besar membesarkan kandungan.
|
|
28
|
+
|
|
29
|
+
- **printBackground**: Jika ditetapkan kepada `true`, imej latar belakang atau warna dari halaman HTML akan disertakan. Nilai lalai ialah `true`.
|
|
30
|
+
|
|
31
|
+
- **landscape**: Jika ditetapkan kepada `true`, PDF akan dihasilkan dalam orientasi landskap. Nilai lalai ialah `false`.
|
|
32
|
+
|
|
33
|
+
- **preferCSSPageSize**: Jika ditetapkan kepada `true`, saiz halaman yang ditentukan dalam CSS akan diutamakan dan digunakan. Nilai lalai ialah `false`.
|
|
34
|
+
|
|
35
|
+
- **Markdown Content Accessor** atau **Markdown Content**: Menentukan kandungan dokumen markdown yang akan ditangkap dalam PDF. Jika anda ingin menentukan tugas lain yang mengeluarkan kandungan markdown, nyatakan **Markdown Content Accessor**, atau anda boleh secara langsung menyatakan **Markdown Content**. Jika kedua-duanya dinyatakan, accessor akan diutamakan.
|
|
36
|
+
|
|
37
|
+
#### Ciri-ciri Utama
|
|
38
|
+
|
|
39
|
+
- **Rendering Papan**: Menangkap kandungan dokumen markdown yang ditentukan dan menambahkannya ke dalam dokumen PDF. Tugas ini mencerminkan keadaan semasa papan dan boleh merangkumi pelbagai elemen visual papan.
|
|
40
|
+
|
|
41
|
+
- **Tetapan Tajuk dan Kaki**: Membolehkan penyisipan tajuk dan kaki secara dinamik pada setiap halaman. Tajuk dan kaki ditulis dalam templat ejs dan boleh merangkumi elemen seperti nombor halaman dan jumlah halaman secara dinamik.
|
|
42
|
+
|
|
43
|
+
- **Tetapan Watermark**: Menambah watermark pada halaman PDF. Watermark dipaparkan sebagai teks dan boleh ditempatkan secara separa lutsinar di tengah halaman.
|
|
44
|
+
|
|
45
|
+
- **Tetapan Halaman**: Mengkonfigurasi saiz, margin, dan skala halaman untuk menyesuaikan dokumen PDF kepada susun atur yang dikehendaki.
|
|
46
|
+
|
|
47
|
+
#### Nota Penggunaan
|
|
48
|
+
|
|
49
|
+
- **Mesti Didahului oleh Tugas `HeadlessPDFOpen`**: Tugas `HeadlessPDFCaptureBoard` mesti dijalankan selepas tugas `HeadlessPDFOpen` diselesaikan. Jika tidak, ralat akan berlaku kerana dokumen PDF tidak wujud.
|
|
50
|
+
|
|
51
|
+
- **Pemprosesan Data Dinamik**: Membolehkan penjanaan kandungan HTML secara dinamik melalui templat ejs, dengan akses kepada data melalui `accessor`.
|
|
52
|
+
|
|
53
|
+
- **Tajuk/Kaki**: Tajuk dan kaki yang ditetapkan dalam `HeadlessPDFOpen` boleh disertakan secara automatik dan disesuaikan mengikut keperluan untuk setiap halaman.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
### Headless Markdown Capture Board Task
|
|
2
|
+
|
|
3
|
+
**Headless Markdown Capture Board Task**是将给定的Markdown文档捕获为PDF并将其添加到PDF文档中的任务。此任务将板的内容渲染到由`headless-pdf-open`任务生成的PDF文档中,添加新页面,并可以包括诸如页眉、页脚和水印等设置。
|
|
4
|
+
|
|
5
|
+
#### 参数说明
|
|
6
|
+
|
|
7
|
+
- **accessor**: 指定用于获取应用于Markdown的数据的路径。此路径用于从数据结构中提取与板相关的信息。
|
|
8
|
+
|
|
9
|
+
- **board**: 指定要捕获的板。必须提供包含板`id`的对象,并使用此`id`渲染指定的板。
|
|
10
|
+
|
|
11
|
+
- **draft**: 如果设置为`true`,则使用当前正在处理的板的版本;如果设置为`false`,则使用最新发布的板的版本。默认值为`false`。
|
|
12
|
+
|
|
13
|
+
- **format**: 指定PDF页面的大小。可选值包括`A4`、`A3`、`Letter`、`Legal`等。
|
|
14
|
+
|
|
15
|
+
- **width**: 指定页面的宽度,例如:`"8.5in"`、`"21cm"`、`"600px"`。如果未指定,将根据`format`自动设置。
|
|
16
|
+
|
|
17
|
+
- **height**: 指定页面的高度,例如:`"11in"`、`"29.7cm"`、`"800px"`。如果未指定,将根据`format`自动设置。
|
|
18
|
+
|
|
19
|
+
- **marginTop**: 指定页面顶部的边距,例如:`"0.5in"`、`"1cm"`、`"100px"`。
|
|
20
|
+
|
|
21
|
+
- **marginBottom**: 指定页面底部的边距,例如:`"0.5in"`、`"1cm"`、`"100px"`。
|
|
22
|
+
|
|
23
|
+
- **marginLeft**: 指定页面左侧的边距,例如:`"0.5in"`、`"1cm"`、`"100px"`。
|
|
24
|
+
|
|
25
|
+
- **marginRight**: 指定页面右侧的边距,例如:`"0.5in"`、`"1cm"`、`"100px"`。
|
|
26
|
+
|
|
27
|
+
- **scale**: 调整页面内容的比例。默认值为`1`,值越大内容越大。
|
|
28
|
+
|
|
29
|
+
- **printBackground**: 如果设置为`true`,则包括HTML页面的背景图像或颜色。默认值为`true`。
|
|
30
|
+
|
|
31
|
+
- **landscape**: 如果设置为`true`,则PDF将以横向生成。默认值为`false`。
|
|
32
|
+
|
|
33
|
+
- **preferCSSPageSize**: 如果设置为`true`,则优先使用CSS中定义的页面大小。默认值为`false`。
|
|
34
|
+
|
|
35
|
+
- **Markdown Content Accessor**或**Markdown Content**: 指定要捕获到PDF中的Markdown文档内容。如果想要指定另一个输出Markdown内容的任务,请指定**Markdown Content Accessor**,或者可以直接指定**Markdown Content**。如果两者都指定,则优先使用accessor。
|
|
36
|
+
|
|
37
|
+
#### 主要功能
|
|
38
|
+
|
|
39
|
+
- **板渲染**: 捕获指定的Markdown文档内容并将其添加到PDF文档中。此任务反映了板的当前状态,并可以包含板的各种视觉元素。
|
|
40
|
+
|
|
41
|
+
- **页眉和页脚设置**: 允许在每个页面上动态插入页眉和页脚。页眉和页脚使用ejs模板编写,并可以动态包含页码和总页数等元素。
|
|
42
|
+
|
|
43
|
+
- **水印设置**: 可以在PDF页面中添加水印。水印以文本形式显示,并可半透明地居中放置在页面中。
|
|
44
|
+
|
|
45
|
+
- **页面设置**: 配置页面的大小、边距和比例,以调整PDF文档到所需的布局。
|
|
46
|
+
|
|
47
|
+
#### 使用注意事项
|
|
48
|
+
|
|
49
|
+
- **必须先执行`HeadlessPDFOpen`任务**: `HeadlessPDFCaptureBoard`任务必须在`HeadlessPDFOpen`任务完成后执行。否则,由于PDF文档不存在,将发生错误。
|
|
50
|
+
|
|
51
|
+
- **动态数据处理**: 允许通过ejs模板动态生成HTML内容,并通过模板中的`accessor`访问数据。
|
|
52
|
+
|
|
53
|
+
- **页眉/页脚**: 可以自动包含在`HeadlessPDFOpen`中设置的页眉和页脚,并根据需要调整每个页面的内容。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/integration-headless",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.70",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"things-factory": true,
|
|
6
6
|
"author": "heartyoh <heartyoh@hatiolab.com>",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"clean": "npm run clean:server"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@things-factory/attachment-base": "^7.0.
|
|
26
|
-
"@things-factory/board-service": "^7.0.
|
|
27
|
-
"@things-factory/integration-base": "^7.0.
|
|
28
|
-
"@things-factory/shell": "^7.0.
|
|
25
|
+
"@things-factory/attachment-base": "^7.0.70",
|
|
26
|
+
"@things-factory/board-service": "^7.0.70",
|
|
27
|
+
"@things-factory/integration-base": "^7.0.70",
|
|
28
|
+
"@things-factory/shell": "^7.0.70",
|
|
29
29
|
"ejs": "^3.1.10",
|
|
30
30
|
"pdf-lib": "^1.17.1"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "f046cfbb15447499fc5be9a9d82e2deb296b5f36"
|
|
33
33
|
}
|
|
@@ -9,10 +9,11 @@ export async function HeadlessPDFCaptureMarkdown(step, context) {
|
|
|
9
9
|
await pdfUtil.initBrowser(step.connection)
|
|
10
10
|
|
|
11
11
|
try {
|
|
12
|
-
const { accessor, markdownContent } = step.params
|
|
12
|
+
const { accessor, markdownContent, markdownContentAccessor } = step.params
|
|
13
13
|
const templateInput = access(accessor, context.data)
|
|
14
|
+
const markdownTemplate = markdownContentAccessor ? access(markdownContentAccessor, context.data) : markdownContent
|
|
14
15
|
|
|
15
|
-
const renderedMarkdown = pdfUtil.renderTemplate(
|
|
16
|
+
const renderedMarkdown = pdfUtil.renderTemplate(markdownTemplate, templateInput)
|
|
16
17
|
const htmlContent = marked(renderedMarkdown)
|
|
17
18
|
|
|
18
19
|
await pdfUtil.processPageAndGeneratePDF(step.params, htmlContent)
|
|
@@ -29,6 +30,11 @@ export async function HeadlessPDFCaptureMarkdown(step, context) {
|
|
|
29
30
|
|
|
30
31
|
HeadlessPDFCaptureMarkdown.parameterSpec = [
|
|
31
32
|
...getCommonParameterSpec(),
|
|
33
|
+
{
|
|
34
|
+
type: 'scenario-step-input',
|
|
35
|
+
name: 'markdownContentAccessor',
|
|
36
|
+
label: 'markdown-content-accessor'
|
|
37
|
+
},
|
|
32
38
|
{
|
|
33
39
|
type: 'textarea',
|
|
34
40
|
name: 'markdownContent',
|
package/translations/en.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"label.html-content": "html content",
|
|
9
9
|
"label.landscape": "landscape",
|
|
10
10
|
"label.markdown-content": "markdown content",
|
|
11
|
+
"label.markdown-content-accessor": "markdown content accessor",
|
|
11
12
|
"label.output-path": "output path",
|
|
12
13
|
"label.page-format": "page format",
|
|
13
14
|
"label.page-height": "page height",
|
package/translations/ja.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"label.html-content": "html コンテンツ",
|
|
9
9
|
"label.landscape": "横向き",
|
|
10
10
|
"label.markdown-content": "Markdown コンテンツ",
|
|
11
|
+
"label.markdown-content-accessor": "Markdown コンテンツ アクセサー",
|
|
11
12
|
"label.output-path": "出力パス",
|
|
12
13
|
"label.page-format": "ページ形式",
|
|
13
14
|
"label.page-height": "ページ高さ",
|
package/translations/ko.json
CHANGED
package/translations/ms.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"label.html-content": "kandungan html",
|
|
9
9
|
"label.landscape": "melintang",
|
|
10
10
|
"label.markdown-content": "kandungan markdown",
|
|
11
|
+
"label.markdown-content-accessor": "Aksesori Kandungan Markdown",
|
|
11
12
|
"label.output-path": "laluan output",
|
|
12
13
|
"label.page-format": "format halaman",
|
|
13
14
|
"label.page-height": "tinggi halaman",
|
package/translations/zh.json
CHANGED