2 creditsURL to PDF API — save any webpage as PDF
Wait for `networkidle`, block ads, and archive pages exactly as they render.
URL to PDF loads a live web page in a headless browser, waits for it to finish rendering, and returns the result as a PDF. The setting that most affects output is when the capture fires — a page captured before its JavaScript finishes produces a blank or half-loaded document. Use a network-idle condition, or wait for a specific element on single-page applications.
How does the URL to PDF API work?
One HTTP request from any language. Every ASHDOCS endpoint uses the same X-API-Key header.
curl -X POST https://www.ashdocs.com/api/v1/tools/url-to-pdf \
-H "X-API-Key: ash_live_..." \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com","options":{"format":"A4"}}'import requests
r = requests.post(
"https://www.ashdocs.com/api/v1/tools/url-to-pdf",
headers={"X-API-Key": "ash_live_..."},
json={
"url": "https://example.com",
"options": {
"format": "A4"
}
},
)
job = r.json()
print(job["status"], job["output_files"][0]["url"])const res = await fetch("https://www.ashdocs.com/api/v1/tools/url-to-pdf", {
method: "POST",
headers: { "X-API-Key": "ash_live_...", "Content-Type": "application/json" },
body: JSON.stringify({"url":"https://example.com","options":{"format":"A4"}}),
});
const job = await res.json();
console.log(job.status, job.output_files[0].url);using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "ash_live_...");
var body = new StringContent(
"{\"url\":\"https://example.com\",\"options\":{\"format\":\"A4\"}}",
Encoding.UTF8, "application/json");
var res = await client.PostAsync("https://www.ashdocs.com/api/v1/tools/url-to-pdf", body);
var job = await res.Content.ReadAsStringAsync();
Console.WriteLine(job);import java.io.ByteArrayOutputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
public class Sample {
public static void main(String[] args) throws Exception {
String json = "{\"url\":\"https://example.com\",\"options\":{\"format\":\"A4\"}}";
HttpRequest req = HttpRequest.newBuilder(URI.create("https://www.ashdocs.com/api/v1/tools/url-to-pdf"))
.header("X-API-Key", "ash_live_...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: ash_live_...");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"url\":\"https://example.com\",\"options\":{\"format\":\"A4\"}}");
curl_easy_setopt(curl, CURLOPT_URL, "https://www.ashdocs.com/api/v1/tools/url-to-pdf");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
printf("\n");
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}How do I use URL to PDF API in Make, Zapier or n8n?
Add an HTTP "Make a request" module, POST the URL as JSON, and turn off Parse response so the PDF binary arrives intact.
Make setup guide →Use Webhooks by Zapier with a POST action and map the returned file URL into a Drive upload or an email attachment.
Zapier setup guide →Use the HTTP Request node with Response Format set to File and a named binary property.
n8n setup guide →Trigger on a record containing a URL, capture the page, and write the PDF back to an attachment field.
Airtable setup guide →Common problems and fixes
| Symptom | Cause | Fix |
|---|---|---|
| The PDF is blank | The capture fired before the page finished rendering | Wait for network idle rather than the load event, or wait for a specific element to appear. This is the most common failure by a wide margin. |
| Images below the fold are missing | Lazy loading — a headless renderer never scrolls | Enable full-page capture with auto-scroll, or inject CSS forcing eager image loading. |
| A cookie banner covers the content | The consent overlay renders before the capture | Inject CSS hiding the banner, and reset body overflow — many banners lock scrolling, which truncates the capture even after the banner is hidden. |
| Only the first screen is captured | The renderer captured the viewport rather than the full document | Enable full-page capture. |
| Backgrounds and colours are missing | Print rendering suppresses backgrounds by default | Set printBackground: true. |
| The request times out on a heavy page | Dashboards making many API calls may never reach idle | Raise the timeout, wait on a specific element instead, or use an asynchronous pattern with a webhook callback. |
Common use cases
- →Compliance archives
- →Marketing snapshots
- →Legal print-outs
Frequently asked questions
How do I convert a URL to PDF?+
Send the URL to the endpoint. It loads the page in a headless browser, waits for rendering to complete, and returns the PDF. Set the wait condition to network idle and enable printBackground for accurate output.
Why is my URL to PDF output blank?+
The capture fired before the page finished rendering. Use a network-idle wait condition rather than the load event, or wait for a specific element — particularly on single-page applications built with React or Vue.
Can I capture a page that requires a login?+
Yes, by passing session cookies or authentication headers. Consider the security implications first — a signed, time-limited URL granting read access to that page is usually safer than transmitting a session token to a third party.
How do I remove cookie banners from the capture?+
Inject CSS hiding the banner elements and reset body overflow to visible, since many consent banners lock page scrolling. Alternatively set the consent cookie before navigating so the banner never renders.
Does URL to PDF capture the whole page or just the visible area?+
Full-page capture is available and renders the entire document height across multiple pages. Without it you get only the initial viewport.