> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doczilla.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Create PDF

> Create a PDF and directly return the raw result.



## OpenAPI

````yaml POST /v1/pdf
openapi: 3.0.0
info:
  title: Doczilla
  description: ''
  version: '1.0'
  contact: {}
servers:
  - url: https://api.doczilla.app
    description: Production
security: []
tags: []
paths:
  /v1/pdf:
    post:
      tags:
        - PDF
      description: Create a PDF and directly return the raw result.
      operationId: pdf.direct
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePdf'
      responses:
        '201':
          description: ''
          content:
            application/pdf:
              schema:
                type: string
                format: binary
                description: Raw PDF document
        '400':
          description: Validations failed!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedResponse'
        '402':
          description: Reached subscription limit!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionLimitReachedResponse'
        '403':
          description: Token has no active subscription!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '413':
          description: Request body is too large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayloadTooLargeResponse'
        '429':
          description: Too Many Requests!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
      security:
        - bearer: []
components:
  schemas:
    CreatePdf:
      type: object
      properties:
        page:
          description: >-
            Page options, either provide the `url`, `html` or `htmlTemplate`
            option.
          allOf:
            - $ref: '#/components/schemas/PageOptions'
        pdf:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PdfOptions'
      required:
        - page
    BadRequestResponse:
      type: object
      properties:
        message:
          type: string
          example: Validations failed!
        code:
          type: string
          example: api.validation
        fields:
          type: object
          additionalProperties:
            type: string
          example:
            page.url: must be a URL address
      required:
        - message
        - code
        - fields
    UnauthorizedResponse:
      type: object
      properties:
        message:
          type: string
          example: Unauthorized
      required:
        - message
    SubscriptionLimitReachedResponse:
      type: object
      properties:
        message:
          type: string
          example: Reached subscription limit!
      required:
        - message
    ForbiddenResponse:
      type: object
      properties:
        message:
          type: string
          example: Token has no active subscription!
      required:
        - message
    PayloadTooLargeResponse:
      type: object
      properties:
        message:
          type: string
          example: Request body is too large
      required:
        - message
    TooManyRequestsResponse:
      type: object
      properties:
        message:
          type: string
          example: Too Many Requests!
      required:
        - message
    InternalServerErrorResponse:
      type: object
      properties:
        message:
          type: string
          example: Internal server error
      required:
        - message
    PageOptions:
      type: object
      properties:
        url:
          type: string
          description: URL to go to. Should include the scheme, e.g. `https://`
          nullable: true
        html:
          type: string
          description: HTML to render. Needs to be base64 encoded!
          nullable: true
        htmlTemplate:
          type: string
          description: >-
            HTML template to render, uses
            [Handlebars](https://handlebarsjs.com/) to render your HTML together
            with the provided `templateData`. Needs to be base64 encoded!
          nullable: true
        templateData:
          type: object
          description: Template data, only used in combination with `page.htmlTemplate`.
          nullable: true
        waitUntil:
          type: string
          example: auto
          description: >-
            When to consider waiting succeeds.

            - `auto` our smart waiting option that can handle 90% of the cases.

            - `load` waits for the 'load' event.

            - `domcontentloaded` waits for the 'DOMContentLoaded' event.

            - `networkidle0` waits till there are no more than 0 network
            connections for at least `500` ms.

            - `networkidle2` waits till there are no more than 2 network
            connections for at least `500` ms. 
          enum:
            - auto
            - load
            - domcontentloaded
            - networkidle0
            - networkidle2
          default: auto
        waitForMilliseconds:
          type: number
          description: >-
            Wait for a certain amount of milliseconds before the request
            continues.
          minimum: 0
          maximum: 5000
          nullable: true
        waitForSelector:
          description: >-
            Wait for the
            [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors)
            to appear in page. If the
            [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors)
            doesn't appear after the `timeout` milliseconds of waiting, the
            request will continue.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PageWaitForSelector'
        waitForFunction:
          description: >-
            Wait for the `pageFunction` to execute in the page. If the
            `pageFunction` doesn't execute successfully after the `timeout`
            milliseconds of waiting, the request will continue.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PageWaitForFunction'
        headers:
          type: object
          example:
            x-foo: bar
          description: >-
            An object containing additional HTTP headers to be sent with every
            request. All header values must be strings.
          nullable: true
        adblock:
          type: boolean
          example: true
          description: Use our build-in adblocker.
          default: true
        javascript:
          type: boolean
          example: true
          description: Whether or not to enable JavaScript on the page.
          default: true
        cookies:
          description: >-
            Cookies added to the page, Also accepted as string inside
            `headers.cookie`.
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/PageCookie'
        authentication:
          description: Provide credentials for `HTTP authentication`.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PageAuthentication'
        colorScheme:
          type: string
          description: Color-scheme to set on the page.
          maxLength: 20
          nullable: true
        mediaType:
          type: string
          description: Changes the CSS media type of the page.
          enum:
            - screen
            - print
          nullable: true
        timezone:
          type: string
          description: >-
            Changes the timezone of the page. See [ICU’s
            metaZones.txt](https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt)
            for a list of supported timezone IDs.
          nullable: true
    PdfOptions:
      type: object
      properties:
        scale:
          type: number
          example: 1
          description: >-
            Scales the rendering of the web page. Amount must be between `0.1`
            and `2`.
          minimum: 0.1
          maximum: 2
          default: 1
        displayHeaderFooter:
          type: boolean
          example: false
          description: Whether to show the header and footer.
          default: false
        headerHtml:
          type: string
          description: >-
            HTML template for the print header. Should be valid HTML (base64
            encoded) with the following classes used to inject values into them:

            - `date` formatted print date

            - `title` document title

            - `url` document location

            - `pageNumber` current page number

            - `totalPages` total pages in the document
          nullable: true
        footerHtml:
          type: string
          description: >-
            HTML template for the print footer. Has the same constraints and
            support for special classes as `headerHtml`.
          nullable: true
        printBackground:
          type: boolean
          example: false
          description: Set to `true` to print background graphics.
          default: false
        landscape:
          type: boolean
          example: false
          description: Whether to print in landscape orientation.
          default: false
        pageRanges:
          type: string
          example: 1-5
          description: Paper ranges to print, e.g. `1-5, 8, 11-13`.
          nullable: true
        format:
          type: string
          example: letter
          description: |-
            If set, this takes priority over the `width` and `height` options.
             The sizes of each format are as follows:
            - `letter` 8.5in x 11in
            - `legal` 8.5in x 14in
            - `tabloid` 11in x 17in
            - `ledger` 17in x 11in
            - `a0` 33.1in x 46.8in
            - `a1` 23.4in x 33.1in
            - `a2` 16.54in x 23.4in
            - `a3` 11.7in x 16.54in
            - `a4` 8.27in x 11.7in
            - `a5` 5.83in x 8.27in
            - `a6` 4.13in x 5.83in
          default: letter
          enum:
            - letter
            - legal
            - tabloid
            - ledger
            - a0
            - a1
            - a2
            - a3
            - a4
            - a5
            - a6
        width:
          description: >-
            Sets the width of paper. You can pass in a number or a string with a
            unit.
          oneOf:
            - type: string
            - type: number
          nullable: true
        height:
          description: >-
            Sets the height of paper. You can pass in a number or a string with
            a unit.
          oneOf:
            - type: string
            - type: number
          nullable: true
        preferCSSPageSize:
          type: boolean
          example: false
          description: >-
            Give any CSS
            [@page](https://developer.mozilla.org/en-US/docs/Web/CSS/@page) size
            declared in the page priority over what is declared in the `width`
            or `height` or `format` option.
          default: false
        margin:
          description: Set the PDF margins.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PDFMargin'
        omitBackground:
          type: boolean
          example: false
          description: >-
            Hides default white background and allows generating pdfs with
            transparency.
          default: false
        outline:
          type: boolean
          example: false
          description: |-
            Generate document outline.
            If this is enabled the PDF will also be tagged (accessible).
          default: false
        tagged:
          type: boolean
          example: false
          description: |-
            Generate tagged (accessible) PDF.
            This is experimental and will increase the size of the PDF.
          default: false
    PageWaitForSelector:
      type: object
      properties:
        selector:
          type: string
          description: >-
            The
            [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors)
            of an element to wait for.
          minLength: 1
          maxLength: 1024
        options:
          description: Options for configuring waiting behavior.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PageWaitForSelectorOptions'
      required:
        - selector
    PageWaitForFunction:
      type: object
      properties:
        pageFunction:
          type: string
          example: window.innerWidth < 100
          description: >-
            Function to be evaluated in browser context until it returns a
            truthy value.
          minLength: 1
          maxLength: 1024
        options:
          description: Options for configuring waiting behavior.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PageWaitForFunctionOptions'
      required:
        - pageFunction
    PageCookie:
      type: object
      properties:
        name:
          type: string
          description: Cookie name.
          minLength: 1
          maxLength: 1024
        value:
          type: string
          description: Cookie value.
          minLength: 1
          maxLength: 4096
        domain:
          type: string
          description: Cookie domain.
          minLength: 1
          maxLength: 512
        url:
          type: string
          description: >-
            The request-URI to associate with the setting of the cookie. This
            value can affect the default domain, path, source port, and source
            scheme values of the created cookie. Should include the scheme, e.g.
            `https://`
          nullable: true
        path:
          type: string
          description: Cookie path.
          minLength: 1
          maxLength: 512
          nullable: true
        secure:
          type: boolean
          description: '`true` if cookie is secure.'
          nullable: true
        httpOnly:
          type: boolean
          description: '`true` if cookie is http-only.'
          nullable: true
        sameSite:
          type: string
          description: Cookie SameSite type.
          enum:
            - Strict
            - Lax
            - None
          nullable: true
        expires:
          type: number
          description: >-
            Cookie expiration date (UTC time in seconds, counted from January 1,
            1970.), session cookie if not set. 
          nullable: true
      required:
        - name
        - value
        - domain
    PageAuthentication:
      type: object
      properties:
        username:
          type: string
          minLength: 1
          maxLength: 1024
        password:
          type: string
          minLength: 1
          maxLength: 4096
      required:
        - username
        - password
    PDFMargin:
      type: object
      properties:
        top:
          nullable: true
          oneOf:
            - type: string
            - type: number
        bottom:
          nullable: true
          oneOf:
            - type: string
            - type: number
        left:
          nullable: true
          oneOf:
            - type: string
            - type: number
        right:
          nullable: true
          oneOf:
            - type: string
            - type: number
    PageWaitForSelectorOptions:
      type: object
      properties:
        visible:
          type: boolean
          example: false
          description: >-
            Wait for the selected element to be present in DOM and to be
            visibleAn element is considered to be visible if all of the
            following is true:

            - the element has [computed
            styles](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle)

            - the element has a non-empty [bounding client
            rect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect)

            - the element's
            [visibility](https://developer.mozilla.org/en-US/docs/Web/CSS/visibility)
            is not `hidden` or `collapse`
          default: false
        hidden:
          type: boolean
          example: false
          description: >-
            Wait for the selected element to not be found in the DOM or to be
            hidden.An element is considered to be hidden if at least one of the
            following is true:

            - the element has no [computed
            styles](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle)

            - the element has an empty [bounding client
            rect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect)

            - the element's
            [visibility](https://developer.mozilla.org/en-US/docs/Web/CSS/visibility)
            is `hidden` or `collapse`
          default: false
        timeout:
          type: number
          example: 10000
          description: Maximum time to wait in milliseconds.
          minimum: 1
          maximum: 30000
          default: 10000
    PageWaitForFunctionOptions:
      type: object
      properties:
        polling:
          example: raf
          description: >-
            An interval at which the `pageFunction` is executed, defaults to
            `raf`. If `polling` is a number, then it is treated as an interval
            in milliseconds at which the function would be executed. If
            `polling` is a string, then it can be one of the following values:

            - `raf` to constantly execute `pageFunction` in
            `requestAnimationFrame` callback. This is the tightest polling mode
            which is suitable to observe styling changes.

            - `mutation` to execute `pageFunction` on every DOM mutation.
          default: raf
          oneOf:
            - type: string
              enum:
                - raf
                - mutation
            - type: number
        timeout:
          type: number
          example: 10000
          description: Maximum time to wait in milliseconds.
          minimum: 1
          maximum: 30000
          default: 10000
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````