To convert a public webpage with PDFShift, send a POST request to https://api.pdfshift.io/v3/convert/pdf with the page URL in the JSON source property and your API key in the X-API-Key header. If the request succeeds, save the response body as PDF bytes.
Convert a URL to PDF with Python
This example uses Python’s requests library. Replace the API key and source URL, then run it in an environment where requests is installed.
As an Amazon Associate I earn from qualifying purchases.
import requests
api_key = "YOUR_API_KEY"
response = requests.post(
"https://api.pdfshift.io/v3/convert/pdf",
headers={"X-API-Key": api_key},
json={"source": "https://www.example.com"},
)
response.raise_for_status()
with open("result.pdf", "wb") as pdf_file:
pdf_file.write(response.content)
Use binary mode (wb) so the response bytes are written unchanged. raise_for_status() stops the example from saving an HTTP error response as though it were a finished PDF. Keep the API key out of public source code and logs; load it from a secret store or environment variable in an application.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteMake the same request with cURL
cURL is useful for checking the request independently of your application. This writes the response body to result.pdf; inspect the HTTP status as well before treating the file as a successful conversion.
#1 Best Overall
curl -X POST "https://api.pdfshift.io/v3/convert/pdf"
-H "X-API-Key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{"source":"https://www.example.com"}'
--output result.pdf
Use Node.js with fetch
In Node.js, read the response as an array buffer before writing it to disk. This example uses the built-in fetch available in current Node.js releases.
import { writeFile } from "node:fs/promises";
const response = await fetch("https://api.pdfshift.io/v3/convert/pdf", {
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({ source: "https://www.example.com" }),
});
if (!response.ok) {
throw new Error(`PDFShift returned HTTP ${response.status}`);
}
const pdfBytes = Buffer.from(await response.arrayBuffer());
await writeFile("result.pdf", pdfBytes);
PDFShift’s published Node.js examples also cover Got, Axios, NodeFetch, Unfetch, Bent, and Needle. The endpoint and API-key approach are the same, but each client’s response-buffer handling differs; use the binary response method documented for the client in your application.
Rank #2
Choose a URL or raw HTML as the source
Use a URL for a page PDFShift can fetch
Set source to the page URL when PDFShift can retrieve the page over the network. The service fetches and renders that page as part of conversion.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use raw HTML when you control the document
PDFShift’s raw-HTML guide says submitting HTML as source avoids the service’s network request to fetch the HTML, can support documents that are not publicly accessible, and may reduce conversion duration. The guide also says inline styles and JavaScript can reduce conversion duration further. Those are vendor-stated advantages, not independently measured performance guarantees. Raw HTML is often a better fit when your application already has the complete document markup; a URL is simpler when the page is already hosted and accessible.
Rank #3
- hole punched
- high quality card stock
- 4 pages
- made in USA
- keyboard shortcuts
Convert a page protected by HTTP Basic Authentication
PDFShift’s PHP guide for secured pages demonstrates an auth property containing a username and password for a page protected by Basic Authentication. The documented example supports that authentication method specifically; it does not establish how to handle OAuth, cookie-based sessions, or other login flows.
{
"source": "https://www.example.com/private-page",
"auth": {
"username": "YOUR_USERNAME",
"password": "YOUR_PASSWORD"
}
}
Send this object as the JSON request body with the same endpoint and API-key header. Treat the credentials as secrets just as you would the API key.
Rank #4
Handle errors and save only successful conversions
The Python example raises on an unsuccessful HTTP status, and PDFShift’s PHP example saves the response only when the status is 200. Apply the same basic check in any client: confirm the request succeeded before storing the response as a PDF. The examples establish these checks, but do not provide a complete production retry policy, timeout guidance, or a comprehensive list of error codes.
- HTTP error: Do not assume the body is a PDF. Surface the status to your application and inspect the error response according to PDFShift’s current API guidance.
- Unexpected or unusable PDF: Confirm that
sourcecontains the intended URL or HTML and that your application wrote the response body as bytes rather than text. - Page cannot be reached: Check whether the target is publicly reachable by PDFShift or whether you need to submit raw HTML. If the page relies on an unsupported authentication method, the documented Basic Authentication example does not establish a workaround.
The implementation guides cited for this workflow do not establish current prices, quotas, timeout or retry behavior, detailed parameter limits, or a full error-code reference. Check PDFShift’s current service documentation for those operational details before designing production limits or retry logic.
Or skip the browser setup
If you need a screenshot rather than a PDF document, ScreenshotNeo offers a one-request website screenshot API; it is an alternative, not a replacement for PDFShift’s URL-to-PDF workflow. Its API can return PNG, JPEG, WebP, or PDF. For a screenshot capture, the following cURL request saves the response as a WebP image. See the ScreenshotNeo API documentation for its options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://www.example.com -o shot.webp
- Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; each step can be turned off.
- Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing; responses include page-verdict and billing headers.
- An MCP server lets AI agents use screenshot tools, including Claude, Cursor, and other MCP clients.
- The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →




