openapi: 3.0.1
info:
  contact:
    email: support@pdfbroker.io
    name: PdfBroker.io Support
    url: https://www.pdfbroker.io/docs
  description: PdfBroker.io is an api for creating pdf files from Xsl-Fo or Html and other useful pdf utilities.
  termsOfService: https://www.pdfbroker.io/terms
  title: PdfBroker.io API
  version: v1
  x-apisguru-categories:
    - text
  x-origin:
    - format: openapi
      url: https://api.pdfbroker.io/swagger/v1/swagger.json
      version: "3.0"
  x-providerName: pdfbroker.io
security:
  - OAuth2:
      - pdfbroker
paths:
  /api/pdf:
    get:
      responses:
        "400":
          content:
            application/json:
              example: "{\r

                \  \"description\": \"Always empty in the public response, used for internal error transport to logs\",\r

                \  \"statusCode\": 400,\r

                \  \"errorMessage\": \"The error message provided to client\"\r

                }"
              schema:
                $ref: "#/components/schemas/ErrorResponseDto"
          description: If any error occurs parsing input
        "415":
          description: If content-type of request is not set to multipart/form-data or application/json
        "429":
          description: If you reach the monthly request limit for your subscription plan
      summary: Basic method to verify api is up and running
      tags:
        - Pdf
  /api/pdf/pdfconcat:
    post:
      requestBody:
        content:
          application/json:
            example: "{\r

              \  \"pdfDocumentsAsBase64String\": [\r

              \    \"<Encode your pdf documents as Base64 encoded string>\",\r

              \    \"<Encode your pdf documents as Base64 encoded string>\"\r

              \  ]\r

              }"
            schema:
              $ref: "#/components/schemas/PdfConcatenationRequestDto"
          multipart/form-data:
            encoding:
              pdfdocument1:
                contentType: application/octet-stream
              pdfdocument2:
                contentType: application/octet-stream
            schema:
              properties:
                pdfdocument1:
                  description: Add pdf files to be concatenated into single file
                  format: binary
                  type: string
                pdfdocument2:
                  description: You can add more than two files in the same request
                  format: binary
                  type: string
              type: object
        description: PdfConcat Request. Add two or more pdf files and concatenate pages into single pdf document.
      responses:
        "200":
          content:
            application/json:
              example: "{\r

                \  \"pdfFileBase64String\": \"Base64 encoded pdf file content\",\r

                \  \"errorMessage\": \"If any error occured, info will be provided here\"\r

                }"
              schema:
                $ref: "#/components/schemas/PdfResponseDto"
            application/pdf:
              schema:
                format: binary
                type: string
          description: Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
        "400":
          content:
            application/json:
              example: "{\r

                \  \"description\": \"Always empty in the public response, used for internal error transport to logs\",\r

                \  \"statusCode\": 400,\r

                \  \"errorMessage\": \"The error message provided to client\"\r

                }"
              schema:
                $ref: "#/components/schemas/ErrorResponseDto"
          description: If any error occurs parsing input
        "415":
          description: If content-type of request is not set to multipart/form-data or application/json
        "429":
          description: If you reach the monthly request limit for your subscription plan
      summary: Concatenate multiple pdf files into single pdf file..
      tags:
        - Pdf
  /api/pdf/pdftoimage:
    post:
      requestBody:
        content:
          application/json:
            example: "{\r

              \  \"pdfFileBase64String\": \"<Encode your existing PDF document as Base64 encoded string>\",\r

              \  \"options\": {\r

              \    \"pageNumber\": 1,\r

              \    \"imageFormat\": \"image/jpeg\",\r

              \    \"horizontalResolution\": 96.0,\r

              \    \"verticalResolution\": 96.0,\r

              \    \"width\": 0,\r

              \    \"height\": 0,\r

              \    \"transparent\": false,\r

              \    \"jpegQuality\": 90,\r

              \    \"pngCompressionLevel\": 6\r

              \  }\r

              }"
            schema:
              $ref: "#/components/schemas/PdfToImageRequestDto"
          multipart/form-data:
            encoding:
              options:
                contentType: application/json
              pdfdocument:
                contentType: application/octet-stream
            schema:
              properties:
                options:
                  description: After pdfdocument is added, add an entry named options with your PdfToImageOptions object serialized as JSON.
                  format: string
                  type: string
                pdfdocument:
                  description: An entry named pdfdocument is required in the multipart/form-data request
                  format: binary
                  type: string
              type: object
        description: PdfToImage Request. Create an image of a page in an existing pdf document.
      responses:
        "200":
          content:
            application/json:
              example: "{\r

                \  \"imageBase64String\": \"Image file base64 encoded. This is a complete data uri, including media type that can be used directly as src on a img-tag e.g.\",\r

                \  \"errorMessage\": \"If any error occurred, information will be provided here\"\r

                }"
              schema:
                $ref: "#/components/schemas/ImageResponseDto"
            image/gif:
              schema:
                format: binary
                type: string
            image/jpeg:
              schema:
                format: binary
                type: string
            image/png:
              schema:
                format: binary
                type: string
          description: Generate an image of the provided pdf file. Either the image file directly or serialized as Json if Accept-header is set to application/json
        "400":
          content:
            application/json:
              example: "{\r

                \  \"description\": \"Always empty in the public response, used for internal error transport to logs\",\r

                \  \"statusCode\": 400,\r

                \  \"errorMessage\": \"The error message provided to client\"\r

                }"
              schema:
                $ref: "#/components/schemas/ErrorResponseDto"
          description: If any error occurs parsing input
        "415":
          description: If content-type of request is not set to multipart/form-data or application/json
        "429":
          description: If you reach the monthly request limit for your subscription plan
      summary: Generate an image of to provided pdf file
      tags:
        - Pdf
  /api/pdf/pdfwritestring:
    post:
      requestBody:
        content:
          application/json:
            example: "{\r

              \  \"pdfFileBase64String\": \"<Encode your existing PDF document as Base64 encoded string>\",\r

              \  \"options\": {\r

              \    \"text\": \"This is test string\",\r

              \    \"textColor\": {\r

              \      \"r\": 33,\r

              \      \"g\": 34,\r

              \      \"b\": 35\r

              \    },\r

              \    \"font\": {\r

              \      \"name\": \"Arial\",\r

              \      \"size\": 24.0,\r

              \      \"style\": 1\r

              \    },\r

              \    \"pageNumber\": 3,\r

              \    \"xPosition\": 40.0,\r

              \    \"yPosition\": -200.0,\r

              \    \"xOrigin\": 1,\r

              \    \"yOrigin\": 2\r

              \  },\r

              \  \"fontFileBase64String\": \"<Attach your own TrueTypeFont file if necessary to style text, encoded as Base64 encoded string>\"\r

              }"
            schema:
              $ref: "#/components/schemas/PdfWriteStringRequestDto"
          multipart/form-data:
            encoding:
              fontfile:
                contentType: application/octet-stream
              options:
                contentType: application/json
              pdfdocument:
                contentType: application/octet-stream
            schema:
              properties:
                fontfile:
                  description: Optional entry to attach your own TrueType font file to style string
                  format: binary
                  type: string
                options:
                  description: After pdfdocument is added, add an entry named options with your PdfWriteStringOptions object serialized as JSON.
                  format: string
                  type: string
                pdfdocument:
                  description: An entry named pdfdocument is required in the multipart/form-data request
                  format: binary
                  type: string
              type: object
        description: PdfWriteString Request. Write string on page in pdf document
      responses:
        "200":
          content:
            application/json:
              example: "{\r

                \  \"pdfFileBase64String\": \"Base64 encoded pdf file content\",\r

                \  \"errorMessage\": \"If any error occured, info will be provided here\"\r

                }"
              schema:
                $ref: "#/components/schemas/PdfResponseDto"
            application/pdf:
              schema:
                format: binary
                type: string
          description: Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
        "400":
          content:
            application/json:
              example: "{\r

                \  \"description\": \"Always empty in the public response, used for internal error transport to logs\",\r

                \  \"statusCode\": 400,\r

                \  \"errorMessage\": \"The error message provided to client\"\r

                }"
              schema:
                $ref: "#/components/schemas/ErrorResponseDto"
          description: If any error occurs parsing input
        "415":
          description: If content-type of request is not set to multipart/form-data or application/json
        "429":
          description: If you reach the monthly request limit for your subscription plan
      summary: Write text on a page in a pdf document.
      tags:
        - Pdf
  /api/pdf/wkhtmltopdf:
    post:
      requestBody:
        content:
          application/json:
            example: "{\r

              \  \"url\": \"https://www.pdfbroker.io\",\r

              \  \"htmlBase64String\": null,\r

              \  \"wkHtmlToPdfArguments\": {\r

              \    \"grayscale\": \"\",\r

              \    \"viewport-size\": \"1280x1024\"\r

              \  },\r

              \  \"resources\": null\r

              }"
            schema:
              $ref: "#/components/schemas/WkHtmlToPdfRequestDto"
        description: WkHtmlToPdf Request. Generate pdf from html, either from url or base64 encoded html string
      responses:
        "200":
          content:
            application/json:
              example: "{\r

                \  \"pdfFileBase64String\": \"Base64 encoded pdf file content\",\r

                \  \"errorMessage\": \"If any error occured, info will be provided here\"\r

                }"
              schema:
                $ref: "#/components/schemas/PdfResponseDto"
            application/pdf:
              schema:
                format: binary
                type: string
          description: Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
        "400":
          content:
            application/json:
              example: "{\r

                \  \"description\": \"Always empty in the public response, used for internal error transport to logs\",\r

                \  \"statusCode\": 400,\r

                \  \"errorMessage\": \"The error message provided to client\"\r

                }"
              schema:
                $ref: "#/components/schemas/ErrorResponseDto"
          description: If any error occurs executing request
        "415":
          description: If content-type of request is not set to application/json
        "429":
          description: If you reach the monthly request limit for your subscription plan
      summary: Generate pdf file from url using the excellent tool wkhtmltopdf.
      tags:
        - Pdf
  /api/pdf/xslfo:
    post:
      requestBody:
        content:
          application/json:
            example: "{\r

              \  \"foDocumentBase64String\": \"<Encode your XSL-FO document as Base64 encoded string>\",\r

              \  \"resources\": {\r

              \    \"<Use file name as key, i.e 'logo.png', which is set as src on fo:external-graphic elements>\": \"<Convert your images to Base64 encoded string>\"\r

              \  },\r

              \  \"metadata\": {\r

              \    \"title\": \"Pdf title metadata can be set with metadata object\",\r

              \    \"author\": null,\r

              \    \"subject\": null,\r

              \    \"keywords\": [\r

              \      \"pdf\",\r

              \      \"api\"\r

              \    ],\r

              \    \"enableAdd\": true,\r

              \    \"enableCopy\": true,\r

              \    \"enableModify\": true,\r

              \    \"enablePrinting\": true,\r

              \    \"ownerPassword\": null,\r

              \    \"userPassword\": null\r

              \  }\r

              }"
            schema:
              $ref: "#/components/schemas/FoRequestDto"
          multipart/form-data:
            encoding:
              fodocument:
                contentType: application/octet-stream
              metadata:
                contentType: application/json
              resources:
                contentType: application/octet-stream
            schema:
              properties:
                fodocument:
                  description: An entry named fodocument is required in the multipart/form-data request
                  format: binary
                  type: string
                metadata:
                  description: Add pdf document metadata like title, author, subject and keywords
                  format: string
                  nullable: true
                  type: string
                resources:
                  description: After fodocument is added, add all digital resources one by one to your multipart/form-data request, using the filename as name in the form.
                  format: binary
                  type: string
              type: object
        description: XSL-FO Request, the basic XSL-FO request. Post your XSL-FO document and digital resources, either as 'multipart/form-data' or 'application/json'
      responses:
        "200":
          content:
            application/json:
              example: "{\r

                \  \"pdfFileBase64String\": \"Base64 encoded pdf file content\",\r

                \  \"errorMessage\": \"If any error occured, info will be provided here\"\r

                }"
              schema:
                $ref: "#/components/schemas/PdfResponseDto"
            application/pdf:
              schema:
                format: binary
                type: string
          description: Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
        "400":
          content:
            application/json:
              example: "{\r

                \  \"description\": \"Always empty in the public response, used for internal error transport to logs\",\r

                \  \"statusCode\": 400,\r

                \  \"errorMessage\": \"The error message provided to client\"\r

                }"
              schema:
                $ref: "#/components/schemas/ErrorResponseDto"
          description: If any error occurs parsing input
        "415":
          description: If content-type of request is not set to multipart/form-data or application/json
        "429":
          description: If you reach the monthly request limit for your subscription plan
      summary: Create pdf-file from complete XSL-FO document.
      tags:
        - Pdf
  /api/pdf/xslfowithtransform:
    post:
      requestBody:
        content:
          application/json:
            example: "{\r

              \  \"xmlDataDocumentBase64String\": \"<This is the document which contains your data that the XSL-FO transform will be applied on. Send as Base64 encoded string>\",\r

              \  \"foDocumentBase64String\": \"<Encode your XSL-FO transform document as Base64 encoded string>\",\r

              \  \"resources\": {\r

              \    \"<Use file name as key, i.e 'logo.png', which is set as src on fo:external-graphic elements>\": \"<Convert your images to Base64 encoded string>\"\r

              \  },\r

              \  \"metadata\": null\r

              }"
            schema:
              $ref: "#/components/schemas/FoTransformRequestDto"
          multipart/form-data:
            encoding:
              fodocument:
                contentType: application/octet-stream
              resources:
                contentType: application/octet-stream
              xmldatadocument:
                contentType: application/octet-stream
            schema:
              properties:
                fodocument:
                  description: An entry named fodocument with your XSL-FO transform is required in the multipart/form-data request
                  format: binary
                  type: string
                resources:
                  description: After fodocument and xmldatadocument is added, add all digital resources one by one to your multipart/form-data request, using the filename as name in the form.
                  format: binary
                  type: string
                xmldatadocument:
                  description: An entry named xmldatadocument, on which the XSL-FO transform is applied, is required in the multipart/form-data request
                  format: binary
                  type: string
              type: object
        description: XSL-FO Transform Request. The XSL-FO is transformed on the supplied xml data document. Post your XSL-FO transform document and xml data document aloing with your digital resources, either as 'multipart/form-data' or 'application/json'
      responses:
        "200":
          content:
            application/json:
              example: "{\r

                \  \"pdfFileBase64String\": \"Base64 encoded pdf file content\",\r

                \  \"errorMessage\": \"If any error occured, info will be provided here\"\r

                }"
              schema:
                $ref: "#/components/schemas/PdfResponseDto"
            application/pdf:
              schema:
                format: binary
                type: string
          description: Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
        "400":
          content:
            application/json:
              example: "{\r

                \  \"description\": \"Always empty in the public response, used for internal error transport to logs\",\r

                \  \"statusCode\": 400,\r

                \  \"errorMessage\": \"The error message provided to client\"\r

                }"
              schema:
                $ref: "#/components/schemas/ErrorResponseDto"
          description: If any error occurs parsing input
        "415":
          description: If content-type of request is not set to multipart/form-data or application/json
        "429":
          description: If you reach the monthly request limit for your subscription plan
      summary: Create pdf-file from transforming xml document with Xsl-Fo transform document.
      tags:
        - Pdf
