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

# Bounding Box Guide

> Understanding and calculating the position of a field within a document.

#### What is a Bounding Box?

In Nitro, a bounding box is the container of a signature field. The bounding box of a field is defined by the top-left coordinate of the rectangle and the size of the rectangle. Keep in mind that:

* Coordinates are expressed in points (pt).
* Size is expressed in points (pt).
* The origin of the document, or position (0,0), is located at the top-left corner.

<Accordion title="What is a point (pt)?">
  A point is a unit of measurement equal to 1/72 of an inch (approximately 0.3527 mm). Points are the standard unit for positioning and sizing elements in digital documents and are widely supported by image editing and document layout software.
</Accordion>

## The Bounding Box Array

In Nitro, the bounding box of a field is defined as an array with the format:

`[x, y, w, h]`

These values represent the starting coordinates of the bounding box and the size of the rectangle, as shown in the diagram below:

<Frame>
  <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/bounding-box-1.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=056e78430b1c8f712c6d9757a1032b36" alt="Diagram of bounding box" width="290" height="226" data-path="images/bounding-box-1.png" />
</Frame>

Where:

* `x`: The horizontal position of the first corner, measured from the left edge of the document.
* `y`: The vertical position of the first corner, measured from the top edge of the document.
* `w`: The width of the bounding box.
* `h`: The height of the bounding box.

## Bounding Box Example

To visualize a bounding box, let’s assume we are placing a field on a standard US Letter–sized document with dimensions `612 pt (width) × 792 pt (height)`.

In this document, the field is positioned using the following bounding box array:

```json theme={null}
{
  "boundingBox": [200, 300, 60, 40]
}
```

This bounding box translates to:

* The first corner of the field is located at 200 points from the left edge (x) and 300 points from the top edge (y) of the document.
* The field's box has a width of 60 pt and a height of 40 pt.

If we sketch this bounding box on our 612 pt × 792 pt document, the field would appear as shown in the diagram below:

<Frame>
  <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/pdf-position-size-points.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=05596ddd195d878f61b5671320fd115f" alt="Diagram of field position on pdf" width="658" height="767" data-path="images/pdf-position-size-points.png" />
</Frame>

## How can I find coordinates in my document?

The easiest way to determine the coordinates of a field is by using image or PDF visualization software.
Most PDF viewing and editing tools support points (pt) and allow you to inspect point-based coordinates within a document.

Below are a few software-specific instructions for locating the position of fields in your document.
Keep in mind that this is not a comprehensive list.

