v2

latestOpenAPI 3.0.12026-07-266846393.5 KB
PDF Conversion

PDF to HTML

Convert PDF and scanned images into HTML representation with text, fonts, images, vectors, formatting preserved.

post/v1/pdf/convert/to/html

Request body

urlstring uri required

URL to the source file url attribute.

langstring

Set the language for OCR (text from image) to use for scanned PDF, PNG, and JPG documents input when extracting text. see Language Support. You can also use 2 languages simultaneously like this: eng+deu (any combination).

rectstring {x} {y} {width} {height}

Defines coordinates for extraction. UsePDF Edit Add Helper to get or measure PDF coordinates. The format is {x} {y} {width} {height}.

inlineboolean

Set to true to return results inside the response. Otherwise, the endpoint will return a URL to the output file generated.

pagesstring

Page indices/ranges (0-based). Items are comma-separated. Each item is one of: N (e.g., 0), N-M (e.g., 3-7), N- (open-ended, e.g., 10-), or !N (reverse index; !0 is last page, !1 is second-to-last). Whitespace is allowed. If not specified, the default configuration processes all pages.

namestring

File name for generated output.

asyncboolean

Set async to true for long processes to run in the background, API will then return a jobId which you can use with the Background Job Check endpoint. Also see Webhooks & Callbacks

passwordstring

Password for the PDF file.

expirationnumber

Sets the expiration time for the output link, in minutes. After this period, generated output file(s) are automatically deleted from PDF.co Temporary Files Storage. The maximum allowed duration depends on your subscription plan. For permanent storage of input files (e.g., reusable images, PDF templates, documents), use PDF.co Built‑In Files Storage.

profilesstring

Profiles are used configure extra options for specific API endpoints and may be unique to an API. For more information, see Profiles and the documentation of each endpoint for profiles specific to it.

httpusernamestring

HTTP auth user name if required to access source URL.

httppasswordstring

HTTP auth password if required to access source URL.

simpleboolean

Set true to convert to a plain HTML format. Default is the rich HTML & CSS format keeping the document design.

columnsboolean

Set true if the PDF document is arranged in columns like a newspaper. Default is false.

filestring path to a local file

The path to the local file to be uploaded.

timeoutnumber

Timeout for output links in seconds

Example request

{
  "lang": "eng+deu",
  "rect": "10 20 300 400",
  "pages": "0,2,5-10, !0, !5-!2"
}

Response

Success.

statusstring

Status of the API response.

messagestring

Descriptive message for the response status.

urlstring uri

URL to the output file.

jobIdstring

Unique identifier for the job.

creditsinteger

Credits used for this operation.

remainingCreditsinteger

Credits remaining after this operation.

durationinteger

Time taken to complete the request, in milliseconds.

Example response

{
  "status": "success",
  "message": "Success",
  "url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/output.pdf",
  "jobId": "6YSZD3U872ZYYFEDMQCQSGEEO8YSF5WA",
  "credits": 2,
  "remainingCredits": 1480582,
  "duration": 33
}