Files
gotenberg/test/integration/features/pdfengines_split.feature
T

810 lines
44 KiB
Gherkin

@pdfengines
@pdfengines-split
@split
Feature: /forms/pdfengines/split
Scenario: POST /forms/pdfengines/split (Intervals - Default)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
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:
| pages_3_0.pdf |
| pages_3_1.pdf |
Then the "pages_3_0.pdf" PDF should have 2 page(s)
Then the "pages_3_1.pdf" PDF should have 1 page(s)
Then the "pages_3_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_3_0.pdf" PDF should have the following content at page 2:
"""
Page 2
"""
Then the "pages_3_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
Scenario: POST /forms/pdfengines/split (Pages - Default)
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 |
| splitMode | pages | field |
| splitSpan | 2- | field |
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:
| pages_3_0.pdf |
| pages_3_1.pdf |
Then the "pages_3_0.pdf" PDF should have 1 page(s)
Then the "pages_3_1.pdf" PDF should have 1 page(s)
Then the "pages_3_0.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
Then the "pages_3_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
Scenario: POST /forms/pdfengines/split (Pages & Unify - Default)
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 |
| splitMode | pages | field |
| splitSpan | 2- | field |
| splitUnify | true | field |
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 response:
| pages_3.pdf |
Then the "pages_3.pdf" PDF should have 2 page(s)
Then the "pages_3.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
Then the "pages_3.pdf" PDF should have the following content at page 2:
"""
Page 3
"""
Scenario: POST /forms/pdfengines/split (Intervals - pdfcpu)
Given I have a Gotenberg container with the following environment variable(s):
| PDFENGINES_SPLIT_ENGINES | pdfcpu |
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
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:
| pages_3_0.pdf |
| pages_3_1.pdf |
Then the "pages_3_0.pdf" PDF should have 2 page(s)
Then the "pages_3_1.pdf" PDF should have 1 page(s)
Then the "pages_3_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_3_0.pdf" PDF should have the following content at page 2:
"""
Page 2
"""
Then the "pages_3_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
Scenario: POST /forms/pdfengines/split (Pages - pdfcpu)
Given I have a Gotenberg container with the following environment variable(s):
| PDFENGINES_SPLIT_ENGINES | pdfcpu |
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 |
| splitMode | pages | field |
| splitSpan | 2- | field |
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:
| pages_3_0.pdf |
| pages_3_1.pdf |
Then the "pages_3_0.pdf" PDF should have 1 page(s)
Then the "pages_3_1.pdf" PDF should have 1 page(s)
Then the "pages_3_0.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
Then the "pages_3_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
Scenario: POST /forms/pdfengines/split (Pages & Unify - pdfcpu)
Given I have a Gotenberg container with the following environment variable(s):
| PDFENGINES_SPLIT_ENGINES | pdfcpu |
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 |
| splitMode | pages | field |
| splitSpan | 2- | field |
| splitUnify | true | field |
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 response:
| pages_3.pdf |
Then the "pages_3.pdf" PDF should have 2 page(s)
Then the "pages_3.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
Then the "pages_3.pdf" PDF should have the following content at page 2:
"""
Page 3
"""
Scenario: POST /forms/pdfengines/split (Pages & Unify - QPDF)
Given I have a Gotenberg container with the following environment variable(s):
| PDFENGINES_SPLIT_ENGINES | qpdf |
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 |
| splitMode | pages | field |
| splitSpan | 2-z | field |
| splitUnify | true | field |
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 response:
| pages_3.pdf |
Then the "pages_3.pdf" PDF should have 2 page(s)
Then the "pages_3.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
Then the "pages_3.pdf" PDF should have the following content at page 2:
"""
Page 3
"""
Scenario: POST /forms/pdfengines/split (Pages & Unify - PDFtk)
Given I have a Gotenberg container with the following environment variable(s):
| PDFENGINES_SPLIT_ENGINES | pdftk |
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 |
| splitMode | pages | field |
| splitSpan | 2-end | field |
| splitUnify | true | field |
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 response:
| pages_3.pdf |
Then the "pages_3.pdf" PDF should have 2 page(s)
Then the "pages_3.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
Then the "pages_3.pdf" PDF should have the following content at page 2:
"""
Page 3
"""
Scenario: POST /forms/pdfengines/split (Many PDFs - Lot of Pages)
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_12.pdf | file |
| files | testdata/pages_3.pdf | file |
| splitMode | intervals | field |
| splitSpan | 1 | field |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/zip"
Then there should be 15 PDF(s) in the response
Then there should be the following file(s) in the response:
| pages_3_0.pdf |
| pages_3_1.pdf |
| pages_3_2.pdf |
| pages_12_0.pdf |
| pages_12_1.pdf |
| pages_12_2.pdf |
| pages_12_3.pdf |
| pages_12_4.pdf |
| pages_12_5.pdf |
| pages_12_6.pdf |
| pages_12_7.pdf |
| pages_12_8.pdf |
| pages_12_9.pdf |
| pages_12_10.pdf |
| pages_12_11.pdf |
Then the "pages_3_0.pdf" PDF should have 1 page(s)
Then the "pages_3_2.pdf" PDF should have 1 page(s)
Then the "pages_12_0.pdf" PDF should have 1 page(s)
Then the "pages_12_11.pdf" PDF should have 1 page(s)
Then the "pages_3_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_3_2.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
Then the "pages_12_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_12_11.pdf" PDF should have the following content at page 1:
"""
Page 12
"""
Scenario: POST /forms/pdfengines/split (Bad Request)
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):
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 400
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
Then the response body should match string:
"""
Invalid form data: form field 'splitMode' is required
form field 'splitSpan' is required
no form file found for extensions: [.pdf]
"""
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 |
| splitMode | foo | field |
| splitSpan | 2 | field |
Then the response status code should be 400
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
Then the response body should match string:
"""
Invalid form data: form field 'splitMode' is invalid (got 'foo', resulting to wrong value, expected either 'intervals' or 'pages')
"""
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 |
| splitMode | intervals | field |
| splitSpan | foo | field |
Then the response status code should be 400
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
Then the response body should match string:
"""
Invalid form data: form field 'splitSpan' is invalid (got 'foo', resulting to strconv.Atoi: parsing "foo": invalid syntax)
"""
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 |
| splitMode | pages | field |
| splitSpan | foo | field |
Then the response status code should be 400
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
Then the response body should match string:
"""
The requested split mode is not supported, or no PDF engine could process it. Valid modes: 'intervals', 'pages'.
"""
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| pdfa | foo | field |
Then the response status code should be 400
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
Then the response body should match string:
"""
The requested PDF format is not supported, or no PDF engine could apply it. Valid formats include PDF/A-1b, PDF/A-2b, PDF/A-3b, and PDF/UA.
"""
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| pdfua | foo | field |
Then the response status code should be 400
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
Then the response body should match string:
"""
Invalid form data: form field 'pdfua' is invalid (got 'foo', resulting to strconv.ParseBool: parsing "foo": invalid syntax)
"""
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| metadata | foo | field |
Then the response status code should be 400
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
Then the response body should match string:
"""
Invalid form data: form field 'metadata' is invalid (got 'foo', resulting to unmarshal metadata: invalid character 'o' in literal false (expecting 'a'))
"""
@convert
Scenario: POST /forms/pdfengines/split (PDF/A-1b & PDF/UA-1)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| pdfa | PDF/A-1b | field |
| pdfua | true | field |
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:
| pages_3_0.pdf |
| pages_3_1.pdf |
Then the "pages_3_0.pdf" PDF should have 2 page(s)
Then the "pages_3_1.pdf" PDF should have 1 page(s)
Then the "pages_3_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_3_0.pdf" PDF should have the following content at page 2:
"""
Page 2
"""
Then the "pages_3_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 3 failed rule(s)
@metadata
Scenario: POST /forms/pdfengines/split (Metadata)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | 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 |
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:
| pages_3_0.pdf |
| pages_3_1.pdf |
Then the "pages_3_0.pdf" PDF should have 2 page(s)
Then the "pages_3_1.pdf" PDF should have 1 page(s)
Then the "pages_3_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_3_0.pdf" PDF should have the following content at page 2:
"""
Page 2
"""
Then the "pages_3_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
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/pages_3_0.pdf | file |
| files | teststore/pages_3_1.pdf | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/json"
Then the response body should match JSON:
"""
{
"pages_3_0.pdf": {
"Author": "Julien Neuhart",
"Copyright": "Julien Neuhart",
"CreateDate": "2006:09:18 16:27:50-04:00",
"Creator": "Gotenberg",
"Keywords": ["first", "second"],
"Marked": true,
"ModDate": "2006:09:18 16:27:50-04:00",
"PDFVersion": 1.7,
"Producer": "Gotenberg",
"Subject": "Sample",
"Title": "Sample",
"Trapped": "Unknown"
},
"pages_3_1.pdf": {
"Author": "Julien Neuhart",
"Copyright": "Julien Neuhart",
"CreateDate": "2006:09:18 16:27:50-04:00",
"Creator": "Gotenberg",
"Keywords": ["first", "second"],
"Marked": true,
"ModDate": "2006:09:18 16:27:50-04:00",
"PDFVersion": 1.7,
"Producer": "Gotenberg",
"Subject": "Sample",
"Title": "Sample",
"Trapped": "Unknown"
}
}
"""
@flatten
Scenario: POST /forms/pdfengines/split (Flatten)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| flatten | true | field |
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:
| pages_3_0.pdf |
| pages_3_1.pdf |
Then the "pages_3_0.pdf" PDF should have 2 page(s)
Then the "pages_3_1.pdf" PDF should have 1 page(s)
Then the "pages_3_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_3_0.pdf" PDF should have the following content at page 2:
"""
Page 2
"""
Then the "pages_3_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
Then the response PDF(s) should be flatten
@encrypt
Scenario: POST /forms/pdfengines/split (Encrypt - user password only)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| userPassword | foo | field |
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 the response PDF(s) should be encrypted
@encrypt
Scenario: POST /forms/pdfengines/split (Encrypt - both user and owner passwords)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| userPassword | foo | field |
| ownerPassword | bar | field |
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 the response PDF(s) should be encrypted
@watermark
Scenario: POST /forms/pdfengines/split (Watermark - Text)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| watermarkSource | text | field |
| watermarkExpression | CONFIDENTIAL | field |
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
@stamp
Scenario: POST /forms/pdfengines/split (Stamp - Text)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| stampSource | text | field |
| stampExpression | DRAFT | field |
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
@rotate
Scenario: POST /forms/pdfengines/split (Rotate 90)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| rotateAngle | 90 | field |
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
@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 |
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
# FIXME: once decrypt is done, add encrypt and check after the content of the PDFs.
@convert
@metadata
@watermark
@stamp
@rotate
@flatten
@embed
Scenario: POST /forms/pdfengines/split (PDF/A-3b & PDF/UA-1 & Metadata & Watermark & Stamp & Rotate & Flatten & 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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| pdfa | PDF/A-3b | field |
| 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 |
| watermarkSource | text | field |
| watermarkExpression | CONFIDENTIAL | field |
| stampSource | text | field |
| stampExpression | DRAFT | field |
| rotateAngle | 90 | field |
| flatten | true | field |
| embeds | testdata/embed_1.xml | file |
| embeds | testdata/embed_2.xml | file |
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:
| pages_3_0.pdf |
| pages_3_1.pdf |
Then the "pages_3_0.pdf" PDF should have 2 page(s)
Then the "pages_3_1.pdf" PDF should have 1 page(s)
Then the "pages_3_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_3_0.pdf" PDF should have the following content at page 2:
"""
Page 2
"""
Then the "pages_3_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
Then the response PDF(s) should be valid "PDF/A-3b" with a tolerance of 5 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 3 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
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/pages_3_0.pdf | file |
| files | teststore/pages_3_1.pdf | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/json"
Then the response body should match JSON:
"""
{
"pages_3_0.pdf": {
"Author": "Julien Neuhart",
"Copyright": "Julien Neuhart",
"Creator": "Gotenberg",
"Marked": true,
"PDFVersion": 1.7,
"Producer": "Gotenberg",
"Subject": "Sample",
"Title": "Sample",
"Trapped": "Unknown"
},
"pages_3_1.pdf": {
"Author": "Julien Neuhart",
"Copyright": "Julien Neuhart",
"Creator": "Gotenberg",
"Marked": true,
"PDFVersion": 1.7,
"Producer": "Gotenberg",
"Subject": "Sample",
"Title": "Sample",
"Trapped": "Unknown"
}
}
"""
Scenario: POST /forms/pdfengines/split (Routes Disabled)
Given I have a Gotenberg container with the following environment variable(s):
| PDFENGINES_DISABLE_ROUTES | true |
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
Then the response status code should be 404
Scenario: POST /forms/pdfengines/split (Gotenberg Trace)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| Gotenberg-Trace | forms_pdfengines_split | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/zip"
Then the response header "Gotenberg-Trace" should be "forms_pdfengines_split"
Then the Gotenberg container should log the following entries:
| "correlation_id":"forms_pdfengines_split" |
@output-filename
Scenario: POST /forms/pdfengines/split (Output Filename - Single PDF)
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 |
| splitMode | pages | field |
| splitSpan | 2- | field |
| splitUnify | true | field |
| 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 the following file(s) in the response:
| foo.pdf |
@output-filename
Scenario: POST /forms/pdfengines/split (Output Filename - Many PDFs)
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 |
| 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 the following file(s) in the response:
| foo.zip |
| pages_3_0.pdf |
| pages_3_1.pdf |
@download-from
Scenario: POST /forms/pdfengines/split (Download From)
Given I have a default Gotenberg container
Given I have a static server
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/split" endpoint with the following form data and header(s):
| downloadFrom | [{"url":"http://host.docker.internal:%d/static/testdata/pages_3.pdf","extraHttpHeaders":{"X-Foo":"bar"}}] | field |
| splitMode | intervals | field |
| splitSpan | 2 | field |
Then the response status code should be 200
Then the file request header "X-Foo" should be "bar"
Then the response header "Content-Type" should be "application/zip"
@webhook
Scenario: POST /forms/pdfengines/split (Webhook)
Given I have a default Gotenberg container
Given I have a webhook server
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| Gotenberg-Webhook-Url | http://host.docker.internal:%d/webhook | header |
| Gotenberg-Webhook-Error-Url | http://host.docker.internal:%d/webhook/error | header |
Then the response status code should be 204
When I wait for the asynchronous request to the webhook
Then the webhook request header "Content-Type" should be "application/zip"
Then there should be 2 PDF(s) in the webhook request
Then there should be the following file(s) in the webhook request:
| pages_3_0.pdf |
| pages_3_1.pdf |
Then the "pages_3_0.pdf" PDF should have 2 page(s)
Then the "pages_3_1.pdf" PDF should have 1 page(s)
Then the "pages_3_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_3_0.pdf" PDF should have the following content at page 2:
"""
Page 2
"""
Then the "pages_3_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
Scenario: POST /forms/pdfengines/split (Basic Auth)
Given I have a Gotenberg container with the following environment variable(s):
| API_ENABLE_BASIC_AUTH | true |
| GOTENBERG_API_BASIC_AUTH_USERNAME | foo |
| GOTENBERG_API_BASIC_AUTH_PASSWORD | bar |
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
Then the response status code should be 401
Scenario: POST /foo/forms/pdfengines/split (Root Path)
Given I have a Gotenberg container with the following environment variable(s):
| API_ENABLE_DEBUG_ROUTE | true |
| API_ROOT_PATH | /foo/ |
When I make a "POST" request to Gotenberg at the "/foo/forms/pdfengines/split" endpoint with the following form data and header(s):
| files | testdata/pages_3.pdf | file |
| splitMode | intervals | field |
| splitSpan | 2 | field |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/zip"
@convert
@encrypt
Scenario: POST /forms/pdfengines/split (PDF/A + Encrypt => 400)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| pdfa | PDF/A-1b | field |
| userPassword | secret | field |
Then the response status code should be 400
@convert
@embed
Scenario: POST /forms/pdfengines/split (PDF/A-1b + Embeds => 400)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| pdfa | PDF/A-1b | field |
| embeds | testdata/embed_1.xml | file |
Then the response status code should be 400
@convert
@embed
Scenario: POST /forms/pdfengines/split (PDF/A-3b + Embeds => 200)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| pdfa | PDF/A-3b | field |
| embeds | testdata/embed_1.xml | file |
Then the response status code should be 200
Scenario: POST /forms/pdfengines/split (stampSource=pdf without uploaded stamp file => 400)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| stampSource | pdf | field |
| stampExpression | /etc/hostname | field |
Then the response status code should be 400
Then the response body should match string:
"""
Invalid form data: a stamp file is required for image or pdf source
"""
Scenario: POST /forms/pdfengines/split (watermarkSource=pdf without uploaded watermark file => 400)
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 |
| splitMode | intervals | field |
| splitSpan | 2 | field |
| watermarkSource | pdf | field |
| watermarkExpression | /etc/hostname | field |
Then the response status code should be 400
Then the response body should match string:
"""
Invalid form data: a watermark file is required for image or pdf source
"""
# See: https://github.com/gotenberg/gotenberg/issues/1500.
Scenario: POST /forms/pdfengines/split (Long Filename)
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/Longitudinell_jämförelse_mellan_laserkirurgi_och_strålbehandling_gällande_röstkvalitet_och_självskattad_kommunikation_upp_till_två_år_efter_tidig_stämbandscancer_i_ett_randomiserat_kontrollerat_försök.pdf | file |
| splitMode | pages | field |
| splitSpan | 1 | field |
| splitUnify | true | field |
| 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