How to Convert BMP to PDF with cURL
This tutorial shows you how to convert BMP to PDF with cURL through the Convert to PDF API Tool. You'll see how the upload, headers, operation fields, and JSON response fit together in a command that can convert BMP to PDF from a terminal or script.
Why Convert BMP to PDF with cURL?
BMP files still appear in equipment exports, legacy imaging systems, and older desktop workflows, but their large uncompressed images are inconvenient to distribute. Converting them to PDF gives downstream applications a familiar document format.
A manufacturing system, for example, might export a diagnostic diagram as BMP while a service portal expects every case artifact to be a PDF. A simple cURL conversion can normalize that image before it is merged into the customer record.
The filename supplied with the multipart upload identifies the source format. For that reason, the example uses a .bmp path rather than sending an extensionless file.
cURL Code Example
# By default, we use the US-based API service. This is the primary endpoint for global use. API_URL="https://api.pdfrest.com" # For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below. # For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work # API_URL="https://eu-api.pdfrest.com" curl -X POST "$API_URL/pdf" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ -F "file=@/path/to/input.bmp" \ -F "output=pdfrest_bmp_to_pdf"
Source for Convert BMP to PDF: View the cURL sample on GitHub. The repository's generic Convert to PDF scaffold is configured here with a .bmp input for this tutorial.
Breaking Down the Code
Choose the pdfRest service region
# By default, we use the US-based API service. This is the primary endpoint for global use. API_URL="https://api.pdfrest.com" # For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below. # For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work # API_URL="https://eu-api.pdfrest.com"
The BMP sample stores the selected pdfRest hostname in API_URL. Uncomment the EU value only when the BMP upload and every later request that uses its PDF output will remain in that same region.
Build the authenticated multipart request
curl -X POST "$API_URL/pdf" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
cURL posts the bitmap to /pdf and asks for a JSON result. The multipart header prepares the request for a binary file part, while Api-Key authorizes this BMP conversion.
Upload the input file data
-F "file=@/path/to/input.bmp" \
The Convert BMP to PDF request reads the local source from the path after @ and sends its bytes in the multipart file field. For Convert BMP to PDF, cURL treats the path as an upload rather than ordinary form text.
Set the operation-specific fields
-F "output=pdfrest_bmp_to_pdf"
The output field requests a recognizable base name for the PDF created from the BMP. The source extension, rather than another form setting, tells the shared endpoint which conversion path to use.
Read the generated resource response
curl -X POST "$API_URL/pdf" \
After BMP conversion, the JSON response identifies the new PDF with an output ID and download information. Capture that PDF resource data before using the result in a merge or another document operation.
Beyond the Tutorial
This walkthrough gives you a reusable cURL pattern for turning BMP output into a PDF resource that can participate in later merge, security, or document-management steps.
BMP inputs can be unusually large or have unexpected pixel dimensions. Test representative device exports and review the generated page orientation and image scale before automating a high-volume intake workflow.
Continue exploring the Convert BMP to PDF workflow in API Lab. For the complete Convert BMP to PDF request contract, accepted values, defaults, and limitations, consult the Convert to PDF API Tool documentation.
Note: The Convert BMP to PDF example above uploads a file with multipart form data. For source content already stored in pdfRest, the Convert BMP to PDF JSON payload example shows the resource-ID request shape.