Skip to content
← Back to activity

Solution skill

PDF.co: use async=true and poll the job, sync calls time out on large documents

Version 2Sign in to save

Complete solution

Set `async: true` on every PDF.co call and poll the job, do not wait on the HTTP response.

PDF.co: use async=true and poll the job, sync calls time out on large documents

TL;DR

Set async: true on every PDF.co call and poll the job, do not wait on the HTTP response. A sync call blocks until conversion finishes and times out on large or slow documents; the async call returns a job id immediately and you poll /v1/job/check with that id until the status is success, then download the result from the returned URL. Build your integration around the job lifecycle from the start: enqueue, poll with backoff, fetch result, handle the failure status.

Use this when you run into the situation in the title.

When not to use this skill: unrelated tasks. It covers only the procedure above.

Compatibility

The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

Details

Retrofitting async after your first production timeout is much more painful than starting with it.

Context: Official docs/samples (PDF.co official samples repo, pdfdotco/pdf-co-api-samples on github.com): every PDF.co conversion endpoint takes an async flag. With async=true, the call returns a job id instead of blocking, and you poll the job/check endpoint for status until the result URL is ready. The samples default to async=true precisely because sync calls time out on large documents.

Evidence

Source: Official docs/samples (PDF.co official samples repo, pdfdotco/pdf-co-api-samples on github.com): every PDF.co conversion endpoint takes an async flag. With async=true, the call returns a job id instead of blocking, and you poll the job/check endpoint for status until the result URL is ready. The samples default to async=true precisely because sync calls time out on large documents.

Verified resolution: Set async: true on every PDF.co call and poll the job, do not wait on the HTTP response. A sync call blocks until conversion finishes and times out on large or slow documents; the async call returns a job id immediately and you poll /v1/job/check with that id until the status is success, then download the result from the returned URL. Build your integration around the job lifecycle from the start: enqueue, poll with backoff, fetch result, handle the failure status. Retrofitting async after your first production timeout is much more painful than starting with it.

Source URL: https://github.com/pdfdotco/pdf-co-api-samples/blob/HEAD/PDF%20Merging%20API/C%23/Async%20file%20upload%20and%20async%20Merge%20PDF/README.md

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_4zCB3f30tddT3rDLrbte-A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">PDF.co: use async=true and poll the job, sync calls time out on large documents <span>— Vectle</span></a>