Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

13.7 KB
Raw Blame
@general-new
Feature: General PDF Operations API Validation


    @rotate-pdf @positive
    Scenario Outline: rotate-pdf with valid rotation angles
        Given I generate a PDF file as "fileInput"
        And the pdf contains 3 pages
        And the request data includes
            | parameter | value   |
            | angle     | <angle> |
        When I send the API request to the endpoint "/api/v1/general/rotate-pdf"
        And this operation is run 5 times in parallel
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 200
        And the response PDF should contain 3 pages

        Examples:
            | angle |
            | 90    |
            | 180   |
            | 270   |


    @rotate-pdf @negative @rotate-pdf-negative
    Scenario: rotate-pdf with invalid angle returns error
        Given I generate a PDF file as "fileInput"
        And the pdf contains 2 pages
        And the request data includes
            | parameter | value |
            | angle     | 45    |
        When I send the API request to the endpoint "/api/v1/general/rotate-pdf"
        Then the response status code should be 400


    @remove-pages @positive
    Scenario: remove-pages removes the specified page from a multi-page PDF
        Given I generate a PDF file as "fileInput"
        And the pdf contains 5 pages
        And the request data includes
            | parameter   | value |
            | pageNumbers | 3     |
        When I send the API request to the endpoint "/api/v1/general/remove-pages"
        And this operation is run 5 times in parallel
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 200
        And the response PDF should contain 4 pages


    @remove-pages @positive
    Scenario Outline: remove-pages with various page selections
        Given I generate a PDF file as "fileInput"
        And the pdf contains 6 pages
        And the request data includes
            | parameter   | value         |
            | pageNumbers | <pageNumbers> |
        When I send the API request to the endpoint "/api/v1/general/remove-pages"
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 200
        And the response PDF should contain <remaining> pages

        Examples:
            | pageNumbers | remaining |
            | 1           | 5         |
            | 6           | 5         |
            | 2,4         | 4         |
            | 1,2,3       | 3         |


    @rearrange-pages @positive
    Scenario Outline: rearrange-pages with different custom modes
        Given I generate a PDF file as "fileInput"
        And the pdf contains 4 pages
        And the request data includes
            | parameter  | value        |
            | customMode | <customMode> |
        When I send the API request to the endpoint "/api/v1/general/rearrange-pages"
        And this operation is run 5 times in parallel
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 200
        And the response PDF should contain <expectedPages> pages

        Examples:
            | customMode    | expectedPages |
            | REVERSE_ORDER | 4             |

        @rearrange-duplicate
        Examples:
            | customMode | expectedPages |
            | DUPLICATE  | 8             |

        Examples:
            | customMode     | expectedPages |
            | ODD_EVEN_SPLIT | 4             |
            | ODD_EVEN_MERGE | 4             |


    @scale-pages @positive
    Scenario Outline: scale-pages to various standard page sizes
        Given I generate a PDF file as "fileInput"
        And the pdf contains 3 pages
        And the request data includes
            | parameter | value      |
            | pageSize  | <pageSize> |
        When I send the API request to the endpoint "/api/v1/general/scale-pages"
        And this operation is run 5 times in parallel
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 200
        And the response PDF should contain 3 pages

        Examples:
            | pageSize |
            | A4       |
            | LETTER   |
            | A3       |
            | LEGAL    |


    @crop @positive
    Scenario: crop PDF pages to a specific region
        Given I generate a PDF file as "fileInput"
        And the pdf contains 2 pages
        And the request data includes
            | parameter | value |
            | x         | 0     |
            | y         | 0     |
            | width     | 50    |
            | height    | 50    |
        When I send the API request to the endpoint "/api/v1/general/crop"
        And this operation is run 5 times in parallel
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 200
        And the response PDF should contain 2 pages


    @crop @positive
    Scenario: crop single-page PDF preserves page count
        Given I generate a PDF file as "fileInput"
        And the pdf contains 1 pages
        And the request data includes
            | parameter | value |
            | x         | 0     |
            | y         | 0     |
            | width     | 50    |
            | height    | 50    |
        When I send the API request to the endpoint "/api/v1/general/crop"
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 0
        And the response PDF should contain 1 pages


    @crop @positive
    Scenario: crop only the selected page and keep the others
        Given I generate a PDF file as "fileInput"
        And the pdf contains 3 pages
        And the request data includes
            | parameter   | value |
            | x           | 0     |
            | y           | 0     |
            | width       | 50    |
            | height      | 50    |
            | pageNumbers | 2     |
        When I send the API request to the endpoint "/api/v1/general/crop"
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response PDF should contain 3 pages
        And the response PDF page 1 should have width 612 and height 792
        And the response PDF page 2 should have width 50 and height 50
        And the response PDF page 3 should have width 612 and height 792


    @crop @positive
    Scenario: legacy requests without pageNumbers crop every page
        Given I generate a PDF file as "fileInput"
        And the pdf contains 3 pages
        And the request data includes
            | parameter | value |
            | x         | 0     |
            | y         | 0     |
            | width     | 50    |
            | height    | 50    |
        When I send the API request to the endpoint "/api/v1/general/crop"
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response PDF should contain 3 pages
        And the response PDF page 1 should have width 50 and height 50
        And the response PDF page 2 should have width 50 and height 50
        And the response PDF page 3 should have width 50 and height 50


    @pdf-to-single-page @positive
    Scenario: pdf-to-single-page combines all pages into one long page
        Given I generate a PDF file as "fileInput"
        And the pdf contains 5 pages
        When I send the API request to the endpoint "/api/v1/general/pdf-to-single-page"
        And this operation is run 5 times in parallel
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 200
        And the response PDF should contain 1 pages


    @pdf-to-single-page @positive
    Scenario: pdf-to-single-page with a single-page input returns one page
        Given I generate a PDF file as "fileInput"
        And the pdf contains 1 pages
        When I send the API request to the endpoint "/api/v1/general/pdf-to-single-page"
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 0
        And the response PDF should contain 1 pages


    @multi-page-layout @positive
    Scenario Outline: multi-page-layout combines input pages onto fewer sheets
        Given I generate a PDF file as "fileInput"
        And the pdf contains 4 pages
        And the request data includes
            | parameter     | value          |
            | pagesPerSheet | <pagesPerSheet> |
        When I send the API request to the endpoint "/api/v1/general/multi-page-layout"
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 200
        And the response PDF should contain <outputPages> pages

        Examples:
            | pagesPerSheet | outputPages |
            | 2             | 2           |
            | 4             | 1           |


    @multi-page-layout @positive
    Scenario: multi-page-layout with 9 pages per sheet on 9 input pages
        Given I generate a PDF file as "fileInput"
        And the pdf contains 9 pages
        And the request data includes
            | parameter     | value |
            | pagesPerSheet | 9     |
        When I send the API request to the endpoint "/api/v1/general/multi-page-layout"
        And this operation is run 5 times in parallel
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 200
        And the response PDF should contain 1 pages


    @booklet-imposition @positive
    Scenario: booklet-imposition returns a valid PDF
        Given I generate a PDF file as "fileInput"
        And the pdf contains 4 pages
        And the request data includes
            | parameter     | value |
            | pagesPerSheet | 2     |
        When I send the API request to the endpoint "/api/v1/general/booklet-imposition"
        And this operation is run 5 times in parallel
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 200


    @booklet-imposition @positive
    Scenario: booklet-imposition with 8-page input returns valid PDF
        Given I generate a PDF file as "fileInput"
        And the pdf contains 8 pages
        And the request data includes
            | parameter     | value |
            | pagesPerSheet | 2     |
        When I send the API request to the endpoint "/api/v1/general/booklet-imposition"
        Then the response content type should be "application/pdf"
        And the response status code should be 200
        And the response file should have size greater than 200


    # @remove-image-pdf @positive
    # Scenario: remove-image-pdf strips images from a PDF containing images
    #     Given I generate a PDF file as "fileInput"
    #     And the pdf contains 3 images of size 100x100 on 2 pages
    #     When I send the API request to the endpoint "/api/v1/general/remove-image-pdf"
    #     Then the response content type should be "application/pdf"
    #     And the response status code should be 200
    #     And the response file should have size greater than 0
    #
    #
    # @remove-image-pdf @positive
    # Scenario: remove-image-pdf on a plain text PDF returns a PDF
    #     Given I generate a PDF file as "fileInput"
    #     And the pdf contains 3 pages with random text
    #     When I send the API request to the endpoint "/api/v1/general/remove-image-pdf"
    #     Then the response content type should be "application/pdf"
    #     And the response status code should be 200
    #     And the response file should have size greater than 0


    @edit-table-of-contents @positive
    Scenario: edit-table-of-contents rewrites the outline
        Given I generate a PDF file as "fileInput"
        And the pdf contains 3 pages
        And the pdf has bookmarks
        And the request data includes
            | parameter    | value                                                    |
            | bookmarkData | [{"title":"Intro","pageNumber":1,"children":[]}]          |
        When I send the API request to the endpoint "/api/v1/general/edit-table-of-contents"
        And this operation is run 5 times in parallel
        Then the response status code should be 200
        And the response content type should be "application/pdf"
        And the response PDF should contain 3 pages


    @split-for-poster-print @positive
    Scenario: split-for-poster-print tiles each page into an archive
        Given I generate a PDF file as "fileInput"
        And the pdf contains 2 pages
        And the request data includes
            | parameter           | value |
            | horizontalDivisions | 1     |
            | verticalDivisions   | 1     |
        When I send the API request to the endpoint "/api/v1/general/split-for-poster-print"
        And this operation is run 5 times in parallel
        Then the response status code should be 200
        And the response file should have size greater than 200