<Accordion title="Nitro PDF - Windows">
  Nitro PDF is available for Windows. You can download it in the user portal.

  <Steps>
    <Step title="Open a document">
      Open a PDF document with Nitro PDF.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-win-open.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=0bf195024701c3c5af49648eef67b008" alt="Nitro PDF Windows open file menu" width="2560" height="1440" data-path="images/nitro-pdf-win-open.png" />
      </Frame>
    </Step>

    <Step title="Set Points as measuring unit">
      Make sure the measuring unit in Nitro PDF is set to Points. To do this:

      * Go to `File` tab in the navigation menu and select `Preferences` in the left panel. A preferences window will open.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-win-preference.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=ca9a068208428ae89311dd74891b922f" alt="Nitro PDF preferences menu" width="2560" height="1440" data-path="images/nitro-pdf-win-preference.png" />
      </Frame>

      * In the `Preferences` window, select `Units and Grid` from the left panel.
      * In the `Units` section, set `Default Units` to `Points` from the dropdown menu.
      * Click `Apply` to save your changes.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-win-units.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=f28fadd47aad22120192943f86a0a252" alt="Preview Nitro PDF open file menu" width="2560" height="1440" data-path="images/nitro-pdf-win-units.png" />
      </Frame>
    </Step>

    <Step title="Select Crop tool (add it if needed)">
      To measure the bounding box dimensions, use the Crop tool. If it is available in your tools menu, select it.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-win-crop-select.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=97e9173b3dda32636809bebedd3b7c91" alt="Nitro PDF Windows Crop tool" width="2560" height="1440" data-path="images/nitro-pdf-win-crop-select.png" />
      </Frame>

      If the Crop tool is not available, you will need to add it:

      * Go to the `Home` tab in the navigation menu.
      * Click `Add Tools` or `Customize Tools` <Icon icon="plus" size={16} color="gray" /> in the upper-right corner of the application. A customization window will appear.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-win-add-tool.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=e709730901731b2272206081ea010793" alt="Nitro PDF Windows Add Tool" width="2560" height="1440" data-path="images/nitro-pdf-win-add-tool.png" />
      </Frame>

      * In the search bar, type `Crop` and click `Search`.
      * Select `Crop` from the results and add it to your `Favorite` tools.
      * Click `OK`. The `Crop` tool will now appear in your tools menu.
      * Select the `Crop` tool to activate it.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-win-crop.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=a586af8cdf8869df51a0cc7e907ad449" alt="Preview Nitro PDF open file menu" width="2560" height="1440" data-path="images/nitro-pdf-win-crop.png" />
      </Frame>
    </Step>

    <Step title="Draw the field rectangle with the Crop tool">
      Using the **Crop tool**, draw a rectangle over the area of the document where you want the field to appear.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-win-box.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=2e051cfe74e8f23b077158e067829721" alt="Nitro PDF Windows Rectangle" width="2560" height="1440" data-path="images/nitro-pdf-win-box.png" />
      </Frame>
    </Step>

    <Step title="Get the coordinates of the first corner of the rectangle">
      When you draw a box with the Nitro PDF **Crop** tool, it will display a series of measurements.

      To obtain the first corner (`x`, `y`) of your rectangle:

      * The **left-side** measurement corresponds to `x`.
        * Example: `228.2 pt`
      * The **top-side** measurement corresponds to `y`.
        * Example: `637.8 pt`

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-win-box-1-1.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=06d144d81f693accb21083767d41ff47" alt="Nitro PDF first coordinate measurement" width="2560" height="1440" data-path="images/nitro-pdf-win-box-1-1.png" />
      </Frame>
    </Step>

    <Step title="Get the rectangle's size">
      Using the same measurements from the **Crop** tool.

      * First, note the **width** measurement of the rectangle.
        * Example: `w = 168.15 pt`
      * Next, note the **height** measurement of the rectangle.
        * Example: `h = 35.27 pt`

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-win-box-2.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=91fb2473c8104e3038750079ea433936" alt="Nitro PDF second coordinate measurement" width="2560" height="1440" data-path="images/nitro-pdf-win-box-2.png" />
      </Frame>
    </Step>

    <Step title="Define the bounding box array">
      Given the measurements from the example above, the bounding box array to use in the **Create Field** API call is:

      ```json theme={null}
        "boundingBox": [228.2, 637.8, 168.15, 35.27]
      ```
    </Step>
  </Steps>
</Accordion>

