refactor(pdfengines): embeds => attachments

This commit is contained in:
Julien Neuhart
2026-03-08 15:49:09 +01:00
parent 7af3cd1ff5
commit cf9fd7eedc
92 changed files with 5763 additions and 3082 deletions

View File

@@ -1085,28 +1085,28 @@ Feature: /forms/chromium/convert/url
Then there should be 1 PDF(s) in the response
Then the response PDF(s) should be encrypted
@embed
Scenario: POST /foo/forms/chromium/convert/url (Embeds)
@attachments
Scenario: POST /foo/forms/chromium/convert/url (Attachments)
Given I have a default Gotenberg container
Given 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):
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| attachments | testdata/attachment_1.xml | file |
| attachments | testdata/attachment_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the webhook request:
| foo.pdf |
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
Then the response PDF(s) should have the "attachment_1.xml" file attached
Then the response PDF(s) should have the "attachment_2.xml" file attached
# FIXME: once decrypt is done, add encrypt and check after the content of the PDF.
@convert
@metadata
@flatten
@embed
@attachments
Scenario: POST /forms/chromium/convert/url (PDF/A-1b & PDF/UA-1 & Metadata & Flatten)
Given I have a default Gotenberg container
Given I have a static server
@@ -1116,8 +1116,8 @@ Feature: /forms/chromium/convert/url
| pdfua | true | field |
| metadata | {"Author":"Julien Neuhart","Copyright":"Julien Neuhart","CreateDate":"2006-09-18T16:27:50-04:00","Creator":"Gotenberg","Keywords":["first","second"],"Marked":true,"ModDate":"2006-09-18T16:27:50-04:00","PDFVersion":1.7,"Producer":"Gotenberg","Subject":"Sample","Title":"Sample","Trapped":"Unknown"} | field |
| flatten | true | field |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
| attachments | testdata/attachment_1.xml | file |
| attachments | testdata/attachment_2.xml | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
@@ -1127,8 +1127,8 @@ Feature: /forms/chromium/convert/url
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 9 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s)
Then the response PDF(s) should be flatten
Then the response PDF(s) should have the "embed_1.xml" file embedded
Then the response PDF(s) should have the "embed_2.xml" file embedded
Then the response PDF(s) should have the "attachment_1.xml" file attached
Then the response PDF(s) should have the "attachment_2.xml" file attached
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/read" endpoint with the following form data and header(s):
| files | teststore/foo.pdf | file |
Then the response status code should be 200
@@ -1161,17 +1161,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 404
Scenario: POST /forms/chromium/convert/url (Gotenberg Trace)
@telemetry
Scenario: POST /forms/chromium/convert/url (Telemetry)
Given I have a default Gotenberg container
Given 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):
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
| Gotenberg-Trace | forms_chromium_convert_url | header |
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
| X-Correlation-ID | forms_chromium_convert_url | header |
| traceparent | 00-12345678901234567890123456789012-1234567890123456-01 | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then the response header "Gotenberg-Trace" should be "forms_chromium_convert_url"
Then the response header "X-Correlation-ID" should be "forms_chromium_convert_url"
Then the Gotenberg container should log the following entries:
| "trace":"forms_chromium_convert_url" |
| "correlation_id":"forms_chromium_convert_url" |
| "trace_id":"12345678901234567890123456789012" |
@webhook
Scenario: POST /forms/chromium/convert/url (Webhook)