orator-conversion 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,146 @@
1
+ # API Reference
2
+
3
+ ## Class: OratorFileTranslation
4
+
5
+ Extends `fable-serviceproviderbase`. Provides file format conversion
6
+ endpoints for an Orator web server.
7
+
8
+ ### Constructor
9
+
10
+ ```javascript
11
+ new OratorFileTranslation(pFable, pOptions, pServiceHash)
12
+ ```
13
+
14
+ | Parameter | Type | Description |
15
+ |-----------|------|-------------|
16
+ | `pFable` | object | The Fable instance for the application |
17
+ | `pOptions` | object | Configuration options (see [Configuration](configuration.md)) |
18
+ | `pServiceHash` | string | The service identifier hash |
19
+
20
+ Typically instantiated through the Fable service manager:
21
+
22
+ ```javascript
23
+ _Fable.serviceManager.addServiceType('OratorFileTranslation', libOratorFileTranslation);
24
+ _Fable.serviceManager.instantiateServiceProvider('OratorFileTranslation', {});
25
+ ```
26
+
27
+ ### Properties
28
+
29
+ | Property | Type | Default | Description |
30
+ |----------|------|---------|-------------|
31
+ | `serviceType` | string | `"OratorFileTranslation"` | Service type identifier |
32
+ | `RoutePrefix` | string | `"/conversion"` | URL prefix for all endpoints |
33
+ | `Version` | string | `"1.0"` | Version segment in route URLs |
34
+ | `LogLevel` | number | `0` | Logging verbosity |
35
+ | `MaxFileSize` | number | `10485760` | Maximum upload size in bytes |
36
+ | `PdftkPath` | string | `"pdftk"` | Path to the pdftk binary |
37
+ | `PdftoppmPath` | string | `"pdftoppm"` | Path to the pdftoppm binary |
38
+ | `converters` | object | `{}` | Registry of converter functions (populated by `initializeDefaultConverters`) |
39
+
40
+ ## Methods
41
+
42
+ ### connectRoutes()
43
+
44
+ Register POST endpoints on the Orator service server for each converter
45
+ in the registry. Call this after Orator has been started.
46
+
47
+ **Returns:** `boolean` - `true` if routes were registered, `false` if
48
+ Orator is not available.
49
+
50
+ ```javascript
51
+ _Fable.Orator.startService(
52
+ () =>
53
+ {
54
+ _Fable.OratorFileTranslation.connectRoutes();
55
+ });
56
+ ```
57
+
58
+ Routes are versioned: `{RoutePrefix}/{Version}/{converterPath}`
59
+
60
+ ### addConverter(pPath, fConverter)
61
+
62
+ Register a custom converter function for a given path segment. The path
63
+ becomes part of the endpoint URL. Call this before `connectRoutes()`.
64
+
65
+ | Parameter | Type | Description |
66
+ |-----------|------|-------------|
67
+ | `pPath` | string | Path segment (e.g. `'image/jpg-to-png'` or `'pdf-to-page-png/:Page'`) |
68
+ | `fConverter` | function | Converter function |
69
+
70
+ The converter function signature is:
71
+
72
+ ```javascript
73
+ function(pInputBuffer, pRequest, fCallback)
74
+ ```
75
+
76
+ | Parameter | Type | Description |
77
+ |-----------|------|-------------|
78
+ | `pInputBuffer` | Buffer | The raw file data from the request body |
79
+ | `pRequest` | object | The HTTP request object (use `pRequest.params` for route parameters) |
80
+ | `fCallback` | function | Callback: `fCallback(pError, pOutputBuffer, pContentType)` |
81
+
82
+ **Example:**
83
+
84
+ ```javascript
85
+ _Fable.OratorFileTranslation.addConverter('document/csv-to-json',
86
+ (pInputBuffer, pRequest, fCallback) =>
87
+ {
88
+ let tmpCSV = pInputBuffer.toString('utf8');
89
+ let tmpJSON = convertCSVToJSON(tmpCSV);
90
+ return fCallback(null, Buffer.from(JSON.stringify(tmpJSON)), 'application/json');
91
+ });
92
+ ```
93
+
94
+ ### initializeDefaultConverters()
95
+
96
+ Register the built-in converters (JPG to PNG, PNG to JPG, PDF to Page PNG,
97
+ PDF to Page JPG). Called automatically by the constructor.
98
+
99
+ ### collectRequestBody(pRequest, fCallback)
100
+
101
+ Collect the raw request body from the HTTP stream, enforcing the
102
+ MaxFileSize limit.
103
+
104
+ | Parameter | Type | Description |
105
+ |-----------|------|-------------|
106
+ | `pRequest` | object | The incoming HTTP request |
107
+ | `fCallback` | function | Callback: `fCallback(pError, pBuffer)` |
108
+
109
+ If the request body has already been parsed as a Buffer (e.g. by a body
110
+ parser middleware), it is used directly. Otherwise the body is collected
111
+ from the stream.
112
+
113
+ ### extractPdfPage(pPdfBuffer, pPageNumber, fCallback)
114
+
115
+ Extract a single page from a PDF buffer using pdftk, returning the
116
+ single-page PDF as a buffer.
117
+
118
+ | Parameter | Type | Description |
119
+ |-----------|------|-------------|
120
+ | `pPdfBuffer` | Buffer | The input PDF buffer |
121
+ | `pPageNumber` | number | The 1-based page number to extract |
122
+ | `fCallback` | function | Callback: `fCallback(pError, pSinglePagePdfBuffer)` |
123
+
124
+ Requires `pdftk` to be installed and accessible at the configured
125
+ `PdftkPath`.
126
+
127
+ ### renderPdfPageToImage(pPdfBuffer, pPageNumber, pFormat, fCallback)
128
+
129
+ Render a specific page of a PDF to an image buffer. Uses pdftoppm to
130
+ rasterize the page at 150 DPI.
131
+
132
+ | Parameter | Type | Description |
133
+ |-----------|------|-------------|
134
+ | `pPdfBuffer` | Buffer | The input PDF buffer |
135
+ | `pPageNumber` | number | The 1-based page number to render |
136
+ | `pFormat` | string | Output format: `'png'` or `'jpeg'` |
137
+ | `fCallback` | function | Callback: `fCallback(pError, pImageBuffer)` |
138
+
139
+ Requires `pdftoppm` to be installed and accessible at the configured
140
+ `PdftoppmPath`.
141
+
142
+ ## Related Documentation
143
+
144
+ - [Getting Started](getting-started.md) - Setup and installation
145
+ - [Configuration](configuration.md) - All configuration options
146
+ - [Endpoints](endpoints/) - Built-in endpoint reference
@@ -0,0 +1,77 @@
1
+ # Configuration
2
+
3
+ ## Constructor Options
4
+
5
+ Pass options when instantiating the service:
6
+
7
+ ```javascript
8
+ _Fable.serviceManager.instantiateServiceProvider('OratorFileTranslation',
9
+ {
10
+ RoutePrefix: '/api/convert',
11
+ Version: '2.0',
12
+ LogLevel: 2,
13
+ MaxFileSize: 5 * 1024 * 1024, // 5MB
14
+ PdftkPath: '/usr/local/bin/pdftk',
15
+ PdftoppmPath: '/usr/local/bin/pdftoppm'
16
+ });
17
+ ```
18
+
19
+ | Setting | Type | Default | Description |
20
+ |---------|------|---------|-------------|
21
+ | `RoutePrefix` | string | `"/conversion"` | URL prefix for all conversion endpoints |
22
+ | `Version` | string | `"1.0"` | Version segment in route URLs |
23
+ | `LogLevel` | number | `0` | Logging verbosity (0 = quiet, higher = more output) |
24
+ | `MaxFileSize` | number | `10485760` | Maximum upload size in bytes (default 10MB) |
25
+ | `PdftkPath` | string | `"pdftk"` | Path to the pdftk binary |
26
+ | `PdftoppmPath` | string | `"pdftoppm"` | Path to the pdftoppm binary |
27
+
28
+ ## Fable Settings Fallback
29
+
30
+ When options are not provided, the service checks Fable settings:
31
+
32
+ ```javascript
33
+ const _Fable = new libFable({
34
+ Product: 'MyServer',
35
+ APIServerPort: 8080,
36
+ OratorFileTranslationRoutePrefix: '/api/convert',
37
+ OratorFileTranslationVersion: '2.0',
38
+ OratorFileTranslationLogLevel: 1,
39
+ OratorFileTranslationMaxFileSize: 20 * 1024 * 1024,
40
+ OratorFileTranslationPdftkPath: '/usr/local/bin/pdftk',
41
+ OratorFileTranslationPdftoppmPath: '/usr/local/bin/pdftoppm'
42
+ });
43
+ ```
44
+
45
+ | Fable Setting | Maps To |
46
+ |---------------|---------|
47
+ | `OratorFileTranslationRoutePrefix` | `RoutePrefix` |
48
+ | `OratorFileTranslationVersion` | `Version` |
49
+ | `OratorFileTranslationLogLevel` | `LogLevel` |
50
+ | `OratorFileTranslationMaxFileSize` | `MaxFileSize` |
51
+ | `OratorFileTranslationPdftkPath` | `PdftkPath` |
52
+ | `OratorFileTranslationPdftoppmPath` | `PdftoppmPath` |
53
+
54
+ ## Configuration Priority
55
+
56
+ Settings are resolved in this order:
57
+
58
+ 1. **Constructor options** (highest priority)
59
+ 2. **Fable settings**
60
+ 3. **Default values** (lowest priority)
61
+
62
+ ## JSON Configuration File
63
+
64
+ When using a Fable configuration file:
65
+
66
+ ```json
67
+ {
68
+ "Product": "MyConversionServer",
69
+ "APIServerPort": 8080,
70
+ "OratorFileTranslationRoutePrefix": "/conversion",
71
+ "OratorFileTranslationVersion": "1.0",
72
+ "OratorFileTranslationLogLevel": 0,
73
+ "OratorFileTranslationMaxFileSize": 10485760,
74
+ "OratorFileTranslationPdftkPath": "pdftk",
75
+ "OratorFileTranslationPdftoppmPath": "pdftoppm"
76
+ }
77
+ ```
package/docs/cover.md ADDED
@@ -0,0 +1,13 @@
1
+ # Orator File Translation <small>1</small>
2
+
3
+ > File format conversion endpoints for Orator service servers
4
+
5
+ - Built-in image conversion (JPG to PNG, PNG to JPG)
6
+ - PDF page extraction (PDF to PNG, PDF to JPEG)
7
+ - Versioned route endpoints
8
+ - Extensible converter registry
9
+ - Configurable via options or Fable settings
10
+ - Size-limited uploads for safety
11
+
12
+ [GitHub](https://github.com/stevenvelozo/orator-conversion)
13
+ [Get Started](#orator-file-translation)
@@ -0,0 +1,60 @@
1
+ # JPG to PNG
2
+
3
+ The JPG to PNG endpoint converts JPEG images to PNG format using the
4
+ Sharp image processing library.
5
+
6
+ ## Endpoint Information
7
+
8
+ | Property | Value |
9
+ |----------|-------|
10
+ | Method | `POST` |
11
+ | Default Route | `/conversion/1.0/image/jpg-to-png` |
12
+ | Converter Path | `image/jpg-to-png` |
13
+ | Input Content Type | `application/octet-stream` |
14
+ | Output Content Type | `image/png` |
15
+
16
+ ## Usage
17
+
18
+ ```bash
19
+ curl -X POST --data-binary @photo.jpg \
20
+ -H "Content-Type: application/octet-stream" \
21
+ http://localhost:8080/conversion/1.0/image/jpg-to-png \
22
+ -o photo.png
23
+ ```
24
+
25
+ ## How It Works
26
+
27
+ 1. The client sends a JPEG image as raw binary data in the POST body
28
+ 2. The service collects the request body and validates the file size
29
+ 3. Sharp decodes the JPEG buffer and re-encodes it as PNG
30
+ 4. The PNG buffer is returned with `Content-Type: image/png`
31
+
32
+ ## Response
33
+
34
+ ### Success (200)
35
+
36
+ Returns the converted PNG image as binary data.
37
+
38
+ | Header | Value |
39
+ |--------|-------|
40
+ | `Content-Type` | `image/png` |
41
+ | `Content-Length` | Size of the PNG output in bytes |
42
+
43
+ ### Error Responses
44
+
45
+ | Status | Condition | Response Body |
46
+ |--------|-----------|---------------|
47
+ | 400 | Empty request body | `{"error": "No file data provided in request body."}` |
48
+ | 413 | File exceeds MaxFileSize | `{"error": "File size exceeds maximum allowed size of ... bytes."}` |
49
+ | 500 | Invalid image data | `{"error": "Conversion failed: ..."}` |
50
+
51
+ ## Notes
52
+
53
+ - PNG output is lossless, so the output file will typically be larger than the JPEG input
54
+ - The conversion preserves image dimensions and color data
55
+ - Transparent pixels are not present in JPEG input, so the output PNG will have no transparency
56
+
57
+ ## Related Documentation
58
+
59
+ - [PNG to JPG](002-png-to-jpg.md) - The reverse conversion
60
+ - [Configuration](../configuration.md) - MaxFileSize and route settings
@@ -0,0 +1,60 @@
1
+ # PNG to JPG
2
+
3
+ The PNG to JPG endpoint converts PNG images to JPEG format using the
4
+ Sharp image processing library.
5
+
6
+ ## Endpoint Information
7
+
8
+ | Property | Value |
9
+ |----------|-------|
10
+ | Method | `POST` |
11
+ | Default Route | `/conversion/1.0/image/png-to-jpg` |
12
+ | Converter Path | `image/png-to-jpg` |
13
+ | Input Content Type | `application/octet-stream` |
14
+ | Output Content Type | `image/jpeg` |
15
+
16
+ ## Usage
17
+
18
+ ```bash
19
+ curl -X POST --data-binary @image.png \
20
+ -H "Content-Type: application/octet-stream" \
21
+ http://localhost:8080/conversion/1.0/image/png-to-jpg \
22
+ -o image.jpg
23
+ ```
24
+
25
+ ## How It Works
26
+
27
+ 1. The client sends a PNG image as raw binary data in the POST body
28
+ 2. The service collects the request body and validates the file size
29
+ 3. Sharp decodes the PNG buffer and re-encodes it as JPEG
30
+ 4. The JPEG buffer is returned with `Content-Type: image/jpeg`
31
+
32
+ ## Response
33
+
34
+ ### Success (200)
35
+
36
+ Returns the converted JPEG image as binary data.
37
+
38
+ | Header | Value |
39
+ |--------|-------|
40
+ | `Content-Type` | `image/jpeg` |
41
+ | `Content-Length` | Size of the JPEG output in bytes |
42
+
43
+ ### Error Responses
44
+
45
+ | Status | Condition | Response Body |
46
+ |--------|-----------|---------------|
47
+ | 400 | Empty request body | `{"error": "No file data provided in request body."}` |
48
+ | 413 | File exceeds MaxFileSize | `{"error": "File size exceeds maximum allowed size of ... bytes."}` |
49
+ | 500 | Invalid image data | `{"error": "Conversion failed: ..."}` |
50
+
51
+ ## Notes
52
+
53
+ - JPEG is a lossy format, so some image quality is lost during conversion
54
+ - Any transparency in the PNG input will be flattened (alpha channel is removed)
55
+ - The output file will typically be smaller than the PNG input
56
+
57
+ ## Related Documentation
58
+
59
+ - [JPG to PNG](001-jpg-to-png.md) - The reverse conversion
60
+ - [Configuration](../configuration.md) - MaxFileSize and route settings
@@ -0,0 +1,93 @@
1
+ # PDF to Page PNG
2
+
3
+ The PDF to Page PNG endpoint extracts a single page from a PDF document
4
+ and renders it as a PNG image using pdftoppm.
5
+
6
+ ## Endpoint Information
7
+
8
+ | Property | Value |
9
+ |----------|-------|
10
+ | Method | `POST` |
11
+ | Default Route | `/conversion/1.0/pdf-to-page-png/:Page` |
12
+ | Converter Path | `pdf-to-page-png/:Page` |
13
+ | Input Content Type | `application/octet-stream` |
14
+ | Output Content Type | `image/png` |
15
+
16
+ ## Usage
17
+
18
+ ```bash
19
+ # Extract page 1
20
+ curl -X POST --data-binary @document.pdf \
21
+ -H "Content-Type: application/octet-stream" \
22
+ http://localhost:8080/conversion/1.0/pdf-to-page-png/1 \
23
+ -o page1.png
24
+
25
+ # Extract page 5
26
+ curl -X POST --data-binary @document.pdf \
27
+ -H "Content-Type: application/octet-stream" \
28
+ http://localhost:8080/conversion/1.0/pdf-to-page-png/5 \
29
+ -o page5.png
30
+ ```
31
+
32
+ ## Route Parameters
33
+
34
+ | Parameter | Type | Description |
35
+ |-----------|------|-------------|
36
+ | `:Page` | integer | The 1-based page number to extract (must be >= 1) |
37
+
38
+ ## How It Works
39
+
40
+ 1. The client sends a PDF file as raw binary data in the POST body
41
+ 2. The page number is parsed from the URL parameter
42
+ 3. The PDF buffer is written to a temporary file
43
+ 4. `pdftoppm` renders the specified page at 150 DPI as PNG
44
+ 5. The PNG output is read back into a buffer
45
+ 6. Temporary files are cleaned up
46
+ 7. The PNG buffer is returned with `Content-Type: image/png`
47
+
48
+ ## System Dependencies
49
+
50
+ This endpoint requires `pdftoppm` from the poppler-utils package:
51
+
52
+ ```bash
53
+ # macOS
54
+ brew install poppler
55
+
56
+ # Debian/Ubuntu
57
+ apt-get install poppler-utils
58
+ ```
59
+
60
+ The path to pdftoppm can be configured via the `PdftoppmPath` setting.
61
+
62
+ ## Response
63
+
64
+ ### Success (200)
65
+
66
+ Returns the rendered page as a PNG image.
67
+
68
+ | Header | Value |
69
+ |--------|-------|
70
+ | `Content-Type` | `image/png` |
71
+ | `Content-Length` | Size of the PNG output in bytes |
72
+
73
+ ### Error Responses
74
+
75
+ | Status | Condition | Response Body |
76
+ |--------|-----------|---------------|
77
+ | 400 | Empty request body | `{"error": "No file data provided in request body."}` |
78
+ | 413 | File exceeds MaxFileSize | `{"error": "File size exceeds maximum allowed size of ... bytes."}` |
79
+ | 500 | Invalid page number (0, negative, or non-integer) | `{"error": "Conversion failed: Invalid page number. Must be a positive integer."}` |
80
+ | 500 | Page number exceeds document page count | `{"error": "Conversion failed: pdftoppm failed: ..."}` |
81
+ | 500 | Invalid PDF data | `{"error": "Conversion failed: pdftoppm failed: ..."}` |
82
+
83
+ ## Notes
84
+
85
+ - Pages are rendered at 150 DPI by default
86
+ - The rendering process has a 30-second timeout
87
+ - Page numbering is 1-based (first page is 1, not 0)
88
+ - Temporary files are created in the system temp directory and cleaned up after each request
89
+
90
+ ## Related Documentation
91
+
92
+ - [PDF to Page JPG](004-pdf-to-page-jpg.md) - Same extraction in JPEG format
93
+ - [Configuration](../configuration.md) - PdftoppmPath and MaxFileSize settings
@@ -0,0 +1,94 @@
1
+ # PDF to Page JPG
2
+
3
+ The PDF to Page JPG endpoint extracts a single page from a PDF document
4
+ and renders it as a JPEG image using pdftoppm.
5
+
6
+ ## Endpoint Information
7
+
8
+ | Property | Value |
9
+ |----------|-------|
10
+ | Method | `POST` |
11
+ | Default Route | `/conversion/1.0/pdf-to-page-jpg/:Page` |
12
+ | Converter Path | `pdf-to-page-jpg/:Page` |
13
+ | Input Content Type | `application/octet-stream` |
14
+ | Output Content Type | `image/jpeg` |
15
+
16
+ ## Usage
17
+
18
+ ```bash
19
+ # Extract page 1
20
+ curl -X POST --data-binary @document.pdf \
21
+ -H "Content-Type: application/octet-stream" \
22
+ http://localhost:8080/conversion/1.0/pdf-to-page-jpg/1 \
23
+ -o page1.jpg
24
+
25
+ # Extract page 3
26
+ curl -X POST --data-binary @document.pdf \
27
+ -H "Content-Type: application/octet-stream" \
28
+ http://localhost:8080/conversion/1.0/pdf-to-page-jpg/3 \
29
+ -o page3.jpg
30
+ ```
31
+
32
+ ## Route Parameters
33
+
34
+ | Parameter | Type | Description |
35
+ |-----------|------|-------------|
36
+ | `:Page` | integer | The 1-based page number to extract (must be >= 1) |
37
+
38
+ ## How It Works
39
+
40
+ 1. The client sends a PDF file as raw binary data in the POST body
41
+ 2. The page number is parsed from the URL parameter
42
+ 3. The PDF buffer is written to a temporary file
43
+ 4. `pdftoppm` renders the specified page at 150 DPI as JPEG
44
+ 5. The JPEG output is read back into a buffer
45
+ 6. Temporary files are cleaned up
46
+ 7. The JPEG buffer is returned with `Content-Type: image/jpeg`
47
+
48
+ ## System Dependencies
49
+
50
+ This endpoint requires `pdftoppm` from the poppler-utils package:
51
+
52
+ ```bash
53
+ # macOS
54
+ brew install poppler
55
+
56
+ # Debian/Ubuntu
57
+ apt-get install poppler-utils
58
+ ```
59
+
60
+ The path to pdftoppm can be configured via the `PdftoppmPath` setting.
61
+
62
+ ## Response
63
+
64
+ ### Success (200)
65
+
66
+ Returns the rendered page as a JPEG image.
67
+
68
+ | Header | Value |
69
+ |--------|-------|
70
+ | `Content-Type` | `image/jpeg` |
71
+ | `Content-Length` | Size of the JPEG output in bytes |
72
+
73
+ ### Error Responses
74
+
75
+ | Status | Condition | Response Body |
76
+ |--------|-----------|---------------|
77
+ | 400 | Empty request body | `{"error": "No file data provided in request body."}` |
78
+ | 413 | File exceeds MaxFileSize | `{"error": "File size exceeds maximum allowed size of ... bytes."}` |
79
+ | 500 | Invalid page number (0, negative, or non-integer) | `{"error": "Conversion failed: Invalid page number. Must be a positive integer."}` |
80
+ | 500 | Page number exceeds document page count | `{"error": "Conversion failed: pdftoppm failed: ..."}` |
81
+ | 500 | Invalid PDF data | `{"error": "Conversion failed: pdftoppm failed: ..."}` |
82
+
83
+ ## Notes
84
+
85
+ - Pages are rendered at 150 DPI by default
86
+ - JPEG output will be smaller than the equivalent PNG but with lossy compression
87
+ - The rendering process has a 30-second timeout
88
+ - Page numbering is 1-based (first page is 1, not 0)
89
+ - Temporary files are created in the system temp directory and cleaned up after each request
90
+
91
+ ## Related Documentation
92
+
93
+ - [PDF to Page PNG](003-pdf-to-page-png.md) - Same extraction in PNG format
94
+ - [Configuration](../configuration.md) - PdftoppmPath and MaxFileSize settings
@@ -0,0 +1,75 @@
1
+ # Endpoints
2
+
3
+ Orator File Translation registers HTTP POST endpoints for file format
4
+ conversion. Each endpoint accepts raw binary data in the request body
5
+ and returns the converted file in the response.
6
+
7
+ ## Endpoint Reference
8
+
9
+ | # | Endpoint | Input | Output | Description |
10
+ |---|----------|-------|--------|-------------|
11
+ | 001 | [JPG to PNG](001-jpg-to-png.md) | JPEG image | PNG image | Convert JPEG images to PNG format |
12
+ | 002 | [PNG to JPG](002-png-to-jpg.md) | PNG image | JPEG image | Convert PNG images to JPEG format |
13
+ | 003 | [PDF to Page PNG](003-pdf-to-page-png.md) | PDF document | PNG image | Extract a PDF page as a PNG image |
14
+ | 004 | [PDF to Page JPG](004-pdf-to-page-jpg.md) | PDF document | JPEG image | Extract a PDF page as a JPEG image |
15
+
16
+ ## Endpoint Categories
17
+
18
+ ### Image Conversion
19
+
20
+ Convert between common image formats using Sharp:
21
+
22
+ - **[JPG to PNG](001-jpg-to-png.md)** - Lossless output from lossy input
23
+ - **[PNG to JPG](002-png-to-jpg.md)** - Lossy compression from lossless input
24
+
25
+ ### PDF Page Extraction
26
+
27
+ Extract individual pages from PDF documents as images using pdftoppm:
28
+
29
+ - **[PDF to Page PNG](003-pdf-to-page-png.md)** - Lossless page extraction
30
+ - **[PDF to Page JPG](004-pdf-to-page-jpg.md)** - Lossy page extraction
31
+
32
+ ## Route Structure
33
+
34
+ All endpoints follow the same versioned route pattern:
35
+
36
+ ```
37
+ POST {RoutePrefix}/{Version}/{converterPath}
38
+ ```
39
+
40
+ With default settings this becomes:
41
+
42
+ ```
43
+ POST /conversion/1.0/{converterPath}
44
+ ```
45
+
46
+ ## Common Request Format
47
+
48
+ All endpoints accept binary data via HTTP POST:
49
+
50
+ ```bash
51
+ curl -X POST --data-binary @inputfile \
52
+ -H "Content-Type: application/octet-stream" \
53
+ http://localhost:8080/conversion/1.0/{converterPath} \
54
+ -o outputfile
55
+ ```
56
+
57
+ ## Common Response Codes
58
+
59
+ | Status | Meaning |
60
+ |--------|---------|
61
+ | 200 | Conversion successful, response body contains the converted file |
62
+ | 400 | No file data provided in the request body |
63
+ | 413 | File exceeds the configured maximum file size |
64
+ | 500 | Conversion failed (invalid input data, missing dependencies, etc.) |
65
+
66
+ ## Custom Endpoints
67
+
68
+ You can register additional endpoints using `addConverter()`. See the
69
+ [API Reference](../api-reference.md) for details.
70
+
71
+ ## Related Documentation
72
+
73
+ - [Getting Started](../getting-started.md) - Setup and installation
74
+ - [Configuration](../configuration.md) - Route prefix, version, and size limits
75
+ - [API Reference](../api-reference.md) - Full method documentation