feat(pdfengines): add embed feature

This commit is contained in:
Hubert Lenoir
2025-11-05 13:57:23 +01:00
committed by GitHub
parent f4d3fba306
commit a0ee800002
26 changed files with 479 additions and 17 deletions

View File

@@ -942,3 +942,19 @@ Feature: /forms/chromium/convert/html
| files | testdata/page-1-html/index.html | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
@embed
Scenario: POST /forms/chromium/convert/html (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response
And there should be the following file(s) in the response:
| foo.pdf |
And the "foo.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "foo.pdf" PDF should have the "embed_2.xml" file embedded in it

View File

@@ -1075,3 +1075,20 @@ Feature: /forms/chromium/convert/markdown
| files | testdata/page-1-markdown/page_1.md | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
@embed
Scenario: POST /forms/chromium/convert/markdown (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
| files | testdata/page-1-markdown/index.html | file |
| files | testdata/page-1-markdown/page_1.md | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response
And there should be the following file(s) in the response:
| foo.pdf |
And the "foo.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "foo.pdf" PDF should have the "embed_2.xml" file embedded in it

View File

@@ -1039,3 +1039,20 @@ Feature: /forms/chromium/convert/url
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
@embed
Scenario: POST /foo/forms/chromium/convert/url (Embeds)
Given I have a default Gotenberg container
And I have a static server
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/url" endpoint with the following form data and header(s):
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response
And there should be the following file(s) in the webhook request:
| foo.pdf |
And the "foo.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "foo.pdf" PDF should have the "embed_2.xml" file embedded in it

View File

@@ -652,3 +652,19 @@ Feature: /forms/libreoffice/convert
| files | testdata/page_1.docx | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
@embed
Scenario: POST /forms/libreoffice/convert (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/page_1.docx | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response
And there should be the following file(s) in the response:
| foo.pdf |
And the "foo.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "foo.pdf" PDF should have the "embed_2.xml" file embedded in it

View File

@@ -0,0 +1,32 @@
@embed
Feature: /forms/pdfengines/embed
Scenario: POST /forms/pdfengines/embed
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/embed" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| embeds | testdata/page_2.pdf | file |
Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response
And there should be the following file(s) in the response:
| page_1.pdf |
And the "page_1.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "page_1.pdf" PDF should have the "embed_2.xml" file embedded in it
And the "page_1.pdf" PDF should have the "page_2.pdf" file embedded in it
Scenario: POST /forms/pdfengines/embed with (Download From)
Given I have a default Gotenberg container
And I have a static server
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/embed" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| downloadFrom | [{"url":"http://host.docker.internal:%d/static/testdata/embed_1.xml", "embedded": true},{"url":"http://host.docker.internal:%d/static/testdata/embed_2.xml", "embedded": false}] | field |
Then the response status code should be 200
And the response header "Content-Type" should be "application/pdf"
And there should be 1 PDF(s) in the response
And there should be the following file(s) in the response:
| page_1.pdf |
And the "page_1.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "page_1.pdf" PDF should NOT have the "embed_2.xml" file embedded in it

View File

@@ -368,3 +368,16 @@ Feature: /forms/pdfengines/merge
| files | testdata/page_2.pdf | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
@embed
Scenario: POST /foo/forms/pdfengines/merge (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/merge" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| files | testdata/page_2.pdf | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
And the "foo.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "foo.pdf" PDF should have the "embed_2.xml" file embedded in it

View File

@@ -650,3 +650,23 @@ Feature: /forms/pdfengines/split
| splitSpan | 2 | field |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/zip"
@embed
Scenario: POST /foo/forms/pdfengines/split (Embeds)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
| files | testdata/pages_3.pdf | file |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| splitMode | intervals | field |
| splitSpan | 2 | field |
Then the response status code should be 200
And the response header "Content-Type" should be "application/zip"
And there should be 2 PDF(s) in the response
And there should be the following file(s) in the response:
| pages_3_0.pdf |
| pages_3_1.pdf |
And the "pages_3_0.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "pages_3_0.pdf" PDF should have the "embed_2.xml" file embedded in it
And the "pages_3_1.pdf" PDF should have the "embed_1.xml" file embedded in it
And the "pages_3_1.pdf" PDF should have the "embed_2.xml" file embedded in it