# PDF to Multiple Formats Conversion API Documentation


# PDF Parsing and Formatted Output API

> **Category**: Image Recognition  
> **Endpoint**: POST [https://api.gugudata.io/v1/imagerecognition/pdf2format?appkey={{appkey}}&type={{type}}](https://api.gugudata.io/v1/imagerecognition/pdf2format?appkey={{appkey}}&type={{type}})  
> **Description**: Supports output in TEXT, HTML, XML, and TAG formats.

## Overview

The **PDF Parsing and Formatted Output API** by [GuGuData](https://gugudata.io/) provides a convenient way to **convert PDF documents** into multiple output formats. Whether you need **TEXT**, **HTML**, **XML**, or **TAG** files, this API offers **millisecond-level** parsing performance for standard PDF files. Backed by **machine learning**, it continuously refines its **recognition accuracy** and handles files up to at least **1M** with impressive speed.

**Key highlights**:

- **Multiple format support** – Convert PDF to TEXT, HTML, XML, or TAG.
- **High accuracy** – Machine learning-driven improvements over time.
- **Fast performance** – Millisecond-level handling for typical PDF file sizes.
- **HTTPS/TLS** – Compatible with TLS v1.0–v1.3, fully Apple ATS-ready.
- **Nationwide multi-node CDN** – Ensures rapid response and reliability.

## Demo URL

[https://api.gugudata.io/v1/imagerecognition/pdf2format/demo](https://api.gugudata.io/v1/imagerecognition/pdf2format/demo)

## Request Parameters

Send a **POST** request to the endpoint, including both `appkey` and `type` in the query string, and attach the PDF file in the **form-data** body.

| **Parameter** | **Type** | **Required** | **Default Value** | **Description**                                                                 |
| :-----------: | :------: | :----------: | :---------------: | :------------------------------------------------------------------------------ |
|   `appkey`    | `string` |     Yes      |   `YOUR_APPKEY`   | Your APPKEY obtained from GuGuData's Developer Center (passed in query string). |
|    `type`     | `string` |     Yes      |   `YOUR_VALUE`    | The output format: `text`, `html`, `xml`, or `tag` (passed in query string).    |
|   `pdffile`   |  `file`  |     Yes      |   `YOUR_VALUE`    | The PDF file you wish to parse, uploaded in **form-data**.                      |

**Example**:

POST [https://api.gugudata.io/v1/imagerecognition/pdf2format?appkey={{appkey}}&type={{type}}](https://api.gugudata.io/v1/imagerecognition/pdf2format?appkey={{appkey}}&type={{type}})

Then attach the PDF file in the request body as form-data with the field name `pdffile`.

## Response Parameters

A successful request returns JSON with status info and parsed results. Key fields include:

|         **Parameter**          | **Type** | **Required** | **Description**                                                       |
| :----------------------------: | :------: | :----------: | :-------------------------------------------------------------------- |
|    `DataStatus.statusCode`     |  `int`   |     Yes      | The API response status code.                                         |
| `DataStatus.statusDescription` | `string` |     Yes      | A short description of the response status.                           |
| `DataStatus.responseDateTime`  | `string` |     Yes      | The timestamp for when the data was returned.                         |
|  `DataStatus.dataTotalCount`   |  `int`   |     Yes      | The total data count for this request, often used for pagination.     |
|         `Data.result`          | `string` |     Yes      | The parsed PDF data, in the format specified by the `type` parameter. |

## Error Codes

The table below lists potential error codes and their implications:

| **Error Code** |  **Error Content**   | **Notes**                                                          |
| :------------: | :------------------: | :----------------------------------------------------------------- |
|     `100`      |   Normal response    | Request successful.                                                |
|     `101`      |   Parameter error    | Check for missing or invalid parameters (e.g., `pdffile` missing). |
|     `102`      | Request rate limited | Exceeded 100 requests per second limit.                            |
|     `103`      |   Account overdue    | Requires payment or account reactivation.                          |
|     `104`      |    Invalid APPKEY    | Verify the APPKEY from your Developer Center.                      |
|     `110`      |  API response error  | A general error indicating unexpected API behavior.                |

## Features

1. **General recognition API** – Compatible with standard PDF files.
2. **Multiple format output** – TEXT, HTML, XML, or TAG.
3. **Perfect formatting in HTML** – Preserves layout for web-based usage.
4. **Machine learning** – Improved recognition accuracy over time.
5. **Fast recognition** – Processes 1M files in milliseconds.
6. **HTTPS (TLS 1.0–1.3)** – Secure data transmission.
7. **Apple ATS compatibility** – Ideal for iOS/macOS integrations.
8. **Multi-node CDN** – Consistent performance across diverse regions.
9. **Load-balanced** – Ensures swift responses even under heavy load.

## Additional Notes for Developers

- **File size**: For large PDFs, consider splitting them or optimizing them beforehand.
- **Formatting**: The HTML output provides near-original layout, making it ideal for display or conversions.
- **Mixed content**: Some PDFs contain images or vector text. Depending on the content, an OCR approach may be needed if the PDF lacks embedded text.

## Getting Started

1. **Sign up at [GuGuData.io](https://gugudata.io/)** – Acquire your `appkey`.
2. **Construct a POST request** – Include `appkey` and `type` in the query parameters; attach the PDF as `pdffile` in form-data.
3. **Parse the JSON response** – Read `Data.result` for the extracted data in your chosen format.
4. **Integrate** – Incorporate the parsed output into your data pipelines or applications.

## About GuGuData

[**GuGuData**](https://gugudata.io/) offers **enterprise-grade** data solutions and **powerful APIs** for a global audience. From [OCR services](https://gugudata.io/) to [SSL Certificate Parsing](https://gugudata.io/), our infrastructure handles large-scale requests with **speed and precision**.

**Key Highlights**:

- **Nine years in business** – Trusted by thousands of developers and organizations.
- **4.2k+ APIs** – A growing library of data-driven functionalities.
- **95% customer satisfaction** – Emphasis on reliability, performance, and user-centered design.

Use the **PDF Parsing and Formatted Output API** to **streamline** your PDF document workflows with immediate format-specific results. Visit [our official site](https://gugudata.io/) to discover more data solutions from GuGuData.