components:
  schemas:
    ColorDto:
      additionalProperties: false
      description: Set color
      properties:
        b:
          description: Get or sets B value of RGB color
          format: int32
          maximum: 255
          minimum: 0
          type: integer
        g:
          description: Get or sets G value of RGB color
          format: int32
          maximum: 255
          minimum: 0
          type: integer
        r:
          description: Get or sets R value of RGB color
          format: int32
          maximum: 255
          minimum: 0
          type: integer
      type: object
    ErrorResponseDto:
      additionalProperties: false
      properties:
        description:
          nullable: true
          type: string
        errorMessage:
          description: If any error occurs the message will be displayed in here
          nullable: true
          type: string
        statusCode:
          format: int32
          type: integer
      type: object
    FoRequestDto:
      additionalProperties: false
      description: The basic request with the XSL-FO document as a Base64 encoded string with a set of resources provided with a name and the data of the resource as a Base64 encoded string.
      properties:
        foDocumentBase64String:
          description: This is the complete XSL-FO document provided using Base64 encoding.
          nullable: true
          type: string
        metadata:
          $ref: "#/components/schemas/PdfMetadataDto"
        resources:
          additionalProperties:
            nullable: true
            type: string
          description: This is a set of key-value pairs of digital resources like images that is referenced in the XSL-FO document. It uses the filename as key and the data is provided as a Base64 encoded string.
          nullable: true
          type: object
      type: object
    FoTransformRequestDto:
      additionalProperties: false
      description: The XSL-FO transform document and xml data document as a Base64 encoded string with a set of resources provided with a name and the data of the resource as a Base64 encoded string.
      properties:
        foDocumentBase64String:
          description: This is the complete XSL-FO document provided using Base64 encoding.
          nullable: true
          type: string
        metadata:
          $ref: "#/components/schemas/PdfMetadataDto"
        resources:
          additionalProperties:
            nullable: true
            type: string
          description: This is a set of key-value pairs of digital resources like images that is referenced in the XSL-FO document. It uses the filename as key and the data is provided as a Base64 encoded string.
          nullable: true
          type: object
        xmlDataDocumentBase64String:
          description: This is xml data document on which the XSL-FO transform document is applied. Provided using Base64 encoding.
          nullable: true
          type: string
      type: object
    FontDto:
      additionalProperties: false
      description: The Font dto object
      properties:
        name:
          description: Gets the name of the font
          nullable: true
          type: string
        size:
          description: Gets the size of the font
          format: float
          type: number
        style:
          $ref: "#/components/schemas/FontStyle"
      type: object
    FontStyle:
      description: Font style enum representing Regular, Bold, Italic, BoldItalic
      enum:
        - 0
        - 1
        - 2
        - 3
      format: int32
      type: integer
    ImageResponseDto:
      additionalProperties: false
      description: When setting the Accept-header in the request to "application/json" the image file will be return as Base64 encoded string. Note that converting data to Base64 encoded strings increases the response size with approximately 33%, if you can accept the a binary format it's better to use Accept-header "image/jpeg", "image/png" or "image/gif".
      properties:
        errorMessage:
          description: If any error occurs the message will be displayed in here
          nullable: true
          type: string
        imageBase64String:
          description: The Base64 encoded string that is the image file. This is a complete data uri, including media type that can be used directly as src on a img-tag e.g.
          nullable: true
          type: string
      type: object
    PdfConcatenationRequestDto:
      additionalProperties: false
      description: Request to concatenate a list of Pdf documents to a single Pdf document.
      properties:
        pdfDocumentsAsBase64String:
          description: The list of Pdf documents encoded as Base64 strings.
          items:
            type: string
          nullable: true
          type: array
      type: object
    PdfMetadataDto:
      additionalProperties: false
      description: Enter meta data for pdf document
      properties:
        author:
          description: Pdf document author
          nullable: true
          type: string
        enableAdd:
          description: "Enables or disables adding or modifying text annotations and interactive\r

            form fields."
          type: boolean
        enableCopy:
          description: Enables or disables copying of text and graphics.
          type: boolean
        enableModify:
          description: "Enables or disables modifying document contents (other than text annotations and \r

            interactive form fields)."
          type: boolean
        enablePrinting:
          description: Enables or disables printing.
          type: boolean
        keywords:
          description: Pdf document keywords
          items:
            type: string
          nullable: true
          type: array
        ownerPassword:
          description: Specifies the owner password that will protect full access to any generated PDF documents.
          nullable: true
          type: string
        subject:
          description: Pdf document subject
          nullable: true
          type: string
        title:
          description: Pdf document title
          nullable: true
          type: string
        userPassword:
          description: Specifies the user password that will protect access to any generated PDF documents.
          nullable: true
          type: string
      type: object
    PdfResponseDto:
      additionalProperties: false
      description: When setting the Accept-header in the request to "application/json" the content of the pdf file will be return as Base64 encoded string. Note that converting data to Base64 encoded strings increases the response size with approximately 33%, if you can accept the a binary format it's better to use Accept-header "application/pdf".
      properties:
        errorMessage:
          description: If any error occurs the message will be displayed in here
          nullable: true
          type: string
        pdfFileBase64String:
          description: The Base64 encoded string that is the pdf file.
          nullable: true
          type: string
      type: object
    PdfToImageOptions:
      additionalProperties: false
      properties:
        height:
          description: Set the height of the output image, default value is width of source document. To scale height, and keeping proportions, do not set width;
          format: int32
          type: integer
        horizontalResolution:
          description: Set the horizontal resolution, default is 96 dpi;
          format: double
          type: number
        imageFormat:
          description: Valid options are "image/jpeg", "image/png" or "image/gif". Default is "image/png"
          nullable: true
          type: string
        jpegQuality:
          description: Sets the quality of jpeg images, range 0 to 100, default is 75
          format: int32
          type: integer
        pageNumber:
          description: Which page of the pdf file to generate image from, default is first page
          format: int32
          type: integer
        pngCompressionLevel:
          description: Sets the png compression level, range 1 - 9, default is 6
          format: int32
          type: integer
        transparent:
          description: Keep the background of the image transparent. This setting is not available in JPEG-files, since transparency is not supported in the JPEG format.
          type: boolean
        verticalResolution:
          description: Set the vertical resolution, default is 96 dpi;
          format: double
          type: number
        width:
          description: Set the width of the output image, default value is width of source document. To scale width, and keeping proportions, do not set height;
          format: int32
          type: integer
      type: object
    PdfToImageRequestDto:
      additionalProperties: false
      properties:
        options:
          $ref: "#/components/schemas/PdfToImageOptions"
        pdfFileBase64String:
          description: The pdf file to generate image from, as Base64 encoded string.
          nullable: true
          type: string
      type: object
    PdfWriteStringOptions:
      additionalProperties: false
      description: Options for writing string in pdf page;
      properties:
        font:
          $ref: "#/components/schemas/FontDto"
        pageNumber:
          description: Get or set which page in the pdf to write on, default is first page.
          format: int32
          type: integer
        text:
          description: The text to write in the pdf
          nullable: true
          type: string
        textColor:
          $ref: "#/components/schemas/ColorDto"
        xOrigin:
          $ref: "#/components/schemas/XOriginPoint"
        xPosition:
          description: Get or set the X axis position on where to write string, in reference to XOrigin.
          format: float
          type: number
        yOrigin:
          $ref: "#/components/schemas/YOriginPoint"
        yPosition:
          description: Get or set the Y axis position on where to write string, in reference to YOrigin.
          format: float
          type: number
      type: object
    PdfWriteStringRequestDto:
      additionalProperties: false
      description: The request dto object to write a string on pdf page
      properties:
        fontFileBase64String:
          description: System fonts are available, but you can provide your own font file to be embedded in the pdf document. Send font as Base64 encoded string.
          nullable: true
          type: string
        options:
          $ref: "#/components/schemas/PdfWriteStringOptions"
        pdfFileBase64String:
          description: The pdf file to add text to, as Base64 encoded string.
          nullable: true
          type: string
      type: object
    WkHtmlToPdfRequestDto:
      additionalProperties: false
      description: WkHtmlToPdfRequestDto is the data transfer object for generating a pdf using wkhtmltopdf;
      properties:
        htmlBase64String:
          description: Base64 encoded string with html. If property Url is set, it will be used, not HtmlBase64String.
          nullable: true
          type: string
        resources:
          additionalProperties:
            nullable: true
            type: string
          description: This is a set of key-value pairs of digital resources like images that is referenced in the HtmlBase64String document. It uses the filename including relative path as key and the data is provided as a Base64 encoded string.
          nullable: true
          type: object
        url:
          description: The url to generate pdf from. Url has precedence over HtmlBase64String value if both are set.
          nullable: true
          type: string
        wkHtmlToPdfArguments:
          additionalProperties:
            nullable: true
            type: string
          description: Command line arguments passed to wkhtmltopdf.
          nullable: true
          type: object
      type: object
    XOriginPoint:
      enum:
        - 0
        - 1
        - 2
      format: int32
      type: integer
    YOriginPoint:
      enum:
        - 0
        - 1
        - 2
      format: int32
      type: integer
  securitySchemes:
    OAuth2:
      flows:
        clientCredentials:
          scopes:
            pdfbroker: Scope to access the PdfBroker API.
          tokenUrl: https://login.pdfbroker.io/connect/token
      type: oauth2
