Files
gotenberg/test/integration/features/libreoffice_convert.feature

1518 lines
91 KiB
Gherkin

@libreoffice
@libreoffice-convert
Feature: /forms/libreoffice/convert
Scenario: POST /forms/libreoffice/convert (Single Document)
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 |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then the response header "Gotenberg-Version" should be "{version}"
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| foo.pdf |
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
# LibreOffice detects OOXML PowerPoint shows from content and converts them
# like .pptx; only Gotenberg's extension allow list gated them out.
# See https://github.com/gotenberg/gotenberg/pull/1626.
Scenario: POST /forms/libreoffice/convert (PowerPoint Show .ppsx)
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/slideshow.ppsx | 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 response:
| foo.pdf |
Then the "foo.pdf" PDF should have 1 page(s)
Scenario: POST /forms/libreoffice/convert (PowerPoint Show .ppsm)
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/slideshow.ppsm | 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 response:
| foo.pdf |
Then the "foo.pdf" PDF should have 1 page(s)
# A CSV becomes a single Calc sheet named after the input file, and Calc's
# default page style prints that sheet name as a centered header. Uploads are
# stored under a UUID-based filename, so the UUID must not leak into the PDF.
# See https://github.com/gotenberg/gotenberg/issues/1568.
Scenario: POST /forms/libreoffice/convert (CSV Without Sheet Name Header)
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/sheet.csv | 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 the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Alice
"""
Then the "foo.pdf" PDF should NOT have content matching "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" at page 1
Scenario: POST /forms/libreoffice/convert (Tracked Changes Accepted By Default)
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/tracked_changes.docx | 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 the "foo.pdf" PDF should have the following content at page 1:
"""
Inserted text.
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
Deleted text.
"""
Scenario: POST /forms/libreoffice/convert (Show Tracked Changes)
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/tracked_changes.docx | file |
| showTrackedChanges | 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
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Deleted text.
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Inserted text.
"""
Scenario: POST /forms/libreoffice/convert (Missing Fonts)
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/missing_font.docx | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then the Gotenberg container should log the following entries:
| LibreOffice drew these fonts with other fonts, as they are not installed: Gotenberg Missing Font |
| "filename":"missing_font.docx" |
Scenario: POST /forms/libreoffice/convert (Fail On Missing Fonts)
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/missing_font.docx | file |
| failOnMissingFonts | true | field |
Then the response status code should be 409
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
Then the response body should match string:
"""
The document 'missing_font.docx' uses fonts that are not installed: Gotenberg Missing Font. Install them on the server, or remove the 'failOnMissingFonts' form field to convert with replacement fonts.
"""
Scenario: POST /forms/libreoffice/convert (Fail On Missing Fonts, Fonts Installed)
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 |
| failOnMissingFonts | true | field |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Scenario: POST /forms/libreoffice/convert (Many Documents)
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 |
| files | testdata/page_2.docx | file |
| 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 |
| page_1.docx.pdf |
| page_2.docx.pdf |
Then the "page_1.docx.pdf" PDF should have 1 page(s)
Then the "page_2.docx.pdf" PDF should have 1 page(s)
Then the "page_1.docx.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "page_2.docx.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
# See:
# https://github.com/gotenberg/gotenberg/issues/104
# https://github.com/gotenberg/gotenberg/issues/730
Scenario: POST /forms/libreoffice/convert (Non-basic Latin Characters)
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/Special_Chars_ß.docx | 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 response:
| foo.pdf |
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Scenario: POST /forms/libreoffice/convert (Protected)
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/protected_page_1.docx | file |
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 document 'protected_page_1.docx' is password-protected. Provide its password in the 'password' form field.
"""
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/protected_page_1.docx | file |
| password | foo | 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
Scenario: POST /forms/libreoffice/convert (Landscape)
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 |
| Gotenberg-Output-Filename | foo | header |
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| foo.pdf |
Then the "foo.pdf" PDF should NOT be set to landscape orientation
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 |
| landscape | true | field |
| Gotenberg-Output-Filename | foo | header |
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| foo.pdf |
Then the "foo.pdf" PDF should be set to landscape orientation
Scenario: POST /forms/libreoffice/convert (Tagged PDF)
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 |
| Gotenberg-Output-Filename | foo | header |
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| foo.pdf |
Then the "foo.pdf" PDF should NOT be tagged
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 |
| nativeTaggedPdf | true | field |
| Gotenberg-Output-Filename | foo | header |
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| foo.pdf |
Then the "foo.pdf" PDF should be tagged
# LibreOffice writes no /PageLayout for the default, and no /TwoColumnLeft.
Scenario Outline: POST /forms/libreoffice/convert (Page Layout <pageLayout>)
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 |
| pageLayout | <pageLayout> | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF <should> have the page layout "<layout>"
Examples:
| pageLayout | should | layout |
| default | should NOT | SinglePage |
| singlePage | should | SinglePage |
| oneColumn | should | OneColumn |
| twoColumnRight | should | TwoColumnRight |
Scenario: POST /forms/libreoffice/convert (Native Page Ranges - Single Document)
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/pages_3.docx | file |
| nativePages | 2-3 | 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
Then there should be the following file(s) in the response:
| foo.pdf |
Then the "foo.pdf" PDF should have 2 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
Page 3
"""
Scenario: POST /forms/libreoffice/convert (Native Page Ranges - Many Documents)
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/pages_3.docx | file |
| files | testdata/pages_12.docx | file |
| nativePages | 2-3 | 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 |
| pages_3.docx.pdf |
| pages_12.docx.pdf |
Then the "pages_3.docx.pdf" PDF should have 2 page(s)
Then the "pages_12.docx.pdf" PDF should have 2 page(s)
Then the "pages_3.docx.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
Then the "pages_3.docx.pdf" PDF should have the following content at page 2:
"""
Page 3
"""
Then the "pages_12.docx.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
Then the "pages_12.docx.pdf" PDF should have the following content at page 2:
"""
Page 3
"""
# A document that sets no page size, such as a CSV, falls back to the image's
# paper size, A4, and not to the Letter of LibreOfficeKit's en-US locale.
# See https://github.com/gotenberg/gotenberg/issues/1723.
Scenario: POST /forms/libreoffice/convert (Paper Size)
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/sheet.csv | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF first page should be 595.3x841.9 points
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 |
| paperSize | A4 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF first page should be 595.3x841.9 points
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 |
| paperSize | A5 | field |
| landscape | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF first page should be 595.3x419.5 points
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 |
| paperWidth | 4in | field |
| paperHeight | 6in | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF first page should be 288x432 points
# The locale formats Excel's locale-dependent formats, here a short date, a
# system long date, a number and a currency, and picks the fallback paper
# size. A conversion without one follows the system locale, whatever an
# earlier conversion set: LibreOfficeKit keeps the language of a load.
# See https://github.com/gotenberg/gotenberg/issues/1737.
Scenario: POST /forms/libreoffice/convert (Locale)
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/locale.xlsx | file |
| locale | de-DE | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF first page should be 595.3x841.9 points
Then the "foo.pdf" PDF should have the following content at page 1:
"""
08.01.2026
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Donnerstag, 8. Januar 2026
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
1.234.567,89 €
"""
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/locale.xlsx | file |
| locale | en-US | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF first page should be 612x792 points
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/locale.xlsx | file |
| locale | de-DE | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/locale.xlsx | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF first page should be 595.3x841.9 points
Then the "foo.pdf" PDF should have the following content at page 1:
"""
1/8/2026
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Thursday, January 8, 2026
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
$1,234,567.89
"""
# A field the route does not read answers 400, and a Gotenberg 8 one says what
# replaced it, a file field included.
Scenario: POST /forms/libreoffice/convert (Unknown Form Fields)
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 |
| landscpae | true | field |
| pdfa | PDF/A-1a | field |
| merge | true | field |
| imageQuality | 50 | 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 'imageQuality' is unknown to this route; Gotenberg 9 lowers image quality at export: use 'nativeQuality' or 'nativeReduceImageResolution'; {"op":"optimize"} is lossless
form field 'landscpae' is unknown to this route
form field 'merge' is unknown to this route; Gotenberg 9 moved it to a stage: add {"op":"merge"} to 'stages'
form field 'pdfa' is unknown to this route; Gotenberg 9 renamed it 'nativePdfa', which takes PDF/A-1b, PDF/A-2b, PDF/A-3b or PDF/A-4, or add {"op":"remediate","profile":"PDF/A-1a"} to 'stages'
form file field 'embeds' is unknown to this route; Gotenberg 9 reads every file from 'files': upload it there, and add {"op":"attach","file":"data.xml"} to 'stages'
"""
Scenario: POST /forms/libreoffice/convert (Bad Request)
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):
| locale | en_AU | field |
| landscape | foo | field |
| exportFormFields | foo | field |
| allowDuplicateFieldNames | foo | field |
| nativeBookmarks | foo | field |
| exportBookmarksToPdfDestination | foo | field |
| exportPlaceholders | foo | field |
| exportNotes | foo | field |
| exportNotesPages | foo | field |
| exportOnlyNotesPages | foo | field |
| exportNotesInMargin | foo | field |
| showTrackedChanges | foo | field |
| failOnMissingFonts | foo | field |
| convertOooTargetToPdfTarget | foo | field |
| exportLinksRelativeFsys | foo | field |
| exportHiddenSlides | foo | field |
| skipEmptyPages | foo | field |
| addOriginalDocumentAsStream | foo | field |
| singlePage | foo | field |
| nativeTaggedPdf | foo | field |
| initialView | foo | field |
| initialPage | -1 | field |
| magnification | foo | field |
| zoom | -1 | field |
| pageLayout | foo | field |
| resizeWindowToInitialPage | foo | field |
| centerWindow | foo | field |
| openInFullScreenMode | foo | field |
| displayPDFDocumentTitle | foo | field |
| hideViewerMenubar | foo | field |
| hideViewerToolbar | foo | field |
| hideViewerWindowControls | foo | field |
| useTransitionEffects | foo | field |
| openBookmarkLevels | 15 | field |
| nativeLosslessImageCompression | foo | field |
| nativeQuality | -1 | field |
| nativeReduceImageResolution | foo | field |
| nativeMaxImageResolution | 10 | 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 header "Gotenberg-Version" should be "{version}"
Then the response body should match string:
"""
Invalid form data: no form file found for extensions: [.123 .602 .abw .bib .bmp .cdr .cgm .cmx .csv .cwk .dbf .dif .doc .docm .docx .dot .dotm .dotx .dxf .emf .eps .fodg .fodp .fods .fodt .fopd .gif .htm .html .hwp .jpeg .jpg .key .ltx .lwp .mcw .met .mml .mw .numbers .odd .odg .odm .odp .ods .odt .otg .oth .otp .ots .ott .pages .pbm .pcd .pct .pcx .pdb .pdf .pgm .png .pot .potm .potx .ppm .pps .ppsm .ppsx .ppt .pptm .pptx .psd .psw .pub .pwp .pxl .ras .rtf .sda .sdc .sdd .sdp .sdw .sgl .slk .smf .stc .std .sti .stw .svg .svm .swf .sxc .sxd .sxg .sxi .sxm .sxw .tga .tif .tiff .txt .uof .uop .uos .uot .vdx .vor .vsd .vsdm .vsdx .wb2 .wk1 .wks .wmf .wpd .wpg .wps .xbm .xhtml .xls .xlsb .xlsm .xlsx .xlt .xltm .xltx .xlw .xml .xpm .zabw]
form field 'locale' is invalid (got 'en_AU', want a BCP 47 language tag, such as en-AU or de-DE)
form field 'landscape' is invalid (got 'foo', want true or false)
form field 'exportFormFields' is invalid (got 'foo', want true or false)
form field 'allowDuplicateFieldNames' is invalid (got 'foo', want true or false)
form field 'nativeBookmarks' is invalid (got 'foo', want true or false)
form field 'exportBookmarksToPdfDestination' is invalid (got 'foo', want true or false)
form field 'exportPlaceholders' is invalid (got 'foo', want true or false)
form field 'exportNotes' is invalid (got 'foo', want true or false)
form field 'exportNotesPages' is invalid (got 'foo', want true or false)
form field 'exportOnlyNotesPages' is invalid (got 'foo', want true or false)
form field 'exportNotesInMargin' is invalid (got 'foo', want true or false)
form field 'showTrackedChanges' is invalid (got 'foo', want true or false)
form field 'failOnMissingFonts' is invalid (got 'foo', want true or false)
form field 'convertOooTargetToPdfTarget' is invalid (got 'foo', want true or false)
form field 'exportLinksRelativeFsys' is invalid (got 'foo', want true or false)
form field 'exportHiddenSlides' is invalid (got 'foo', want true or false)
form field 'skipEmptyPages' is invalid (got 'foo', want true or false)
form field 'addOriginalDocumentAsStream' is invalid (got 'foo', want true or false)
form field 'singlePage' is invalid (got 'foo', want true or false)
form field 'nativeTaggedPdf' is invalid (got 'foo', want true or false)
form field 'initialView' is invalid (got 'foo', want default, outline or thumbnails)
form field 'initialPage' is invalid (got '-1', want 1 or more)
form field 'magnification' is invalid (got 'foo', want default, fitWindow, fitWidth, fitVisible or zoom)
form field 'zoom' is invalid (got '-1', want 1 or more)
form field 'pageLayout' is invalid (got 'foo', want default, singlePage, oneColumn or twoColumnRight)
form field 'resizeWindowToInitialPage' is invalid (got 'foo', want true or false)
form field 'centerWindow' is invalid (got 'foo', want true or false)
form field 'openInFullScreenMode' is invalid (got 'foo', want true or false)
form field 'displayPDFDocumentTitle' is invalid (got 'foo', want true or false)
form field 'hideViewerMenubar' is invalid (got 'foo', want true or false)
form field 'hideViewerToolbar' is invalid (got 'foo', want true or false)
form field 'hideViewerWindowControls' is invalid (got 'foo', want true or false)
form field 'useTransitionEffects' is invalid (got 'foo', want true or false)
form field 'openBookmarkLevels' is invalid (got '15', want -1, or 1 to 10)
form field 'nativeLosslessImageCompression' is invalid (got 'foo', want true or false)
form field 'nativeQuality' is invalid (got '-1', want 1 or more)
form field 'nativeReduceImageResolution' is invalid (got 'foo', want true or false)
form field 'nativeMaxImageResolution' is invalid (got '10', want 75, 150, 300, 600 or 1200)
"""
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 |
| nativePages | 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:
"""
LibreOffice could not apply the pages 'foo' to the document 'page_1.docx'. Check the 'nativePages' form field; valid values look like '1-4', '2' or '1,3,5-7'.
"""
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/protected_page_1.docx | file |
| password | bar | 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 password for the document 'protected_page_1.docx' is incorrect. Check the 'password' form field.
"""
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 |
| nativePdfa | 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 'nativePdfa' is invalid (got 'foo', want PDF/A-1b, PDF/A-2b, PDF/A-3b or PDF/A-4).
"""
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 |
| nativePdfua | 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 'nativePdfua' is invalid (got 'foo', want PDF/UA-1; for PDF/UA-2, add a remediate stage)
"""
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 |
| pageLayout | twoColumnLeft | 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 'pageLayout' is invalid (got 'twoColumnLeft', want default, singlePage, oneColumn or twoColumnRight)
"""
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 |
| paperWidth | 8in | 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: set 'paperSize', or both 'paperWidth' and 'paperHeight'
"""
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 |
| paperSize | A7 | 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 'paperSize' is invalid (got 'A7', want A0, A1, A2, A3, A4, A5, B4, B5, Letter, Legal or Tabloid)
"""
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 |
| stages | 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 'stages' is invalid: stages must be a JSON array of objects: invalid character 'o' in literal false (expecting 'a')
"""
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 |
| stages | [{"op":"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 'stages' is invalid: stage 0: unknown operation "foo"; the operations are attach, autotag, clear-metadata, compose, convert-colors, decrypt, delete, detach, encrypt, extract-attachments, extract-text, flatten-form, flatten-transparency, insert, merge, optimize, redact, remediate, render, rotate, select, set-bookmarks, set-form, set-metadata, sign, split, stamp-image, stamp-pdf, stamp-text, timestamp
"""
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/pages_3.docx | file |
| stages | [{"op":"split"}] | 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 'stages' is invalid: stage 0: split: set "every" or "ranges"
"""
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 |
| stages | [{"op":"set-metadata","Title":"Sample"}] | 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 'stages' is invalid: stage 0: set-metadata: unknown option "Title"
"""
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 |
| stages | [{"op":"stamp-image","image":"missing.png"}] | 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 file 'missing.png' is required
"""
# lok ignores a password given for a document that has none.
Scenario: POST /forms/libreoffice/convert (Password On Unprotected Document)
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 |
| password | foo | 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
# Markdown reads its headings, lists and tables from the structure tree:
# Gotenberg exports a tagged PDF for it, nativeTaggedPdf left unset.
@pdf-extract-text
Scenario: POST /forms/libreoffice/convert (Markdown)
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 |
| stages | [{"op":"extract-text","format":"markdown"}] | field |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/zip"
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| page_1.docx.pdf |
| page_1.docx.md |
Then the "page_1.docx.pdf" PDF should be tagged
Then the "page_1.docx.md" file should match string:
"""
Page 1
"""
@pdf-merge
Scenario: POST /forms/libreoffice/convert (Merge)
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 |
| files | testdata/page_2.docx | file |
| stages | [{"op":"merge"}] | 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
Then there should be the following file(s) in the response:
| foo.pdf |
Then the "foo.pdf" PDF should have 2 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
Page 2
"""
@pdf-merge
@pdf-split
Scenario: POST /forms/libreoffice/convert (Merge & Split)
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 |
| files | testdata/page_2.docx | file |
| stages | [{"op":"merge"},{"op":"split","every":1}] | 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:
| page_1.docx_0.pdf |
| page_1.docx_1.pdf |
Then the "page_1.docx_0.pdf" PDF should have 1 page(s)
Then the "page_1.docx_1.pdf" PDF should have 1 page(s)
Then the "page_1.docx_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "page_1.docx_1.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
@pdf-split
Scenario: POST /forms/libreoffice/convert (Split Every)
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/pages_3.docx | file |
| stages | [{"op":"split","every":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.docx_0.pdf |
| pages_3.docx_1.pdf |
Then the "pages_3.docx_0.pdf" PDF should have 2 page(s)
Then the "pages_3.docx_1.pdf" PDF should have 1 page(s)
Then the "pages_3.docx_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_3.docx_0.pdf" PDF should have the following content at page 2:
"""
Page 2
"""
Then the "pages_3.docx_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
@pdf-split
Scenario: POST /forms/libreoffice/convert (Split Ranges)
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/pages_3.docx | file |
| stages | [{"op":"split","ranges":["2","3"]}] | 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.docx_0.pdf |
| pages_3.docx_1.pdf |
Then the "pages_3.docx_0.pdf" PDF should have 1 page(s)
Then the "pages_3.docx_1.pdf" PDF should have 1 page(s)
Then the "pages_3.docx_0.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
Then the "pages_3.docx_1.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
@pdf-pages
Scenario: POST /forms/libreoffice/convert (Select)
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/pages_3.docx | file |
| stages | [{"op":"select","pages":"2-3"}] | 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.docx.pdf |
Then the "pages_3.docx.pdf" PDF should have 2 page(s)
Then the "pages_3.docx.pdf" PDF should have the following content at page 1:
"""
Page 2
"""
Then the "pages_3.docx.pdf" PDF should have the following content at page 2:
"""
Page 3
"""
@pdf-split
Scenario: POST /forms/libreoffice/convert (Split Many PDFs - Lot of Pages)
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/pages_12.docx | file |
| files | testdata/pages_3.docx | file |
| stages | [{"op":"split","every":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.docx_0.pdf |
| pages_3.docx_1.pdf |
| pages_3.docx_2.pdf |
| pages_12.docx_0.pdf |
| pages_12.docx_1.pdf |
| pages_12.docx_2.pdf |
| pages_12.docx_3.pdf |
| pages_12.docx_4.pdf |
| pages_12.docx_5.pdf |
| pages_12.docx_6.pdf |
| pages_12.docx_7.pdf |
| pages_12.docx_8.pdf |
| pages_12.docx_9.pdf |
| pages_12.docx_10.pdf |
| pages_12.docx_11.pdf |
Then the "pages_3.docx_0.pdf" PDF should have 1 page(s)
Then the "pages_3.docx_2.pdf" PDF should have 1 page(s)
Then the "pages_12.docx_0.pdf" PDF should have 1 page(s)
Then the "pages_12.docx_11.pdf" PDF should have 1 page(s)
Then the "pages_3.docx_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_3.docx_2.pdf" PDF should have the following content at page 1:
"""
Page 3
"""
Then the "pages_12.docx_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_12.docx_11.pdf" PDF should have the following content at page 1:
"""
Page 12
"""
Scenario: POST /forms/libreoffice/convert (Native PDF/A-1b & PDF/UA-1)
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 |
| nativePdfa | PDF/A-1b | field |
| nativePdfua | PDF/UA-1 | 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 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)
Scenario: POST /forms/libreoffice/convert (Native PDF/A-4)
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 |
| nativePdfa | PDF/A-4 | 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 the response PDF(s) should be valid "PDF/A-4" with a tolerance of 0 failed rule(s)
@pdf-remediate
Scenario: POST /forms/libreoffice/convert (Remediate PDF/A-2b & PDF/UA-1)
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 |
| stages | [{"op":"remediate","profile":["PDF/A-2b","PDF/UA-1"]}] | field |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then the response header "Gotenberg-Remediation-Residual" should be "0"
Then the response PDF(s) should be valid "PDF/A-2b" with a tolerance of 0 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-1" with a tolerance of 0 failed rule(s)
# LibreOffice exports PDF/A-4 with PDF/UA as a PDF/UA-2 file that fails
# PDF/UA-2: the remediate stage pairs them.
@pdf-remediate
Scenario: POST /forms/libreoffice/convert (Native PDF/A-4 & PDF/UA)
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 |
| nativePdfa | PDF/A-4 | field |
| nativePdfua | PDF/UA-1 | 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 'nativePdfa' PDF/A-4 cannot be combined with 'nativePdfua': LibreOffice then claims PDF/UA-2 without meeting it; remove both and add {"op":"remediate","profile":["PDF/A-4","PDF/UA-2"]} to 'stages'
"""
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 |
| stages | [{"op":"remediate","profile":["PDF/A-4","PDF/UA-2"]}] | field |
Then the response status code should be 200
Then the response header "Gotenberg-Remediation-Residual" should be "0"
Then the response PDF(s) should be valid "PDF/A-4" with a tolerance of 0 failed rule(s)
Then the response PDF(s) should be valid "PDF/UA-2" with a tolerance of 0 failed rule(s)
# Merging builds a new document, which loses the conformance of each one:
# remediate the merged document instead.
@pdf-merge
@pdf-remediate
Scenario: POST /forms/libreoffice/convert (Merge & Remediate PDF/A-1b)
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 |
| files | testdata/page_2.docx | file |
| stages | [{"op":"merge"},{"op":"remediate","profile":"PDF/A-1b"}] | 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 the response PDF(s) should be valid "PDF/A-1b" with a tolerance of 0 failed rule(s)
# Stages after a split run on every part.
@pdf-split
@pdf-remediate
Scenario: POST /forms/libreoffice/convert (Split & Remediate PDF/A-1b)
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/pages_3.docx | file |
| stages | [{"op":"split","every":2},{"op":"remediate","profile":"PDF/A-1b"}] | 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.docx_0.pdf |
| pages_3.docx_1.pdf |
Then the "pages_3.docx_0.pdf" PDF should have 2 page(s)
Then the "pages_3.docx_1.pdf" PDF should have 1 page(s)
Then the "pages_3.docx_0.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Then the "pages_3.docx_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 0 failed rule(s)
@pdf-metadata
Scenario: POST /forms/libreoffice/convert (Metadata)
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 |
| stages | [{"op":"set-metadata","title":"Sample","author":"Julien Neuhart","subject":"Sample","keywords":"first, second","creator":"Gotenberg","producer":"Gotenberg"}] | 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
Then there should be the following file(s) in the response:
| foo.pdf |
Then the "foo.pdf" PDF should have the "Title" metadata set to "Sample"
Then the "foo.pdf" PDF should have the "Author" metadata set to "Julien Neuhart"
Then the "foo.pdf" PDF should have the "Subject" metadata set to "Sample"
Then the "foo.pdf" PDF should have the "Keywords" metadata set to "first, second"
Then the "foo.pdf" PDF should have the "Creator" metadata set to "Gotenberg"
Then the "foo.pdf" PDF should have the "Producer" metadata set to "Gotenberg"
@pdf-form
Scenario: POST /forms/libreoffice/convert (Flatten Form)
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 |
| stages | [{"op":"flatten-form"}] | 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 the response PDF(s) should be flatten
@pdf-encrypt
Scenario: POST /forms/libreoffice/convert (Encrypt - user password only)
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 |
| stages | [{"op":"encrypt","userPassword":"foo"}] | 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 the response PDF(s) should be encrypted
@pdf-encrypt
Scenario: POST /forms/libreoffice/convert (Encrypt - both user and owner passwords)
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 |
| stages | [{"op":"encrypt","userPassword":"foo","ownerPassword":"bar"}] | 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 the response PDF(s) should be encrypted
@pdf-stamp
Scenario: POST /forms/libreoffice/convert (Stamp Text)
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 |
| stages | [{"op":"stamp-text","text":"DRAFT","opacity":0.5}] | 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
@pdf-rotate
Scenario: POST /forms/libreoffice/convert (Rotate 90)
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 |
| stages | [{"op":"rotate","angle":90}] | 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
Then the "foo.pdf" PDF page 1 should be rotated by 90 degrees
Scenario: POST /forms/libreoffice/convert (Native Watermark - Text)
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 |
| nativeWatermarkText | CONFIDENTIAL | 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
Then the "foo.pdf" PDF should have the following content at page 1:
"""
CONFIDENTIAL
"""
Scenario: POST /forms/libreoffice/convert (Native Watermark - Text with Options)
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 |
| nativeWatermarkText | DRAFT | field |
| nativeWatermarkColor | #ff0000 | field |
| nativeWatermarkFontSize | 48 | field |
| nativeWatermarkRotation | 45 | field |
| nativeWatermarkFont | Courier | 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
Scenario: POST /forms/libreoffice/convert (Native Watermark - Tiled)
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 |
| nativeTiledWatermarkText | CONFIDENTIAL | 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
# 0 draws the watermark horizontally, rather than leaving the angle to
# LibreOffice, which runs it down a portrait page.
Scenario: POST /forms/libreoffice/convert (Native Watermark - Rotation 0)
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 |
| nativeWatermarkText | DRAFT | field |
| nativeWatermarkRotation | 0 | 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
Then the "foo.pdf" PDF should have the following content at page 1:
"""
DRAFT
"""
Then the "foo.pdf" PDF text "DRAFT" at page 1 should run at 0 degrees
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 |
| nativeWatermarkText | DRAFT | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF text "DRAFT" at page 1 should run at -90 degrees
# LibreOffice draws the tiled watermark only without the plain one.
Scenario: POST /forms/libreoffice/convert (Native Watermark - Plain And Tiled)
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 |
| nativeWatermarkText | DRAFT | field |
| nativeTiledWatermarkText | CONFIDENTIAL | 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: set 'nativeWatermarkText' or 'nativeTiledWatermarkText', not both
"""
# Files a stage reads are uploaded like the documents, and are not converted.
@pdf-attach
Scenario: POST /forms/libreoffice/convert (Attach)
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 |
| files | testdata/embed_1.xml | file |
| files | testdata/embed_2.xml | file |
| stages | [{"op":"attach","file":"embed_1.xml"},{"op":"attach","file":"embed_2.xml"}] | 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
Then there should be the following file(s) in the response:
| 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
# The Factur-X remediation turns the document into PDF/A-3 and embeds the
# invoice XML as factur-x.xml, with the Alternative relationship.
@pdf-remediate
@factur-x
Scenario: POST /forms/libreoffice/convert (Factur-X / ZUGFeRD)
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 |
| files | testdata/invoice-en16931.xml | file |
| stages | [{"op":"remediate","profile":"Factur-X","xml":"invoice-en16931.xml","level":"EN 16931"}] | 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
Then the response PDF(s) should be valid "PDF/A-3b" with a tolerance of 0 failed rule(s)
Then the response PDF(s) should have the "factur-x.xml" file embedded with relationship "Alternative"
Then the response PDF(s) should declare Factur-X XMP with conformance level "EN 16931"
# The base PDF is already PDF/A-3b.
@pdf-remediate
@factur-x
Scenario: POST /forms/pdf/remediate (Factur-X, already PDF/A-3)
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 |
| nativePdfa | PDF/A-3b | field |
| Gotenberg-Output-Filename | base | header |
Then the response status code should be 200
When I make a "POST" request to Gotenberg at the "/forms/pdf/remediate" endpoint with the following form data and header(s):
| files | teststore/base.pdf | file |
| files | testdata/invoice-basic.xml | file |
| profile | Factur-X | field |
| xml | invoice-basic.xml | field |
| level | BASIC | field |
| documentType | ORDER | 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
Then the response PDF(s) should be valid "PDF/A-3b" with a tolerance of 0 failed rule(s)
Then the response PDF(s) should have the "factur-x.xml" file embedded with relationship "Alternative"
Then the response PDF(s) should declare Factur-X XMP with conformance level "BASIC"
# The base PDF is not PDF/A: the remediation converts it to PDF/A-3b.
@pdf-remediate
@factur-x
Scenario: POST /forms/pdf/remediate (Factur-X, converts non-PDF/A input)
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 |
| Gotenberg-Output-Filename | plain | header |
Then the response status code should be 200
When I make a "POST" request to Gotenberg at the "/forms/pdf/remediate" endpoint with the following form data and header(s):
| files | teststore/plain.pdf | file |
| files | testdata/invoice-en16931.xml | file |
| profile | Factur-X | field |
| xml | invoice-en16931.xml | field |
| level | EN 16931 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response PDF(s) should be valid "PDF/A-3b" with a tolerance of 0 failed rule(s)
Then the response PDF(s) should have the "factur-x.xml" file embedded with relationship "Alternative"
Then the response PDF(s) should declare Factur-X XMP with conformance level "EN 16931"
@pdf-remediate
@factur-x
Scenario: POST /forms/pdf/remediate (Factur-X XRECHNUNG)
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 |
| nativePdfa | PDF/A-3b | field |
| Gotenberg-Output-Filename | base | header |
Then the response status code should be 200
When I make a "POST" request to Gotenberg at the "/forms/pdf/remediate" endpoint with the following form data and header(s):
| files | teststore/base.pdf | file |
| files | testdata/invoice-xrechnung.xml | file |
| profile | Factur-X | field |
| xml | invoice-xrechnung.xml | field |
| level | XRECHNUNG | 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
Then the response PDF(s) should be valid "PDF/A-3b" with a tolerance of 0 failed rule(s)
Then the response PDF(s) should have the "xrechnung.xml" file embedded with relationship "Alternative"
Then the response PDF(s) should NOT have the "factur-x.xml" file embedded
Then the response PDF(s) should declare Factur-X XMP with conformance level "XRECHNUNG"
@pdf-render
Scenario: POST /forms/libreoffice/convert (Render)
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 |
| stages | [{"op":"render","format":"jpeg"}] | field |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/zip"
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| page_1.docx.pdf |
| page_1.docx_1.jpeg |
# A Factur-X level without the invoice XML is a half-specified request:
# without the XML, the remediation repairs an existing invoice instead.
@pdf-remediate
@factur-x
Scenario: POST /forms/pdf/remediate (Factur-X Bad Request)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/remediate" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| profile | Factur-X | field |
| level | EN 16931 | 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: remediate: "level" and "documentType" need "xml", the uploaded Factur-X invoice XML to embed; without "xml", the remediation repairs the invoice the PDF already carries
"""
# Edits run in order on the native PDF/A-3b document, and the remediation
# comes last, so the output stays PDF/A-3b.
@pdf-metadata
@pdf-stamp
@pdf-rotate
@pdf-form
@pdf-attach
@pdf-remediate
Scenario: POST /forms/libreoffice/convert (Native PDF/A-3b & Metadata & Stamps & Rotate & Flatten & Attach & Remediate)
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 |
| files | testdata/embed_1.xml | file |
| files | testdata/embed_2.xml | file |
| nativePdfa | PDF/A-3b | field |
| stages | [{"op":"set-metadata","title":"Sample","author":"Julien Neuhart","subject":"Sample","creator":"Gotenberg","producer":"Gotenberg"},{"op":"stamp-text","text":"CONFIDENTIAL","opacity":0.3},{"op":"stamp-text","text":"DRAFT","y":50},{"op":"rotate","angle":90},{"op":"flatten-form"},{"op":"attach","file":"embed_1.xml","relationship":"Data"},{"op":"attach","file":"embed_2.xml","relationship":"Data"},{"op":"remediate","profile":"PDF/A-3b"}] | 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
Then there should be the following file(s) in the response:
| foo.pdf |
Then the response PDF(s) should be valid "PDF/A-3b" with a tolerance of 0 failed rule(s)
Then the response PDF(s) should be flatten
Then the response PDF(s) should have the "embed_1.xml" file embedded with relationship "Data"
Then the response PDF(s) should have the "embed_2.xml" file embedded with relationship "Data"
Then the "foo.pdf" PDF page 1 should be rotated by 90 degrees
Then the "foo.pdf" PDF should have the "Title" metadata set to "Sample"
Then the "foo.pdf" PDF should have the "Author" metadata set to "Julien Neuhart"
Scenario: POST /forms/libreoffice/convert (Routes Disabled)
Given I have a Gotenberg container with the following environment variable(s):
| LIBREOFFICE_DISABLE_ROUTES | true |
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 |
Then the response status code should be 404
Scenario: POST /forms/libreoffice/convert (Enable Macros)
Given I have a Gotenberg container with the following environment variable(s):
| LIBREOFFICE_ENABLE_MACROS | true |
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 |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then the Gotenberg container should log the following entries:
| --libreoffice-enable-macros (LIBREOFFICE_ENABLE_MACROS) runs the macros of every converted document |
Scenario: POST /forms/libreoffice/convert (Gotenberg Trace)
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 |
| Gotenberg-Trace | forms_libreoffice_convert | 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_libreoffice_convert"
Then the Gotenberg container should log the following entries:
| "correlation_id":"forms_libreoffice_convert" |
@download-from
Scenario: POST /forms/libreoffice/convert (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/libreoffice/convert" endpoint with the following form data and header(s):
| downloadFrom | [{"url":"{helper}/static/testdata/page_1.docx","extraHttpHeaders":{"X-Foo":"bar"}}] | 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/pdf"
# A name that leaves Gotenberg is one file name on every system: a drive
# prefix or a Windows device name never reaches the extractor as such.
@download-from
Scenario: POST /forms/libreoffice/convert (Download From With Hostile Filenames)
Given I have a default Gotenberg container
Given I have a static server
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| downloadFrom | [{"url":"{helper}/static/testdata/page_1.docx","filename":"C:evil.docx"},{"url":"{helper}/static/testdata/page_2.docx","filename":"CON.docx"}] | field |
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:
| C_evil.docx.pdf |
| _CON.docx.pdf |
# The outbound filter refuses a download URL the deny-list names, even when
# the allow-list matches every URL. A refusal stays generic for the client.
@download-from
Scenario: POST /forms/libreoffice/convert (Download From In The Deny-List)
Given I have a static server
Given I have a Gotenberg container with the following environment variable(s):
| API_DOWNLOAD_FROM_DENY_LIST | ^{helper}/canary/ |
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| downloadFrom | [{"url":"{helper}/canary/page_1.docx"}] | field |
Then the response status code should be 403
Then the response body should match string:
"""
Forbidden
"""
Then the helper server should NOT have received a canary request
@webhook
Scenario: POST /forms/libreoffice/convert (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/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/page_1.docx | file |
| Gotenberg-Output-Filename | foo | header |
| Gotenberg-Webhook-Url | {helper}/webhook | header |
| Gotenberg-Webhook-Events-Url | {helper}/webhook/events | 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/pdf"
Then there should be 1 PDF(s) in the webhook request
Then there should be the following file(s) in the webhook request:
| foo.pdf |
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Page 1
"""
Scenario: POST /forms/libreoffice/convert (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/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/page_1.docx | file |
Then the response status code should be 401
Scenario: POST /foo/forms/libreoffice/convert (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/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/page_1.docx | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
# See: https://github.com/gotenberg/gotenberg/issues/1500.
Scenario: POST /forms/libreoffice/convert (Long Filename)
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/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.docx | 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 the "foo.pdf" PDF should have 1 page(s)
# An embedded image is stored inside the document, not linked, so blocking
# untrusted linked content leaves it untouched. Guards against over-blocking.
@libreoffice-ssrf
Scenario: POST /forms/libreoffice/convert (Embedded Image Survives)
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/libreoffice-embedded-image.fodt | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF should have 1 image(s)
# LibreOffice requests the style sheets an HTML document links: a request the
# outbound filters refuse is logged with the request's correlation ID, the URL
# without its query, and the rule.
Scenario: POST /forms/libreoffice/convert (Refused Linked Style Sheet Is Logged)
Given I have a Gotenberg container with the following environment variable(s):
| LIBREOFFICE_DENY_LIST | ^http://styles\\.example\\.com/ |
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/libreoffice-linked-stylesheet.html | file |
| Gotenberg-Trace | blocked-stylesheet | header |
Then the response status code should be 200
Then the Gotenberg container should log the following entries:
| "msg":"outbound request blocked by the LibreOffice filters","log_type":"application","correlation_id":"blocked-stylesheet" |
| "url":"http://styles.example.com/style.css","rule":"deny-list" |
Then the Gotenberg container should NOT log the following entries:
| token=secret |
# An uploaded document always loads from an untrusted location, so LibreOffice
# refuses to resolve any content it links (absolute file:// path or external
# URL). Closes the SSRF and local-file-read vector.
@libreoffice-ssrf
Scenario: POST /forms/libreoffice/convert (Linked External Resource Blocked)
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/libreoffice-linked-external.fodt | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF should have 0 image(s)
# Control for the canary scenarios below: with no filter in the way,
# LibreOffice requests the style sheet an HTML document links. Without it,
# a canary that stays silent could mean LibreOffice never tried.
@libreoffice-ssrf
Scenario: POST /forms/libreoffice/convert (Canary style sheet loads when no filter refuses it)
Given I have a static server
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):
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-stylesheet-html/index.html"}] | field |
Then the response status code should be 200
Then the helper server should have received the following canary request(s):
| style.css |
@libreoffice-ssrf
Scenario: POST /forms/libreoffice/convert (Canary in the deny-list never leaves)
Given I have a static server
Given I have a Gotenberg container with the following environment variable(s):
| LIBREOFFICE_DENY_LIST | ^{helper}/canary/ |
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-stylesheet-html/index.html"}] | field |
Then the response status code should be 200
Then the helper server should NOT have received a canary request
# LibreOffice follows a redirect itself, through the proxy again, so the
# filters see every hop.
@libreoffice-ssrf
Scenario: POST /forms/libreoffice/convert (Canary style sheet loads through a redirect)
Given I have a static server
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):
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-stylesheet-redirect-html/index.html"}] | field |
Then the response status code should be 200
Then the helper server should have received the following canary request(s):
| style.css |
@libreoffice-ssrf
Scenario: POST /forms/libreoffice/convert (Canary redirect into the deny-list never leaves)
Given I have a static server
Given I have a Gotenberg container with the following environment variable(s):
| LIBREOFFICE_DENY_LIST | ^{helper}/canary/ |
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-stylesheet-redirect-html/index.html"}] | field |
Then the response status code should be 200
Then the helper server should NOT have received a canary request
# Control for the HTTPS canary below: with no filter in the way, LibreOffice
# opens a tunnel for the HTTPS style sheet an HTML document links.
@libreoffice-ssrf
Scenario: POST /forms/libreoffice/convert (HTTPS canary tunnel opens when no filter refuses it)
Given I have a static server
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):
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-stylesheet-https-html/index.html"}] | field |
Then the response status code should be 200
Then the helper server should have received the following canary request(s):
| https |
# A tunnel only exposes its host and port: the deny-list sees its root URL,
# so a host rule ending in "/" refuses it.
@libreoffice-ssrf
Scenario: POST /forms/libreoffice/convert (HTTPS canary in the deny-list never leaves)
Given I have a static server
Given I have a Gotenberg container with the following environment variable(s):
| LIBREOFFICE_DENY_LIST | ^https://host\\.docker\\.internal:[0-9]+/ |
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-stylesheet-https-html/index.html"}] | field |
Then the response status code should be 200
Then the helper server should NOT have received a canary request
# The helper server resolves to a non-public address. An allow-list match
# would bypass the check: none here.
@libreoffice-ssrf
Scenario: POST /forms/libreoffice/convert (Canary on a non-public address never leaves)
Given I have a static server
Given I have a Gotenberg container with the following environment variable(s):
| LIBREOFFICE_ALLOW_LIST | |
| LIBREOFFICE_DENY_PRIVATE_IPS | true |
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-stylesheet-html/index.html"}] | field |
Then the response status code should be 200
Then the helper server should NOT have received a canary request
# Validating a document's signature, LibreOffice asks NSS for the issuer
# certificate the signer certificate names. NSS's own HTTP client ignores
# the proxy, so lok refuses every NSS request, whatever the filters allow.
@libreoffice-ssrf
Scenario: POST /forms/libreoffice/convert (Canary in a signed document's certificate never leaves)
Given I have a static server
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):
| downloadFrom | [{"url":"{helper}/canary-signed/signed.odt"}] | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the helper server should NOT have received a canary request
# The workbook was saved scrolled down to row 37. Without the topLeftCell
# reset, singlePage would start the page there and drop the header rows,
# so the "Meteor" column header only appears when the whole sheet is rendered.
# See https://github.com/gotenberg/gotenberg/issues/1222.
Scenario: POST /forms/libreoffice/convert (singlePage renders a scrolled workbook in full)
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/singlepagesheets-scrolled.xlsx | file |
| singlePage | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF should have content matching "Meteor" at page 1
# See: https://github.com/gotenberg/gotenberg/issues/1722.
Scenario: POST /forms/libreoffice/convert (Stages Disabled)
Given I have a Gotenberg container with the following environment variable(s):
| PDF_DISABLE_STAGES | true |
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 |
| stages | [{"op":"merge"}] | field |
Then the response status code should be 400
Then the response body should match string:
"""
Invalid form data: form field 'stages' is disabled on this instance; send the request without it
"""
# A conversion over --libreoffice-max-memory fails alone with a 422, which
# tells the client not to retry it as is, and LibreOffice restarts for the
# next one. 1MB sits under LibreOffice's own memory, so any conversion
# exceeds it.
Scenario: POST /forms/libreoffice/convert (Memory Limit)
Given I have a Gotenberg container with the following environment variable(s):
| LIBREOFFICE_MAX_MEMORY | 1MB |
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 |
Then the response status code should be 422
Then the response body should match string:
"""
LibreOffice exceeded its memory limit converting the document 'page_1.docx'. Reduce the document, or raise --libreoffice-max-memory (env LIBREOFFICE_MAX_MEMORY) on the server.
"""
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 |
Then the response status code should be 422