> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/core/smart-data-extraction/document-structure.md).

# Document Structure Recognition

Apryse's Document Structure Recognition engine helps you capture the visual and logical layout of a document. Great for use with Accessibility tagging (e.g., reading order), screen reading tools, docu

{% hint style="info" %}
**Requirements**

*These packages are required to use these features in production. Trial keys have unlimited access to all features*

<a href="https://apryse.com/capabilities#SmartDataExtraction" class="button primary">Package: Smart Data Extraction</a><a href="/core/learn-more/modules.md#data-extraction-module" class="button primary">Module: Data Extraction</a><a href="https://showcase.apryse.com/document-structure-extraction" class="button primary">Live demo</a>
{% endhint %}

## Document Structure Recognition

Apryse's Document Structure Recognition engine helps you capture the visual and logical layout of a document. Unlike tabular extraction, this mode is designed to mimic how a human sees the page — recognizing paragraphs, lists, headers, footers, and images as distinct blocks.

It's ideal for use cases involving:

* Accessibility tagging (e.g., reading order)
* Screen reading tools
* Document reconstruction
* Visual layout parsing

### How It Works

The engine detects layout elements based on visual positioning, spacing, indentation, and structural boundaries. It separates:

* Paragraphs and lists
* Headers and footers
* Section columns vs table columns
* Tables embedded inside paragraphs
* Images and graphical elements

### JSON Output Specification

Refer to the following specifications to learn more about the output JSON format:

* [JSON Specification for Tabular Data and Document Structure](https://sdk.apryse.com/api/structurejson/index.html)

### Extract document structure as JSON file

Specify the name of the input PDF file and the name of the output JSON file, then select the Doc Structure engine:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
DataExtractionModule.ExtractData("paragraphs_and_tables.pdf", "paragraphs_and_tables.json", DataExtractionModule.DataExtractionEngine.e_doc_structure);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
DataExtractionModule::ExtractData("paragraphs_and_tables.pdf", "paragraphs_and_tables.json", DataExtractionModule::e_DocStructure);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
DataExtractionModuleExtractData("paragraphs_and_tables.pdf", "paragraphs_and_tables.json", DataExtractionModuleE_DocStructure)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
DataExtractionModule.extractData("paragraphs_and_tables.pdf", "paragraphs_and_tables.json", DataExtractionModule.DataExtractionEngine.e_doc_structure);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
await PDFNet.DataExtractionModule.extractData('paragraphs_and_tables.pdf', 'paragraphs_and_tables.json', PDFNet.DataExtractionModule.DataExtractionEngine.e_DocStructure);
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
DataExtractionModule::ExtractData("paragraphs_and_tables.pdf", "paragraphs_and_tables.json", DataExtractionModule::e_DocStructure);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
DataExtractionModule.ExtractData("paragraphs_and_tables.pdf", "paragraphs_and_tables.json", DataExtractionModule.e_DocStructure)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
DataExtractionModule.ExtractData("paragraphs_and_tables.pdf", "paragraphs_and_tables.json", DataExtractionModule::E_DocStructure)
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
DataExtractionModule.ExtractData("paragraphs_and_tables.pdf", "paragraphs_and_tables.json", DataExtractionModule.DataExtractionEngine.e_doc_structure)
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Extract document structure as JSON string

If you are going to parse the JSON right away, you may as well retrieve it as an in-memory string, instead of an external file.

Specify the name of the input PDF file, then select the Doc Structure engine:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
string json = DataExtractionModule.ExtractData("tagged.pdf", DataExtractionModule.DataExtractionEngine.e_doc_structure);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
UString json = DataExtractionModule::ExtractData("tagged.pdf", DataExtractionModule::e_DocStructure);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
json := DataExtractionModuleExtractData("tagged.pdf", DataExtractionModuleE_DocStructure).(string)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
String json = DataExtractionModule.extractData("tagged.pdf", DataExtractionModule.DataExtractionEngine.e_doc_structure);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const json = await PDFNet.DataExtractionModule.extractDataAsString('tagged.pdf', PDFNet.DataExtractionModule.DataExtractionEngine.e_DocStructure);
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$json = DataExtractionModule::ExtractData("tagged.pdf", DataExtractionModule::e_DocStructure);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
json = DataExtractionModule.ExtractData("tagged.pdf", DataExtractionModule.e_DocStructure)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
json = DataExtractionModule.ExtractData("tagged.pdf", DataExtractionModule::E_DocStructure)
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim json As String = DataExtractionModule.ExtractData("tagged.pdf", DataExtractionModule.DataExtractionEngine.e_doc_structure)
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Optional Configurations

[Select OCR Language](/core/smart-data-extraction/workflow.md#select-ocr-language)

[Password-Protected PDFs](/core/smart-data-extraction/workflow.md#specify-pdf-password)

[Page Range](/core/smart-data-extraction/workflow.md#select-a-page-range)

[Deep Learning Assist](/core/smart-data-extraction/workflow.md#deep-learning-assist)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/core/smart-data-extraction/document-structure.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
