MyRelay

← Back to the notebook

Summarising Long PDFs on a Small Budget

Start with a modest target: turn one long PDF into a useful, verifiable summary without repeatedly paying to process the entire document. This walkthrough uses text extraction, a small pilot, section summaries, and a final synthesis. Keep the original PDF beside you throughout.

Define the summary before making a request

Write down what you need to understand. For a research paper, that might be the question, method, findings, and limitations. For a technical report, it might be the recommendations, supporting evidence, and implementation constraints. Choose a final length, such as 600 words, and require page references for important claims.

Set a spending ceiling before testing. Reserve part of it for checking difficult passages rather than spending everything on the first draft. Treat this as your own stop rule, not an assumption that your application automatically enforces a per-document limit.

Extract readable text and preserve page boundaries

Try selecting and copying a paragraph from the PDF. If the text is usable, extract it locally with a PDF reader or a tool such as PyMuPDF. Inspect a two-column page and a table before continuing: extracted text does not necessarily follow the visual reading order. ([pymupdf.readthedocs.io](https://pymupdf.readthedocs.io/en/latest/faq/index.html))

If pages contain scanned images rather than usable text, apply optical character recognition only where needed. Save the recognised text so you do not repeat the same work. PyMuPDF documents this approach because OCR is substantially slower than ordinary text extraction. ([pymupdf.readthedocs.io](https://pymupdf.readthedocs.io/en/latest/recipes-ocr.html?utm_source=openai))

Keep page markers and section headings. Distinguish the PDF viewer's page number from the printed page number if they differ. Remove repeated headers and footers, but retain qualifications, footnotes, and units. Flag charts that extraction misses instead of treating the surrounding prose as complete evidence.

Test one representative section and measure its cost

Choose a section containing both ordinary prose and something demanding, such as a table or methodological caveat. Try Gemini 2.5 Flash as one candidate, checking its current MyRelay price before sending anything. Compare input and output charges separately; the provider's published pricing distinguishes these categories, but your budget should use the relay's applicable rates. ([ai.google.dev](https://ai.google.dev/gemini-api/docs/pricing))

MyRelay brings model access under one key and provides a record of token usage. Create a MyRelay account to run this pilot and inspect the request's tokens and cost before expanding the job. ([myapirelay.com](https://myapirelay.com/))

Ask for a short summary containing the main claims, supporting numbers, limitations, and page references. Specify that missing evidence must remain missing. Review the result against the source before approving the same instructions for other sections.

Split the document without losing its structure

Divide the extracted text at section boundaries. As a starting choice, aim for roughly 2,000 to 4,000 words per piece, adjusting after the pilot. Include the document title, section heading, and page range with each piece. Preserving context matters: isolated chunks can lose information needed to interpret them. ([anthropic.com](https://www.anthropic.com/engineering/contextual-retrieval?trk=public_post_comment-text&utm_source=openai))

Do not split a table from its caption or a conclusion from its qualification. Add a small overlap only when a boundary interrupts an argument. Save each successful section summary locally, together with its page range, so failed requests do not require restarting completed work.

Estimate the remaining work before processing every section

Multiply the pilot's observed cost by the number of similarly sized pieces. Treat that as a rough estimate, then allow room for the final synthesis and retries. If the estimate exceeds your ceiling, narrow the scope explicitly or shorten the requested section summaries. Do not silently omit chapters while presenting the result as comprehensive.

Build the final summary from the saved notes

Send the section summaries together for one synthesis. Request the agreed structure and length, preserve page references, and ask the model to distinguish repeated findings from disagreements. Avoid resending the full PDF merely to change the wording or organisation.

Check the evidence before calling the job finished

Verify several central claims, every important number, and the stated limitations against the original pages. Revisit the beginning, middle, and end of the document. For an unclear passage, submit only the relevant excerpt and its existing summary for correction. Save the checked result, section notes, and total spend as your starting point for the next PDF.

More to read