feat(chromium): split filenames can be controlled with the Gotenberg-Output-Filename header - closes #1130

This commit is contained in:
Julien Neuhart
2025-05-20 14:14:05 +02:00
parent 1d8630810b
commit f75912033e
5 changed files with 210 additions and 0 deletions

View File

@@ -582,6 +582,36 @@ Feature: /forms/chromium/convert/html
Page 3
"""
# See https://github.com/gotenberg/gotenberg/issues/1130.
Scenario: POST /forms/chromium/convert/html (Split Output Filename)
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/pages-3-html/index.html | file |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/zip"
Then there should be 2 PDF(s) in the response
Then there should be the following file(s) in the response:
| foo.zip |
| foo_0.pdf |
| foo_1.pdf |
Then the "foo_0.pdf" PDF should have 2 page(s)
Then the "foo_1.pdf" PDF should have 1 page(s)
Then the "foo_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "foo_0.pdf" PDF should have the following content at page 2:
"""
Page 2
"""
Then the "foo_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
Scenario: POST /forms/chromium/convert/html (Split Pages)
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):
@@ -704,6 +734,40 @@ Feature: /forms/chromium/convert/html
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s)
# See https://github.com/gotenberg/gotenberg/issues/1130.
Scenario: POST /forms/chromium/convert/html (Split & PDF/A-1b & PDF/UA-1 & Output Filename)
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/pages-3-html/index.html | file |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| pdfa | PDF/A-1b | field |
| pdfua | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/zip"
Then there should be 2 PDF(s) in the response
Then there should be the following file(s) in the response:
| foo.zip |
| foo_0.pdf |
| foo_1.pdf |
Then the "foo_0.pdf" PDF should have 2 page(s)
Then the "foo_1.pdf" PDF should have 1 page(s)
Then the "foo_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "foo_0.pdf" PDF should have the following content at page 2:
"""
Page 2
"""
Then the "foo_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
Then the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 1 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 2 failed rule(s)
Scenario: POST /forms/chromium/convert/html (Metadata)
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):