<Accordion title="Nitro PDF - Mac OS">
  Nitro PDF is available for Mac OS. You can download it in the user portal.

  <Steps>
    <Step title="Open a document">
      Open a PDF document with Nitro PDF.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-open-file.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=8801d0779e094b4229ecd4fc98ad57dd" alt="Preview Nitro PDF open file menu" width="1363" height="968" data-path="images/nitro-pdf-open-file.png" />
      </Frame>
    </Step>

    <Step title="Get the document's dimensions">
      The first step after opening the document is to click on the **Inspector** <Icon icon="circle-info" size={16} color="gray" /> located in the top-right corner.

      In the floating window that appears, select the **Document Information** tab <Icon icon="file" size={16} color="gray" />.

      Take note of the document dimensions shown under **Page Size**.
      In the example, the document size is `595.3 pt x 841.9 pt`.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-inspector.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=aa1ca69555c2cd9c29b40b0988b3aa79" alt="Nitro PDF Document Info window" width="1920" height="1080" data-path="images/nitro-pdf-inspector.png" />
      </Frame>
    </Step>

    <Step title="Click the Select Rectangle tool">
      Scroll to the top of the Nitro PDF window until the tool menu expands. Then, click on the **Select Rectangle** tool <Icon icon="square-dashed" size={16} color="gray" />.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-crop.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=57e220ef7b752c62a6df9bbeb3008785" alt="Nitro PDF Select Rectangle tool" width="1920" height="1080" data-path="images/nitro-pdf-crop.png" />
      </Frame>
    </Step>

    <Step title="Draw the field rectangle with the Select Rectangle tool">
      Using the **Select Rectangle** tool, draw a rectangle over the area where you want the field to appear in the document.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-rectangle.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=785cef03bd2734a5472ea942514381e8" alt="Nitro PDF Rectangle" width="1920" height="1080" data-path="images/nitro-pdf-rectangle.png" />
      </Frame>
    </Step>

    <Step title="Get the coordinates of the first corner of the rectangle">
      When you draw a box with the Nitro PDF **Select Rectangle** tool, it will display a series of measurements.
      The zoomed-in view below shows an example of these values.

      To obtain the first corner (`x`, `y`) of your rectangle:

      * The **left-side** measurement corresponds to `x`.
        * Example: `204.7 pt`
      * The **top-side** measurement corresponds to `y`.
        * Example: `613.8 pt`

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-rectangle-zoom.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=43995a1d9fc69cfd321cb3d37f8afab7" alt="Nitro PDF first coordinate measurement" width="1920" height="1080" data-path="images/nitro-pdf-rectangle-zoom.png" />
      </Frame>
    </Step>

    <Step title="Get the coordinates of the opposing corner">
      Using the same measurements from the **Select Rectangle** tool, we can calculate the size of the rectangle.

      * First, note the **right-side** measurement of the rectangle. This is the distance from the rectangle to the right edge of the document.
        * Example: `217.8 pt`
      * Next, note the **bottom-side** measurement of the rectangle. This is the distance from the rectangle to the bottom edge of the document.
        * Example: `193.8 pt`

      Now, calculate the width and height:

      * **Formula for `w`:**
        `w = Document Width − Right-side distance - Left-Side distance`
        * `w = 595.3 pt − 217.8 pt - 204.7 pt`
        * `w = 172.8 pt`

      * **Formula for `h`:**
        `h = Document Height − Bottom-side distance - Top-side distance`
        * `h = 841.9 pt − 193.8 pt - 613.8`
        * `h = 34.3 pt`

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/nitro-pdf-rectangle-zoom-2.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=54f37aed467a3a5b48a0704ed4a8c8b6" alt="Nitro PDF first coordinate measurement" width="1920" height="1080" data-path="images/nitro-pdf-rectangle-zoom-2.png" />
      </Frame>

      <Note>Nitro PDF Pro displays the width and height along the inside edges of the rectangle, as long as the rectangle is large enough to show them.</Note>
    </Step>

    <Step title="Define the bounding box array">
      Given the measurements from the example above, the bounding box array to use in the **Create Field** API call is:

      ```json theme={null}
        "boundingBox": [204.7, 613.8, 172.8, 34.3]
      ```
    </Step>
  </Steps>
</Accordion>

<Accordion title="Preview - Mac OS">
  **Preview** is the built-in image viewer for macOS that allows you to easily identify point coordinates.

  For this example, we’ll use **Preview** on macOS (Version 11, build 1069). Keep in mind that behavior may vary across different software versions.

  <Steps>
    <Step title="Select the Crop tool">
      Open **Preview** and click the **Info** icon <Icon icon="circle-info" size={16} color="lightblue" />.
      In the floating menu, select the **Crop** tool <Icon icon="crop-simple" size={16} color="lightblue" />.

      In the floating window:

      * Select **Points** as the measuring unit from the dropdown.
      * Note the document size displayed under **Media Box**.

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/preview-dimensions.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=81b7959f8d6a821b6b33b6fbb02a7e5b" alt="Preview Crop tool" width="2520" height="1834" data-path="images/preview-dimensions.png" />
      </Frame>
    </Step>

    <Step title="Locate the upper-left corner of your field">
      Decide where in the document you want the field to be placed, then use the **Crop** tool to draw a box in that area.

      Next, go to **Info → Crop** window again.

      * In the **Selection** section of the floating menu, note the **top** and **left** measurements. These values will serve as the starting coordinates of your field `x, y`.
      * Note the Width and Height `w, h`

      <Frame>
        <img src="https://mintcdn.com/go-nitro/5Pd9EyI0tqmDavbr/images/bounding-box-width-height-1.png?fit=max&auto=format&n=5Pd9EyI0tqmDavbr&q=85&s=eb85935b36844de6168b0f2552c5bc77" alt="Screenshot of measurement of bottom-right corner" width="2524" height="1848" data-path="images/bounding-box-width-height-1.png" />
      </Frame>

      ```text theme={null}
      Example:
      x: **225.25**
      y: **700.51**
      w: **153.26**
      h: **40.36**
      ```
    </Step>

    <Step title="Define the bounding box array">
      Use the measurements above to construct your bounding box array.

      The bounding box parameter will look like this:

      ```json theme={null}
       "boundingBox": [225.25, 700.51, 153.26, 40.36]
      ```
    </Step>
  </Steps>
</Accordion>
