The problem
Text copied from a webpage leaves out its visual layout. Your agent may need a picture of the page or a printable copy to show what was displayed when it checked an offer, announcement or report.
How NativePort helps
NativePort uses Browserless to open a webpage and return a screenshot or PDF. Your agent can save the file with its source and capture time, then include it in a report or send it to you for review.
For example, it can create a full-page screenshot and an A4 PDF of the same public page. The screenshot preserves the browser view; the PDF uses the page’s print layout.
Let your agent build it
You don’t need to write this code yourself. Copy the prompt and paste it into your agent. It will follow NativePort’s setup guide, help you use an existing account or create one, read this page, and ask what you’d like to do next.
View prompt
Help me use NativePort for this use case. 1. Read https://nativeport.ai/SKILL.md and follow its instructions to learn how to use NativePort. Save or update the skill if your environment supports it. 2. Check whether I already have a working NativePort connection or account. Reuse it if available. Otherwise, help me sign in or create an account by following the skill's setup instructions. Guide me through any steps that require me to use a browser, then help connect my agent. Keep credentials private. 3. Follow the skill to learn how to find the right tools, check their prices and instructions, and use them through NativePort. 4. Read this entire use-case page, including the instructions for agents inside the accordion: https://nativeport.ai/use-cases/save-webpages-as-screenshots-and-pdfs/ Once setup is complete and you have read the page, briefly explain what you can help me do and ask me what I would like to do next. Wait for my answer before implementing the example or running paid tools.
Instructions for the agents - You don't need to read this
Technical implementation
Use Python 3. Install requests with python -m pip install requests and set NATIVEPORT_API_KEY to your NativePort key in your server environment. Keep the key out of browser code.
Set TARGET_URL to a public webpage. The example uses two separate Browserless actions, so the captures happen at slightly different times. Pages requiring login or interaction need a separate workflow.
import json
import os
from datetime import datetime, timezone
from pathlib import Path
import requests
url = os.environ["TARGET_URL"]
headers = {"Authorization": f"Bearer {os.environ['NATIVEPORT_API_KEY']}"}
captures = []
for action, filename, options, signature in [
("screenshot", "page.png", {"type": "png", "fullPage": True}, b"\x89PNG\r\n\x1a\n"),
("pdf", "page.pdf", {"format": "A4", "printBackground": True}, b"%PDF-"),
]:
response = requests.post(f"https://api.nativeport.ai/browserless/{action}",
headers=headers, json={"url": url, "options": options}, timeout=60)
response.raise_for_status()
if not response.content.startswith(signature):
raise RuntimeError(f"Unexpected file format for {action}")
Path(filename).write_bytes(response.content)
captures.append({"file": filename, "source_url": url,
"captured_at": datetime.now(timezone.utc).isoformat()})
Path("captures.json").write_text(json.dumps(captures, indent=2), encoding="utf-8")
print(json.dumps(captures, indent=2))Review the files: a valid image or PDF could still show a consent screen or an error page. The route enforces a 30-second browser limit. Long pages, lazy-loaded sections and print-specific styles can affect the result. For a known page, use admitted wait selectors rather than assuming a longer timeout is available.
Tool costs
| Tool used in the example | Price per call |
|---|---|
| Browserless — screenshot or PDF, one call per file | $0.00422 / call |
The example saves both formats: one screenshot call and one PDF call, each at the price shown above. Saving only one format uses one call. Forwarded calls are charged even when the page fails, unless the provider confirms the call was free.
Prices in USD. Usage-based tools have no fixed per-call price. View pricing.