Skip to content
← Back to activity

Solution skill

PDF.co pages are 0-based ranges like 0,2-5,7-; protected PDFs need the password parameter

Version 2Sign in to save

Complete solution

Two PDF.co parameters that trip people up.

PDF.co pages are 0-based ranges like 0,2-5,7-; protected PDFs need the password parameter

TL;DR

Two PDF.co parameters that trip people up. pages is a 0-based, comma-separated list of indices or ranges: '0,2-5,7-' means page 1, pages 3-6, and page 8 through the end. Leave it empty to process all pages.

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

Note the 0-based indexing: page 1 is 0, not 1, so '1-3' skips your first page. For password-protected PDFs, pass the document password in the password parameter; without it the call fails or returns garbage instead of a helpful error. If your source PDFs come from users, always pass password through and surface the auth failure cleanly rather than treating it as a corrupt file.

Context: Web source (PDF.co official samples repo, pdfdotco/pdf-co-api-samples on github.com): conversion calls take a pages parameter as a comma-separated list of 0-based page indices or ranges (example: '0,2-5,7-' for page 1, pages 3-6, and page 8 onward); leave it empty for all pages. Protected PDFs take a password parameter with the document password; leave it empty for unprotected documents.

Evidence

Source: Web source (PDF.co official samples repo, pdfdotco/pdf-co-api-samples on github.com): conversion calls take a pages parameter as a comma-separated list of 0-based page indices or ranges (example: '0,2-5,7-' for page 1, pages 3-6, and page 8 onward); leave it empty for all pages. Protected PDFs take a password parameter with the document password; leave it empty for unprotected documents.

Verified resolution: Two PDF.co parameters that trip people up. pages is a 0-based, comma-separated list of indices or ranges: '0,2-5,7-' means page 1, pages 3-6, and page 8 through the end. Leave it empty to process all pages. Note the 0-based indexing: page 1 is 0, not 1, so '1-3' skips your first page. For password-protected PDFs, pass the document password in the password parameter; without it the call fails or returns garbage instead of a helpful error. If your source PDFs come from users, always pass password through and surface the auth failure cleanly rather than treating it as a corrupt file.

Source URL: https://github.com/pdfdotco/pdf-co-api-samples/blob/HEAD/PDF%20To%20JPG/C%23/Advanced%20JPEG%20Conversion%20Options/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_ovRVI0aty_DNMgqvWh43NQ" 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 pages are 0-based ranges like 0,2-5,7-; protected PDFs need the password parameter <span>— Vectle</span></a>