---
title: "Write text on a page in a pdf document."
method: POST
path: "/api/v1/pdf/pdfwritestring"
tags: ["Pdf"]
---

# Write text on a page in a pdf document.

`POST /api/v1/pdf/pdfwritestring`

## Request body

- PdfWriteStringRequestDto — The request dto object to write a string on pdf page
  - `pdfFileBase64String` string, nullable — The pdf file to add text to, as Base64 encoded string.
  - `options` PdfWriteStringOptions — Options for writing string in pdf page;
    - `text` string, nullable — The text to write in the pdf
    - `textColor` ColorDto — Set color
      - `r` integer — Get or sets R value of RGB color
      - `g` integer — Get or sets G value of RGB color
      - `b` integer — Get or sets B value of RGB color
    - `font` FontDto — The Font dto object
      - `name` string, nullable — Gets the name of the font
      - `size` number, float — Gets the size of the font
      - `style` 0 | 1 | 2 | 3 — Font style enum representing Regular, Bold, Italic, BoldItalic
    - `pageNumber` integer — Get or set which page in the pdf to write on, default is first page.
    - `xPosition` number, float — Get or set the X axis position on where to write string, in reference to XOrigin.
    - `yPosition` number, float — Get or set the Y axis position on where to write string, in reference to YOrigin.
    - `xOrigin` 0 | 1 | 2
    - `yOrigin` 0 | 1 | 2
  - `fontFileBase64String` string, nullable — 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.

## Response `200`

Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json

- PdfResponseDto — 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".
  - `errorMessage` string, nullable — If any error occurs the message will be displayed in here
  - `pdfFileBase64String` string, nullable — The Base64 encoded string that is the pdf file.

## Other responses

- `400` — If any error occurs parsing input
- `415` — If content-type of request is not set to multipart/form-data or application/json
- `429` — If you reach the monthly request limit for your subscription plan

---

[API](https://skmtc.net/pdfbroker/apis/pdfbroker-io-api.md) · [All operations](https://skmtc.net/pdfbroker/apis/pdfbroker-io-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pdfbroker/pdfbroker-io-api/versions/c10982b50857/schema)
