Convert anything to PDF


The API for converting any file to PDF.

Here you can see all available conversion options which you can use within the "options" section of conversions (see the example JSON below the table).

Here you can see all available conversion options which you can use within the "options" section of conversions (see the example JSON on the right).

Option Name Description
allow_copying
Type: boolean
Allows copying of the document
allow_modification
Type: boolean
Allows modification of the document
allow_multiple_outputs
Type: boolean
Default: False
If the conversion produces more than one output file, by default all of them are compressed in just one file. Set this option to true if you want a download link for each file.
allow_multiple_outputs_threshold
Type: integer
Minimum: 2
Maximum: 400
Sets the threshold for the number of output files during conversion. This option is considered only when `allow_multiple_outputs` is set to true. If the generated output files exceed this threshold, they are compressed into one file. Conversely, if the threshold is not met, each output file remains uncompressed.
allow_printing
Type: boolean
Allows printing of the document
color
Type: string
Enum: rgb cmyk gray
The color schema
compression
Type: string
Enum: basic strong
Selects the compression level of the converted file
custom_page_size_height
Type: string
The height of the pages. The unit has to be specified in the custom_page_size_unit field. For best precision if using inchs, please use 4 decimal digits.
custom_page_size_unit
Type: string
Enum: mm in
The unit of measurement of the pages.
custom_page_size_width
Type: string
The width of the pages. The unit has to be specified in the custom_page_size_unit field. For best precision if using inchs, please use 4 decimal digits.
deskew
Type: boolean
Deskew a PDF created with a scanner not correctly aligned with the original document
download_password
Type: string
Pattern: ^[ -~]{0,1000}$
Example: secret_password
A password to protect the download. To download the file send the password in the x-oc-download-password header or set a cookie named x-oc-download-password. The value contains a comma separated list of passwords.
dpi
Type: integer
Minimum: 10
Maximum: 1200
Horizontal and vertical density of images inside the document (referred to as DPI)
file_size
Type: integer
Minimum: True
Maximum: 1048576
Limit the target size of the file you want to convert to PDF to this size in Kbytes (KiB). We try to do our best to achieve this limit as close as possible.
filters
Type: array
Additionalproperties: False
Filter_name: string Remove_images: Remove_text: Remove_vectors: The name of the filter to apply.
grayscale
Type: boolean
Grayscale all images inside the PDF
images_quality
Type: integer
Minimum: 10
Maximum: 100
The quality of the embedded images (range from 10 to 100). 100 is the highest quality.
language
Type: string
Pattern: ^[a-zA-Z_,-]{3,128}$
Example: rus,eng,deu
Language for the source (using ISO 639-2/T standard). In case of multi language documents, a comma separated list of values without quotes or spaces can be used. Please note that both plain and script languages cannot be included at the same time. Supported values are: afr, amh, ara, asm, aze, aze_cyrl, bel, ben, bod, bos, bre, bul, cat, ceb, ces, chi_sim, chi_sim_vert, chi_tra, chi_tra_vert, chr, cos, cym, dan, deu, div, dzo, ell, eng, enm, epo, est, eus, fao, fas, fil, fin, fra, frk, frm, fry, gla, gle, glg, grc, guj, hat, heb, hin, hrv, hun, hye, iku, ind, isl, ita, ita_old, jav, jpn, jpn_vert, kan, kat, kat_old, kaz, khm, kir, kmr, kor, kor_vert, lao, lat, lav, lit, ltz, mal, mar, mkd, mlt, mon, mri, msa, mya, nep, nld, nor, oci, ori, pan, pol, por, pus, que, ron, rus, san, sin, slk, slv, snd, spa, spa_old, sqi, srp, srp_latn, sun, swa, swe, syr, tam, tat, tel, tgk, tha, tir, ton, tur, uig, ukr, urd, uzb, uzb_cyrl, vie, yid, yor, script-Arabic, script-Armenian, script-Bengali, script-Canadian_Aboriginal, script-Cherokee, script-Cyrillic, script-Devanagari, script-Ethiopic, script-Fraktur, script-Georgian, script-Greek, script-Gujarati, script-Gurmukhi, script-Hangul, script-Hangul_vert, script-HanS, script-HanS_vert, script-HanT, script-HanT_vert, script-Hebrew, script-Japanese, script-Japanese_vert, script-Kannada, script-Khmer, script-Lao, script-Latin, script-Malayalam, script-Myanmar, script-Oriya, script-Sinhala, script-Syriac, script-Tamil, script-Telugu, script-Thaana, script-Thai, script-Tibetan, script-Vietnamese
language_stt
Type: string
Enum: ar-AR ca-ES zh-CN cs-CZ de-DE el-GR en-IN en-US es-ES fa-IR fr-FR hi-IN it-IT ja-JP kk-KZ nl-NL pl-PL pt-FB sv-SE ru-RU tl-PH tr-TR uk-UA vi-VN
Language of the audio source
linearize
Type: boolean
Default: False
Optimizes the converted file for web visualization
merge
Type: boolean
Merges the input files in one output file using the same order as the files appear in the input section of the message.
new_owner_password
Type: string
Pattern: ^[\w\W]{0,64}$
Adds or changes the owner's password (up to 64 characters)
new_user_password
Type: string
Pattern: ^[\w\W]{0,64}$
Adds or changes the user's password (up to 64 characters)
ocr
Type: boolean
Optical character recognition
ocr_filter
Type: string
Enum: gray
Apply a filter to the input file. It may improve text detection.
ocr_filter_options
Object containing specific filter options.
ocr_page_structure
Type: string
Enum: auto single_column uniform_block_vertical uniform_text single_line single_word single_char unstructured raw_line
Page structure description to the OCR engine. It may help to have a better result. If your first attempt with automatic page structure detection fails or if you know in advance the structure of your pages, you can try with a more specific one.
one_file_per_page
Type: boolean
If set, the original document is split in more PDF files, one per page
output_filename
Type: string
Pattern: ^[\w\W]{0,255}$
Example: my_base_filename_without_extension
The desired file name of the converted file WITHOUT the file extension.
page_size
Type: string
Enum: a0 a1 a2 a3 a4 a4small a5 a6 a7 a8 a9 a10 isob0 isob1 isob2 isob3 isob4 isob5 isob6 c0 c1 c2 c3 c4 c5 c6 11x17 ledger legal letter lettersmall archA archB archC archD archE jisb0 jisb1 jisb2 jisb3 jisb4 jisb5 jisb6 b0 b1 b2 b3 b4 b5 flsa flse halfletter hagaki
The size of the pages
patch
Type: object
preset
Type: string
Pattern: ^[\w\W]{1,255}$
Predefined options
quality
Type: string
Enum: screen ebook default printer prepress minimum insane
Optimizes the output for a specific target which will produce different output file sizes. It may override other quality options.
rasterize_dpi
Type: integer
Minimum: 10
Maximum: 1200
The resulting document will contain images of the pages that have non-selectable text only. They will have the specified DPI value.
rearrange
Type: string
Pattern: ^(((\d+|first)-?(\d*|last))|(first)|(last)|(even)|(odd))(, ?(((\d+|first)-?(\d*|last))|(first)|(last)|(even)|(odd)))*$
The page numbers that should be present in the converted file, in the desired order. This is also used to delete pages or extract a set of pages.
rotate
Type: array
Additionalproperties: False
Pages: string ^(((\d+|first)-?(\d*|last))|(first)|(last)|(even)|(odd))(, ?(((\d+|first)-?(\d*|last))|(first)|(last)|(even)|(odd)))*$ The page numbers to be rotated. E.g. 5-8 or 5- or 5. It also accepts "first" and "last" aliases. 1-last 1
Angle: integer The angle by which to rotate the pages 0: 90: 180: 270: 0 1
split
Type: string
Pattern: ^((\d+-?\d*)(, ?(\d+-?\d*))*|all)$
The pages where to split the original file. E.g. in a 30 pages document, an entry of 10,20 will results in three output files with pages 1-10, 11-20, 21-30. It also accepts "all" to split all pages into separate files.
split_page_x
Type: integer
Minimum: 2
Maximum: 50
Split all the PDF pages in the specified number of parts along the horizontal axis. E.g. from one A4 landscape page to two A5 portrait pages.
split_page_y
Type: integer
Minimum: 2
Maximum: 50
Split all the PDF pages in the specified number of parts along the vertical axis. E.g. from one A4 portrait page to two A5 landscape pages.
stamp
Type: boolean
Insert the first page of the second input as a stamp into each page of the first input.
version
Type: string
Enum: 1.4 1.5 1.6 1.7 2.0
Selects the PDF version of the converted file
watermark
Type: boolean
Insert the first page of the second input as a watermark into each page of the first input.

Output Example

POST /v2/jobs HTTP/1.1
Host: https://api.api2convert.com
X-Oc-Api-Key: <your API key here>
Content-Type: application/json
{
    "input": [{
        "type": "remote",
        "source": "https://example-files.online-convert.com/document/doc/example.doc"
    }],
    "conversion": [{
        "category": "document",
        "target": "pdf",
        "options": {
            <conversion options here>
        }
    }]
}