English
  1. Home
  2. Conversion
  3. ImagesToPdf

ImagesToPdf

Convert list of images to single PDF document

copy
Something went wrong, try again
copy
            
                    
        
Body parameter
Parameter VALUE DESCRIPTION

imagesToPdfRequest

Required

copy
ImagesToPdfRequest ImagesToPdfRequest instance
ImagesToPdfRequest
Parameter VALUE DESCRIPTION

ListImageBase64File

Required

close-icon
string[] List of Base64 encoded images

BottomMargin

Optional

double Bottom margin

LeftMargin

Optional

double Left margin

PageHeight

Optional

double PDF page height. Image height If not specified

PageWidth

Optional

double PDF page width. Image width If not specified

RightMargin

Optional

double Right margin

TopMargin

Optional

double Top Margin
copy Copy to clipboard
        
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.conholdate.cloud/v5.0/pdf/conversion/images-to-pdf"
  method := "POST"

  payload := strings.NewReader(`{
      "LeftMargin": 12.3,
      "RightMargin": 12.3,
      "TopMargin": 12.3,
      "BottomMargin": 12.3,
      "PageWidth": 12.3,
      "PageHeight": 12.3,
      "ListImageBase64File": ["Base64 encoded file...", "Base64 encoded file..."],
    }`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
                   
         
            

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, 
    "{" +
      "\"LeftMargin\": 12.3," +
      "\"RightMargin\": 12.3," +
      "\"TopMargin\": 12.3," +
      "\"BottomMargin\": 12.3," +
      "\"PageWidth\": 12.3," +
      "\"PageHeight\": 12.3," +
      "\"ListImageBase64File\": [\"Base64 encoded file...\", \"Base64 encoded file...\"]," +
    "}");

Request request = new Request.Builder()
  .url("https://api.conholdate.cloud/v5.0/pdf/conversion/images-to-pdf")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .build();

Response response = client.newCall(request).execute();
                   
        
            
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.conholdate.cloud/v5.0/pdf/conversion/images-to-pdf',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS =>'{
      "LeftMargin": 12.3,
      "RightMargin": 12.3,
      "TopMargin": 12.3,
      "BottomMargin": 12.3,
      "PageWidth": 12.3,
      "PageHeight": 12.3,
      "ListImageBase64File": ["Base64 encoded file...", "Base64 encoded file..."],
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
                   
        
            
import requests
import json

url = "https://api.conholdate.cloud/v5.0/pdf/conversion/images-to-pdf"

json_data = json.dumps({
      "LeftMargin": 12.3,
      "RightMargin": 12.3,
      "TopMargin": 12.3,
      "BottomMargin": 12.3,
      "PageWidth": 12.3,
      "PageHeight": 12.3,
      "ListImageBase64File": ["Base64 encoded file...", "Base64 encoded file..."],
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=json_data)

print(response.text)
                   
        
            
curl --location --request POST 'https://api.conholdate.cloud/v5.0/pdf/conversion/images-to-pdf' \
--header 'Content-Type: application/json' \
--data-raw '{
      "LeftMargin": 12.3,
      "RightMargin": 12.3,
      "TopMargin": 12.3,
      "BottomMargin": 12.3,
      "PageWidth": 12.3,
      "PageHeight": 12.3,
      "ListImageBase64File": ["Base64 encoded file...", "Base64 encoded file..."],
}'
                   
        
            
require "uri"
require "json"
require "net/http"

url = URI("https://api.conholdate.cloud/v5.0/pdf/conversion/images-to-pdf")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
      "LeftMargin": 12.3,
      "RightMargin": 12.3,
      "TopMargin": 12.3,
      "BottomMargin": 12.3,
      "PageWidth": 12.3,
      "PageHeight": 12.3,
      "ListImageBase64File": ["Base64 encoded file...", "Base64 encoded file..."],
})

response = https.request(request)
puts response.read_body

                   
        
            
var client = new RestClient("https://api.conholdate.cloud/v5.0/pdf/conversion/images-to-pdf");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
var body = "{" + 
      "\"LeftMargin\": 12.3," +
      "\"RightMargin\": 12.3," +
      "\"TopMargin\": 12.3," +
      "\"BottomMargin\": 12.3," +
      "\"PageWidth\": 12.3," +
      "\"PageHeight\": 12.3," +
      "\"ListImageBase64File\": [\"Base64 encoded file...\", \"Base64 encoded file...\"]," +
"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
                       
            
Overview

About ImagesToPdf Method

On this page, you will find instructions on how to use our cloud-based API to convert images to PDF in various programming languages such as Go, Java, PHP, Python, Curl, Ruby, and C#. Our API is designed to be user-friendly and can be easily integrated into your application with just a few lines of code.


Programming languages the API is compatible with

The API uses the REST protocol, making it compatible with a wide range of programming languages, including but not limited to: Go, Java, PHP, Python, Curl, Ruby, C#.

Easy to use

Our API Reference and Guide is designed to be straightforward and easy to use, providing all the information you need to get started quickly. Additionally, our API Libraries come with their own set of documentation, making integration into your application a breeze. With our comprehensive resources, you can efficiently leverage our API to meet your needs.

Secure

At our company, we place a high priority on your security and privacy. To protect your private data, we never store it in our environment and offer isolated options. We understand the importance of keeping your information safe and take all necessary measures to ensure that it remains secure.
Convert Image to PDF
clock
Add a File
To include the file in your project folder, locate the JPG file and rename it as "image.jpg". Alternatively, you can use the sample file provided. Please note that the file name is case-sensitive, so ensure that it matches exactly with the file name mentioned in the code example. If you are using our online services, ensure that the file to be processed is in the correct format before proceeding.
arrow
clock
Run the Code
To run the code, copy and paste it into your project. For further details, refer to our language-specific guides on how to get started. Or you can use method ImageToPdf online.
arrow
clock
View the Result
To view the results, open the file named result.pdf. This file should be located in your project folder.
clock
Is it safe to convert images using Conversion API?
We understand the importance of ensuring the safety and privacy of your data. Rest assured that our company takes extensive measures to protect your information. We do not store any files you submit for conversion and process them only to provide you with the converted results. Your security and confidentiality are our utmost priorities.
clock
How long does it takes to convert Images into PDF using Conversion API?
Conversion API is designed for efficient and speedy file conversion. With our service, you can expect fast results, often in just a matter of seconds.
clock
How can I convert images to PDF?
To convert an image to PDF, simply click the "Select file" button and initiate the conversion process by clicking the "POST" button. If you need to integrate this type of conversion into your project, you can easily copy and use the provided code examples in the programming language you are working with.
clock
What result will I get after converting the images?
After utilizing our Conversion API to convert images, you will receive a single PDF file as the output. This PDF file will contain the converted images, consolidated into a single PDF document.
FAQ

Frequently Asked Questions

We encourage you to review our Frequently Asked Questions (FAQ) section for answers to common inquiries. If you do not find the information you need, our dedicated support service is readily available to assist you with any additional questions or concerns. Don't hesitate to reach out for further assistance.