{"uid":"cap_5m0C7VQtssizB3LF0TXkW","slug":"tanod-docs-pdf-flatten-2e421bd8","name":"Tanod Docs PDF Flatten","description":"Documents: DOCX template fill, Office to PDF, any file to Markdown, PDF to Word, OCR, PDF pipeline.","url":"https://docs.tanod.dev/v1/pdf/flatten?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"url":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1},{"type":"null"}],"default":null,"description":"Public http(s) URL of the PDF (at most 20 MB; private, internal and IP-literal hosts are refused); or use pdf_base64."},"mode":{"enum":["all","screen","print"],"type":"string","default":"all","description":"all (default): every visible annotation and form field; screen: what a viewer shows; print: what is marked for printing. Annotations the mode does not flatten are removed."},"output":{"enum":["base64","url"],"type":"string","default":"base64","description":"base64 (default): the file comes back inline as base64. url: the file is stored for 24 hours and the reply carries a download link (url, expires_at, bytes, content_type, sha256) instead of the base64, which keeps the file out of your context window."},"pdf_base64":{"anyOf":[{"type":"string","maxLength":13398872,"minLength":1},{"type":"null"}],"default":null,"description":"The PDF as base64 (at most 10 MB decoded per request); or use url."}}},"responseSchema":{"type":"json","example":{"file":{"name":"flattened.pdf","bytes":89021,"pages":6,"data_base64":"JVBERi0xLjcKJb/3... (trimmed: 118,696 base64 characters in the reply)","content_type":"application/pdf"},"mode":"all","warnings":[],"operation":"flatten","input_bytes":140815,"input_pages":6,"output_bytes":89021,"dropped_widgets":15,"annotations_after":0,"appearances_drawn":0,"untrusted_content":true,"annotations_before":23,"flattened_annotations":8,"active_content_removed":{"javascript":1}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_4zWSJDbJuebu67NUb0q2W","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Flattens PDF annotations and form fields into static page content, removing interactivity and active content like JavaScript.","exampleAgentPrompt":"Can you flatten all the annotations and form fields in this PDF so it becomes a static, non-interactive document — I want all visible elements baked in and any JavaScript removed? Here's the URL: https://example.com/myform.pdf","exampleUseCases":[{"title":"Archive secure legal contract PDF","prompt":"I need to archive this signed legal contract PDF so no one can modify the form fields or run any scripts — please flatten all annotations and form fields into the page and give me back the static PDF file. The PDF is at https://legal.example.com/contract-signed.pdf"},{"title":"Prepare PDF for print-safe distribution","prompt":"Flatten only the print-marked annotations in this PDF before I send it to the printer — I only want what's meant for printing baked in, and return a download link instead of embedding the file data. The document is at https://files.example.com/brochure.pdf"},{"title":"Sanitize untrusted PDF before sharing","prompt":"I received a PDF from an external vendor and I want to strip out any JavaScript and flatten all interactive elements before sharing it internally — can you process this base64-encoded PDF and return the cleaned, flattened version?"}],"resultDescription":"Returns the flattened PDF either as inline base64 data or a 24-hour download URL (with expiry, size, content type, and SHA256). Also includes metadata: page count, input/output byte sizes, annotation counts before and after flattening, number of dropped widgets, number of appearances drawn, and a report of any active content (e.g. JavaScript) that was removed.","failureModes":["PDF URL exceeds 20 MB limit — request rejected","Base64 input exceeds 10 MB decoded — request rejected","URL points to a private, internal, or IP-literal host — refused","Invalid PDF or corrupt file — processing error returned","Unsupported mode value outside all/screen/print — validation error","Network timeout fetching remote PDF URL"],"whenToPreferThis":"Choose this endpoint when you need to irreversibly bake annotations, form fields, and interactive elements into a PDF's static page content — especially for archival, secure distribution, or sanitization purposes (e.g. removing JavaScript from untrusted PDFs). Prefer this over general PDF conversion endpoints when the goal is specifically flattening interactivity rather than format conversion or text extraction.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-13T12:41:42.000Z","isFirstParty":false,"canonicalSlug":"tanod-docs-pdf-flatten-2e421bd8"}