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

# Get Page PDF

> Generates a PDF of the current page for a browser session and returns it as a binary PDF file.



## OpenAPI

````yaml /openapi.yaml post /v1/tools/page-pdf
openapi: 3.1.0
info:
  title: AnchorBrowser API
  version: 1.0.0
  description: APIs to manage all browser-related actions and configuration.
servers:
  - url: https://api.anchorbrowser.io
    description: API server
security: []
paths:
  /v1/tools/page-pdf:
    post:
      tags:
        - Tools
      summary: Get Page PDF
      description: >-
        Generates a PDF of the current page for a browser session and returns it
        as a binary PDF file.
      parameters:
        - in: query
          name: sessionId
          required: false
          schema:
            type: string
            format: uuid
          description: >-
            Optional browser session ID. If omitted, `url` in the request body
            is required.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - url
              properties:
                url:
                  type: string
                  format: uri
                  description: The URL of the page to print to PDF.
                landscape:
                  type: boolean
                  description: Paper orientation. Defaults to false.
                displayHeaderFooter:
                  type: boolean
                  description: Display header and footer. Defaults to false.
                printBackground:
                  type: boolean
                  description: Print background graphics. Defaults to false.
                scale:
                  type: number
                  minimum: 0.1
                  maximum: 2
                  description: Scale of the webpage rendering. Defaults to 1.
                paperWidth:
                  type: number
                  exclusiveMinimum: 0
                  description: Paper width in inches. Defaults to 8.5.
                paperHeight:
                  type: number
                  exclusiveMinimum: 0
                  description: Paper height in inches. Defaults to 11.
                marginTop:
                  type: number
                  minimum: 0
                  description: Top margin in inches. Defaults to ~0.4.
                marginBottom:
                  type: number
                  minimum: 0
                  description: Bottom margin in inches. Defaults to ~0.4.
                marginLeft:
                  type: number
                  minimum: 0
                  description: Left margin in inches. Defaults to ~0.4.
                marginRight:
                  type: number
                  minimum: 0
                  description: Right margin in inches. Defaults to ~0.4.
                pageRanges:
                  type: string
                  pattern: ^\d+(-\d+)?(,\s*\d+(-\d+)?)*$
                  description: >-
                    Page ranges to print, e.g. '1-5, 8, 11-13'. Defaults to all
                    pages.
                headerTemplate:
                  type: string
                  description: HTML template for the print header.
                footerTemplate:
                  type: string
                  description: HTML template for the print footer.
                preferCSSPageSize:
                  type: boolean
                  description: Prefer page size as defined by CSS. Defaults to false.
      responses:
        '200':
          description: PDF generated successfully
          content:
            application/pdf:
              schema:
                type: string
                format: binary
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  details:
                    type: array
                    items:
                      type: string
        '404':
          description: Session not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '500':
          description: Failed to generate PDF
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - api_key_header: []
components:
  securitySchemes:
    api_key_header:
      type: apiKey
      in: header
      name: anchor-api-key
      description: API key passed in the header

````