swagger: "2.0"
schemes:
  - https
host: selectpdf.com
basePath: /
info:
  contact:
    email: support@selectpdf.com
    name: SelectPdf HTML To PDF API
    url: https://selectpdf.com/html-to-pdf-api/
  description: SelectPdf HTML To PDF Online REST API is a professional solution that lets you create PDF from web pages and raw HTML code in your applications. The API is easy to use and the integration takes only a few lines of code.
  title: SelectPdf HTML To PDF API
  version: 1.0.0
  x-apisguru-categories:
    - text
  x-logo:
    backgroundColor: "#FFFFFF"
    url: https://pbs.twimg.com/profile_images/566507399226212354/KWXTM5rW_400x400.jpeg
  x-origin:
    - format: swagger
      url: https://selectpdf.com/api/selectpdf-swagger.json
      version: "2.0"
  x-providerName: selectpdf.com
paths:
  /api2/convert:
    post:
      consumes:
        - application/json
        - application/x-www-form-urlencoded
        - application/xml
      description: Converts provided HTML string or url to PDF
      parameters:
        - description: Conversion parameters
          in: body
          name: parameters
          required: false
          schema:
            $ref: "#/definitions/ConversionParameters"
      produces:
        - application/pdf
        - application/json
      responses:
        "200":
          description: The API call succeeded. The pdf document is returned.
        "400":
          description: Bad Request. Url or html string not specified. The body of the response contains an explanation in plain text.
        "401":
          description: Authorization Required. License key not specified or invalid. The body of the response contains an explanation in plain text.
        "499":
          description: Conversion error. The body of the response contains an explanation in plain text.
      summary: Performs a html to pdf conversion
definitions:
  ConversionParameters:
    properties:
      base_url:
        description: An optional base url parameter can be used together with html to resolve relative paths from the html string
        example: https://selectpdf.com
        type: string
      html:
        description: The raw html string that will be converted to PDF
        example: <b>test html string</b>
        type: string
      key:
        description: The license key required to use the API
        example: d290f1ee-6c54-4b01-90e6-d701748f0851
        format: uuid
        type: string
      margin_bottom:
        description: Bottom margin of the generated PDF document in points (1 point = 1/72 inch)
        example: 5
        type: integer
      margin_left:
        description: Left margin of the generated PDF document in points (1 point = 1/72 inch)
        example: 5
        type: integer
      margin_right:
        description: Right margin of the generated PDF document in points (1 point = 1/72 inch)
        example: 5
        type: integer
      margin_top:
        description: Top margin of the generated PDF document in points (1 point = 1/72 inch)
        example: 5
        type: integer
      page_orientation:
        default: Portrait
        description: Specifies the page orientation of the generated pdf document
        enum:
          - Portrait
          - Landscape
        example: Portrait
        type: string
      page_size:
        default: A4
        description: Specifies the page size of the generated pdf document
        enum:
          - A1
          - A2
          - A3
          - A4
          - A5
          - Letter
          - HalfLetter
          - Ledger
          - Legal
        example: A4
        type: string
      url:
        description: The url that will be converted to PDF
        example: https://selectpdf.com
        type: string
    required:
      - key
    type: object
