{"id":405,"date":"2026-11-19T01:28:47","date_gmt":"2026-11-19T01:28:47","guid":{"rendered":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/"},"modified":"2026-11-19T01:28:48","modified_gmt":"2026-11-19T01:28:48","slug":"pdf-translator-python","status":"publish","type":"post","link":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/","title":{"rendered":"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">pdf translator python is one of the key topics this article covers. Below we look at pdf translator python and the details that matter most when choosing.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The part of the pipeline tutorials leave out \u2014 pdf translator python<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run a 200-page equipment manual through a hand-rolled script and you rarely get a translated manual back. You get something that looks plausible at a glance and falls apart on inspection: a two-column spec table flattened into alternating lines, so a sentence starts in the left column and finishes in the right; a scattering of paragraphs still sitting in the source language because those particular extraction calls came back empty and the loop quietly moved on; translated strings spilling past the right margin because German runs longer than English and nothing remeasured the box.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">None of those are model failures. They are pipeline failures, and they cluster in three predictable places.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Every PDF translation script \u2014 a fifty-line throwaway or something you&#8217;d put in front of customers \u2014 is the same machine with three stages. <strong>Extract<\/strong>: pull text and its coordinates out of the page. <strong>Segment and translate<\/strong>: decide what counts as a unit of text, then send each unit to a model and collect the answer. <strong>Reassemble<\/strong>: write the translated text back onto a page without destroying the layout. The middle stage gets all the attention, because that&#8217;s where the API call lives. The damage usually happens at the joins.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Between extraction and segmentation, the extractor hands you a stream of glyphs with positions, not paragraphs. Turning that into segments that begin and end at sentence boundaries is a judgement call. Split in the wrong place and the model receives half a clause, translates it as though it were a whole thought, and hands back something that reads like a fragment even when every word is correct.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Between segmentation and translation, a request times out or a response comes back with one segment missing or two merged. If your script tracks translated text by position in a list rather than by a stable identifier, everything downstream shifts by one and you get a page where the headings have swapped languages. That silent misalignment is the most common reason a finished file is &#8220;half translated.&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Between translation and reassembly, the text you&#8217;re inserting no longer matches the text you removed. It&#8217;s longer or shorter, it may need glyphs the embedded font subset never included, and it has to fit a rectangle that was sized for the source string. Everything from overflowing lines to tofu boxes to text drawn outside the visible page originates here.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The rest of this article builds a working end-to-end skeleton early \u2014 extraction with pdfplumber, translation through an OpenAI-compatible endpoint, writing with PyMuPDF \u2014 and then each section replaces one piece of it with something more careful: real reading-order handling, sentence-aware segmentation, fonts that survive the swap. Get the skeleton running first. A crude pipeline you can debug end to end teaches you more than a perfect extractor that never reaches a page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Two things to have ready before you start. The first is a real PDF from your own workload \u2014 a report you actually need translated, a chapter with footnotes, an invoice with a table. Single-column ASCII hello-world samples are worse than useless here, because they never touch the seams where the failures live. The second is an API key for an OpenAI-compatible model endpoint, since every stage after extraction needs something to translate with. If you&#8217;d rather see the whole three-stage shape working before writing your own, an open-source project like Book Fork runs the same pipeline \u2014 parse, segment on sentence boundaries, translate segment by segment through a durable worker, return a finished PDF or EPUB \u2014 and it&#8217;s a reasonable reference to read alongside your own code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A PDF is a page description, not a document<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Open a PDF in a text editor and you will not find a document. You will find a set of instructions for drawing one.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A typical text run in a content stream looks roughly like this: <em>BT \/F1 10 Tf 72 720 Td (Hello) Tj ET<\/em>. Read it literally and it says: begin a text object, select font resource F1 at 10 points, move the pen to position 72,720, draw these glyphs there, end the text object. Every string in the file is placed this way \u2014 a font reference, a coordinate pair, and some bytes to render. That is the whole model. The page is a canvas, and the producer of the file has already done all the layout thinking before writing it out.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What this means in practice is that a PDF has no paragraphs, no sentences, and no words. It has glyphs at positions. The idea that &#8220;Hello world&#8221; is two words separated by a space exists only because a human looking at the rendered page sees a gap. The extractor has to reconstruct that gap from the horizontal distance between two glyph origins, decide it is wider than normal letter spacing, and insert a space character that was never in the file. Same for line breaks: glyphs sharing a baseline form a line, a jump in the vertical coordinate starts a new one. Same for paragraphs, columns, headers, footnotes and table cells \u2014 all of it is inferred from geometry.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Which is why two-column academic papers come out interleaved, and why a footer sometimes lands in the middle of a sentence. The extractor did not fail to read the file. It read the file correctly and then guessed wrong about reading order, because the file never stated one.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There is a mechanism for stating it. The PDF specification includes marked content and a structure tree (<em>\/StructTreeRoot<\/em>), which lets a producer tag a region as a paragraph, a heading, a list item or a table cell, in logical order. Tagged PDFs extract cleanly and are a pleasure to work with. They are also a minority of the files you will actually be handed. Scans, LaTeX output, older exports, files printed to PDF from a viewer, and most of what arrives attached to an email carry no structure at all. A robust pipeline assumes the structure tree is absent and treats tags as a bonus when they happen to be there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Fonts cause the second class of problem, and it shows up later than extraction, which makes it worse. PDF producers embed subsets: only the glyphs that actually appear in the source text get included. A file that never uses the letter <em>\u00f1<\/em> has no <em>\u00f1<\/em> in its font program, and no amount of translation will conjure one. On top of that, the mapping from the bytes in the content stream back to Unicode characters lives in a <em>\/ToUnicode<\/em> CMap that is optional and frequently missing, incomplete or wrong. That is where the familiar symptoms come from \u2014 extraction that yields boxes, ligature glyphs that arrive as single odd characters, accented letters that survive visually but not as text. And it is the same root cause behind the boxes you see after reassembly: you have translated the text, but the font you are drawing it with was never built to contain the glyphs of the target language.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Compare that with the formats that store structure explicitly. A DOCX file is a ZIP of XML in which a paragraph is an element containing runs containing text, and bold is a property on a run rather than a heavier font at the same coordinates. HTML is the same idea with different syntax. In both, meaning is primary and appearance is derived. In a PDF, appearance is primary and meaning has to be reverse-engineered. That asymmetry is why <a href=\"https:\/\/bookfork.space\/blog\/2026\/11\/18\/translate-word-document-automatically\/\">translating a Word document automatically<\/a> and translating a PDF are not the same problem at different difficulty levels \u2014 they are different problems. The Word path is mostly about preserving structure you were given. The PDF path is about inventing structure that was never recorded, and being honest with yourself about how much of it you invented.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Which library actually gives you what<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/bookfork.space\/blog\/wp-content\/uploads\/2026\/11\/pdf-translator-python-how-to-translate-a-pdf-with-python-pdfplumber-pymupdf-and-translation-apis-section-3-bicm8p.webp\" alt=\"A two-column page diagram with dashed vertical candidate cut lines: blue lines fall through empty gutters, one amber line is crossed by highlighted word bars, and faint header and footer bars are struck out.\" width=\"1600\" height=\"880\" loading=\"lazy\" decoding=\"async\"><figcaption class=\"wp-element-caption\">Column boundaries derived from the page itself: keep only the vertical positions that no word crosses, after dropping the header and footer bands.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">None of these libraries is the &#8220;best&#8221; one in the abstract. They sit at different levels of the PDF stack, and the right choice falls out of two questions: what you need the file to do, and how you ship the code that asks it to do it.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table>\n <thead>\n <tr>\n <th>Task<\/th>\n <th>pdfplumber<\/th>\n <th>PyMuPDF<\/th>\n <th>pypdf<\/th>\n <th>pikepdf<\/th>\n <\/tr>\n <\/thead>\n <tbody>\n <tr>\n <td>Text extraction<\/td>\n <td>Strong, character-level, built on pdfminer.six<\/td>\n <td>Strong, with several output shapes (text, blocks, dict, rawdict)<\/td>\n <td>Works, but text fidelity is its weaker side<\/td>\n <td>None built in \u2014 you parse content streams yourself<\/td>\n <\/tr>\n <tr>\n <td>Coordinates and layout<\/td>\n <td>Yes: every char carries x0, top, x1, bottom, fontname, size<\/td>\n <td>Yes: bbox at page, block, line, span and char level, plus font flags and colour<\/td>\n <td>No coordinate API<\/td>\n <td>No<\/td>\n <\/tr>\n <tr>\n <td>Table extraction<\/td>\n <td><code>extract_tables()<\/code> with line-based and text-based strategies<\/td>\n <td><code>find_tables()<\/code> in recent releases<\/td>\n <td>Nothing built in<\/td>\n <td>Nothing built in<\/td>\n <\/tr>\n <tr>\n <td>Writing or modifying<\/td>\n <td>Cannot write \u2014 read-only library<\/td>\n <td>Yes: insert text, redact, annotate, create pages, save<\/td>\n <td>Yes for structure: merge, split, rotate, metadata, outlines, forms, encryption<\/td>\n <td>Yes at object level: repair, linearise, encrypt, rewrite content streams<\/td>\n <\/tr>\n <tr>\n <td>OCR<\/td>\n <td>No<\/td>\n <td>Optional, via a Tesseract integration you install separately<\/td>\n <td>No<\/td>\n <td>No<\/td>\n <\/tr>\n <tr>\n <td>Speed<\/td>\n <td>Slow \u2014 pure Python all the way down<\/td>\n <td>Fastest of the four; MuPDF is C<\/td>\n <td>Moderate; fine for structural work, slower on bulk text<\/td>\n <td>Fast for structural work, since QPDF does the heavy lifting<\/td>\n <\/tr>\n <tr>\n <td>Licence<\/td>\n <td>MIT<\/td>\n <td>AGPL-3.0, or a paid commercial licence from Artifex<\/td>\n <td>BSD-3-Clause<\/td>\n <td>MPL-2.0<\/td>\n <\/tr>\n <\/tbody>\n<\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Two of those rows deserve more than a cell.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first is the read\/write split. pdfplumber is an extraction library and nothing else. It gives you some of the cleanest layout data available in Python, and then it stops: there is no save method, no way to stamp a page, no way to write anything back. That gap is real the moment you want page numbers, a watermark, a redaction, or a rebuilt page carrying translated text. Which is exactly how teams end up with pdfplumber reading and PyMuPDF writing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The second row is why that pattern is worth pausing over. pdfplumber and pdfminer.six are MIT-licensed, pypdf is BSD, and pikepdf is MPL-2.0 \u2014 file-level copyleft, so changes you make to pikepdf&#8217;s own files stay open, but your application can remain closed. PyMuPDF is AGPL-3.0. Importing an AGPL library into a distributed application pulls the copyleft obligation across, and section 13 goes further: if you run it as a network service, users of that service are entitled to the corresponding source. Artifex sells a commercial licence precisely to remove that requirement.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The trap is that this decision rarely gets made deliberately. Someone builds the extraction layer on pdfplumber because it is obviously the right tool, ships it, and six months later a different person adds PyMuPDF in a small commit to handle page numbering. The pull request looks trivial. What changed is the licence of the product.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">pypdf and pikepdf are not interchangeable stand-ins for the first two. pypdf is pure Python and genuinely good at the structural layer \u2014 joining documents, splitting off a chapter, rotating a landscape scan, filling a form, lifting the outline \u2014 but it is not the tool to reach for when text fidelity is the point. Its extraction is serviceable and improving; it is not what you choose to recover reading order from a two-column academic paper. pikepdf goes lower still, exposing the object graph and parsed content-stream operators. If you need to repair a broken xref table, strip an embedded font, or hand-assemble a content stream, it is the right instrument. If you want paragraphs, it is the wrong floor of the building.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So the recommendation depends on how you ship.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Closed-source product or hosted service, and you do not want to open your source.<\/strong> Keep the whole pipeline on permissive libraries. pdfplumber or pdfminer.six to read, pypdf for structural edits, pikepdf where you need object-level surgery, reportlab or a similar generator to produce new pages, and Tesseract called directly for scanned pages. If rendering speed becomes the bottleneck, pypdfium2 wraps PDFium under a permissive licence and buys you most of PyMuPDF&#8217;s velocity without the copyleft. You will write more code for the write half. That is the trade.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Internal tooling, a script, or a project already licensed GPL-compatibly.<\/strong> Use PyMuPDF and stop negotiating with yourself. It gives you text, blocks, span-level font and size metadata, drawing objects, table detection, writing and OCR behind one API, and it will process a shelf of books while the pure-Python stack is still on chapter two. The AGPL costs you nothing here because you were never distributing it under a closed licence.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Commercial product that genuinely needs PyMuPDF&#8217;s speed and layout metadata.<\/strong> Budget for the Artifex commercial licence at the design stage rather than after launch. Worth knowing: the licence question lives entirely in the parsing and writing layer, not in the translation step. A pipeline that segments extracted text, sends it to a model and rebuilds the document \u2014 the shape Book Fork takes, with an MIT-licensed core that reads PDF and EPUB and returns both \u2014 can swap its PDF backend without touching anything downstream, which is the argument for keeping extraction behind a thin interface of your own from day one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getting text out in reading order<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Pulling characters out of a PDF is the easy half. Getting them out in the order a human would read them is where pipelines quietly break, and it is worth settling before any translation API sees the text. A segmenter that cuts on sentence boundaries can only work with the sequence you hand it, so scrambled input produces scrambled output no matter how good the model is.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The cheapest thing to try is pdfplumber&#8217;s <em>extract_text(layout=True)<\/em>. It renders the page as a character grid, turning horizontal distance into spaces and vertical position into newlines, and on a clean two-column paper it often looks right on the first attempt. What it leaves behind is the problem. You inherit long runs of padding spaces that have to be squeezed back out, words torn across a gutter, and a layout that degrades the moment the page contains a sidebar, a callout box, a footnote block or a table. Anything downstream that compares strings \u2014 a glossary matcher, a duplicate detector, a sentence splitter \u2014 will trip over the padding. Use it to eyeball a document and confirm the text layer is real. Don&#8217;t build on it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Coordinates are the durable answer. <em>extract_words()<\/em> returns one dictionary per word with x0, x1, top and bottom, and <em>extract_chars()<\/em> gives the same at character level, which matters for CJK and for documents where word gaps were never real space characters in the first place.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The order of operations is: find the columns, then sort inside them. For column boundaries, there is a heuristic that needs almost no per-document tuning. For each candidate x position between the page margins, ask whether any word on the page crosses it, meaning its x0 falls before that position and its x1 falls after. Positions that nothing crosses are safe vertical cuts. Take the widest of those cuts and you have boundaries derived from the document itself rather than from a guessed column count. Then sort the words in each column by top, group them into lines with a y-tolerance of a point or two, and join.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Two things break this. Running headers and footers usually span the full width of the page, so a single one of them can wipe out every candidate cut \u2014 filter them out first, or restrict the crossing test to the middle band of the page. And the test assumes no text spans a column boundary, which holds for most books and falls apart on newsletters and magazine layouts where captions wrap around images.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PyMuPDF takes a different approach: rather than reconstructing structure from geometry, it reports the structure the producer wrote. <em>get_text(&#8220;blocks&#8221;)<\/em> returns tuples of the form (x0, y0, x1, y1, text, block number, block type) in content-stream order, which for most well-made PDFs is reading order. <em>get_text(&#8220;dict&#8221;)<\/em> goes a level deeper, into blocks, then lines, then spans, with each span carrying its font name, size, flags, colour, bounding box and origin point.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That span metadata buys you more than coordinates do. Take the modal span size on the page as the body size, and anything noticeably smaller sitting in the top or bottom band is a header, a footer or a footnote \u2014 no guessing from position alone. Font names and flag bits mark bold and italic variants, so headings and emphasis can be tagged before translation and carried through to the output. Block bounding boxes make column assignment trivial in the common case, because a block rarely straddles a gutter; you can bucket by x0 instead of clustering individual words. Rotated text and vertical writing modes show up here too, which tells you a page needs reorienting before anything else is worth attempting.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Block-level grouping generally beats whitespace heuristics because it comes from the file rather than from an inference about the file. The exception is PDFs built by tools that emit content in drawing order instead of reading order \u2014 some scanner OCR layers and some print-to-PDF drivers do this. If block order looks wrong across a sample of pages, fall back to the coordinate method.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Whichever route you take, every real document needs a cleanup pass before translation:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Running headers, footers and page numbers.<\/strong> Collect candidate lines from the top and bottom bands of each page \u2014 roughly the outer tenth of the page height \u2014 replace digit runs with a placeholder, and drop any normalised string that appears on more than half the pages at a similar y position. Chapter titles in a header survive because they change from page to page; &#8220;Page 14 of 312&#8221; does not.<\/li>\n<li><strong>Line-end hyphenation.<\/strong> A line ending in a hyphen followed by a lowercase word is usually a broken word, but &#8220;well-known&#8221; and &#8220;state-of-the-art&#8221; break that rule. Joining only when the left fragment isn&#8217;t a standalone word, or when the joined form is, handles most cases; a short exception list covers the rest.<\/li>\n<li><strong>Ligatures and invisible characters.<\/strong> Expand \ufb01, \ufb02, \ufb00 and \ufb03 before tokenisation, or &#8220;\ufb01le&#8221; will never match &#8220;file&#8221; in your glossary. NFKC normalisation does this in a single call, but it also rewrites superscripts, fractions and assorted symbols you may want intact, so a targeted mapping is often safer for legal and scientific text. Strip soft hyphens, zero-width spaces and non-breaking spaces while you&#8217;re there.<\/li>\n<li><strong>Whitespace and paragraph repair.<\/strong> Collapse runs of spaces, then rebuild paragraphs from the evidence the page gives you: terminal punctuation, a visibly short line, a greater indent on the next line, or a vertical gap larger than the page&#8217;s median leading all mark a break. Line breaks inside a paragraph become single spaces.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Some pages carry their meaning in a table, and there <em>extract_tables()<\/em> is the right tool \u2014 the default strategy reads ruling lines, which is reliable when the PDF has them. The whitespace-based text strategy is the one that disappoints. It collapses when a cell wraps onto two lines, when a header spans merged cells, or when a column is entirely empty, and it fails quietly: you get a tidy rectangular grid of strings that looks plausible and has the footnotes sitting in the wrong column. Table reconstruction is where generic heuristics fail most often. If a table carries the argument, check a sample by eye, and consider extracting it as structured data to translate separately rather than flattening it back into prose. Commercial tools differ widely on this too, which is what the comparison of <a href=\"https:\/\/bookfork.space\/blog\/2026\/11\/18\/pdf-translator-app-layout-tables-scanned-pages\/\">PDF translator apps that keep layout, tables and scanned pages intact<\/a> covers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What comes out of this stage should be a list of text blocks in a defensible order, with enough metadata to say which are headings, which are page furniture and which are body copy. That is the input the translation step deserves.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The empty extraction branch: scanned and image-only PDFs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A page coming back empty from <strong>extract_text()<\/strong> is not the same as a blank page. In a scanned book or an image-only export, the PDF holds a picture of text and nothing else \u2014 no glyphs, no font resources, no character positions. pdfplumber and PyMuPDF will both return an empty string, and if you don&#8217;t catch that, the page quietly drops out of the pipeline. No exception, no warning, just a missing chapter in the output.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So the first job is a detector, and characters per page is the simplest signal that works. Loop the pages once before any translation starts, strip whitespace from each page&#8217;s extracted text, and record the length alongside whether the page contains at least one image.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n <li><strong>Healthy text page:<\/strong> hundreds to several thousand non-whitespace characters, and font metadata present on the spans.<\/li>\n <li><strong>Image-only page:<\/strong> near-zero characters while the page carries an image object covering most of the page area.<\/li>\n <li><strong>Genuinely blank page:<\/strong> near-zero characters and no image. Versos, section dividers, and end-of-chapter blanks live here. These should be skipped, not sent to OCR.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The threshold is a judgement call rather than a constant. Anything under roughly 20\u201350 characters is worth flagging, and a few legitimately sparse pages \u2014 title pages, part openers, full-page illustrations with a caption \u2014 will trip it. Judge the document as a whole: if a third of the pages are near-empty and carry large images, you have a scan. If it&#8217;s two pages in three hundred, you have front matter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One extra check is worth the five lines it costs. A surprising number of PDFs, especially those sourced from archives or ebook stores, already carry an OCR text layer from some earlier pass. They return characters, so the detector passes them, but the characters may be junk from a different edition, a different language pack, or a page skew that Tesseract handled badly. If the text exists but the span fonts are missing or nonsense, treat the page as image-only and re-OCR rather than trusting it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once a page is classified as image-only, the rule is to route it to OCR and never let it continue down the text branch. Empty inputs are worse than failures, because a failure is visible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are two practical OCR routes in Python, and they produce different artefacts.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table>\n <thead>\n <tr>\n <th>Route<\/th>\n <th>What you get back<\/th>\n <th>Where it fits<\/th>\n <\/tr>\n <\/thead>\n <tbody>\n <tr>\n <td>ocrmypdf<\/td>\n <td>A new PDF containing the original page image with an invisible OCR text layer positioned over it<\/td>\n <td>Pipeline pre-processing: extraction, layout, and rendering code all keep working unchanged<\/td>\n <\/tr>\n <tr>\n <td>pytesseract<\/td>\n <td>Plain text, or word boxes via image_to_data, but no PDF<\/td>\n <td>Extraction-only jobs, or pages you were going to rebuild from scratch anyway<\/td>\n <\/tr>\n <\/tbody>\n<\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>pytesseract<\/strong> is the direct path: render the page with PyMuPDF&#8217;s get_pixmap at a chosen DPI, hand the image to image_to_string, and take the string. It&#8217;s easy to script and fine when text is all you need. The cost is that you throw away the page. Everything visible \u2014 the image, the original typography, the page geometry \u2014 has to be reconstructed or abandoned, because Tesseract gave you a flat run of characters and a set of word boxes you now have to map back onto a layout yourself. Note also that pytesseract shells out to the Tesseract binary on each call, so batching a long document through it means process overhead on every page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ocrmypdf<\/strong> wraps the same Tesseract engine but writes its output as a PDF with a hidden text layer aligned to the scanned image. That alignment is the reason it suits a translation pipeline better. The file still looks exactly like the source, so the visual fidelity of the original pages is preserved for whoever reads the result; the text layer gives you something to extract and translate; and because the result is a normal PDF, the rest of your code \u2014 pdfplumber, PyMuPDF, block clustering, table extraction \u2014 runs against it without a special case. Two flags matter in practice: &#8211;skip-text leaves pages that already have a usable text layer alone, so you don&#8217;t pay for OCR twice, and &#8211;redo-ocr rebuilds bad layers in place. Language packs are installed separately, so a French scan needs the French Tesseract data, not just the default English.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Budget the OCR pass as a separate line item, because it is one. It is CPU-bound and single-threaded per page by default, it scales with DPI and page count, and it is entirely independent of the token cost you&#8217;ve estimated for translation. A 300 DPI render is the usual balance for body text; dropping to 200 speeds things up but loses small type and footnotes, and pushing past 400 mostly buys you longer runtimes. Pre-OCR&#8217;d files should be detected and skipped, not processed again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The compounding argument matters more than the runtime. Every OCR mistake becomes a translation input, and a language model given garbled text does not stop and complain \u2014 it guesses. Broken ligatures, &#8220;rn&#8221; read as &#8220;m&#8221;, dropped diacritics, hyphenated line ends glued into non-words, and columns interleaved by a bad page segmentation all arrive at the translator as plausible-looking tokens. Some of them will be rendered back as fluent, confident, wrong sentences. Glossary matching fails the same way: a term that OCR spelled as &#8220;Phaedrus&#8221; in one place and &#8220;Phaedrus&#8221; with a stray character in another will miss the glossary entry entirely, so your carefully enforced terminology silently stops applying.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That makes OCR quality a ceiling on everything downstream. No amount of prompt engineering, glossary work, or review discipline recovers text that was destroyed before segmentation. The cheap safeguard is to sample: pull three or four OCR&#8217;d pages, read the extracted text against the page image, and check whether the errors cluster around a specific cause \u2014 skew, a two-column layout, footnotes, small caps. Fixing page segmentation or deskewing before the full run is far cheaper than catching it in a finished translation. Where the OCR engine exposes per-word confidence, log the low-confidence words as a review queue for whoever validates the output.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For a document pipeline like Book Fork, which segments a PDF on sentence boundaries before sending anything to a model, image-only pages are invisible dead weight \u2014 there is nothing to segment, so nothing gets translated and nothing appears in the returned file. Getting the OCR pass right, and running it before the document enters the pipeline rather than after, is the difference between a translated book and a book with holes in it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Cutting the page into units you can translate<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">By the time text leaves <code>pdfplumber<\/code> or PyMuPDF it is already a pile of fragments, and the decision you make next \u2014 how big a chunk to hand the translation model \u2014 quietly sets the ceiling on output quality. There are three practical granularities: whole pages, raw PDF spans or lines, and proper sentences. They differ on four axes that matter more than they first appear: translation quality, cost, cache hit rate, and whether a crashed job can pick up where it stopped.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<thead>\n<tr>\n<th>Unit<\/th>\n<th>Translation quality<\/th>\n<th>Cost behaviour<\/th>\n<th>Cache and resume<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Page<\/td>\n<td>Poor. Sentence boundaries and discourse structure collapse.<\/td>\n<td>Few requests, but one bad paragraph forces a re-send of the whole page.<\/td>\n<td>Almost none. Any edit to a page invalidates the entire unit.<\/td>\n<\/tr>\n<tr>\n<td>Span \/ line<\/td>\n<td>Poor for the opposite reason. Too little context to resolve grammar.<\/td>\n<td>Many small requests; per-request overhead dominates.<\/td>\n<td>Fine-grained but unusable, because the units are semantically broken.<\/td>\n<\/tr>\n<tr>\n<td>Sentence<\/td>\n<td>Good compromise. Enough context for agreement, tense, and pronouns.<\/td>\n<td>Moderate request count with predictable token totals.<\/td>\n<td>Excellent. Each unit hashes independently and resumes cleanly.<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Per-page translation looks like the economical choice and isn&#8217;t. The model receives a wall of text with paragraph breaks flattened, no reliable line endings, and headers and footers mixed into the body. It responds by smoothing everything into run-on prose: sentences merge, dialogue loses its speaker turns, list items get absorbed into the sentence that precedes them. You also lose the ability to retry anything cheaply. If page 214 of 300 comes back mangled, your only remedy is to re-send page 214 entire, at full token cost, and hope the sampling lands better.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Span-level calls fail for the reverse reason. A span in PyMuPDF&#8217;s <code>get_text(\"dict\")<\/code> output is a run of characters sharing a font, size, and style, which means an italicised word or a superscript footnote marker becomes its own translation unit. Hand a model the string <em>Cambridge<\/em> on its own and it has no way to know whether it is a university, a city, or a surname. Hand it three words that happen to share a typeface and the model will invent the grammar to hold them together, producing fragments that read like a bad phrasebook. Request count balloons at the same time, and since most providers bill per token, you mostly gain overhead rather than savings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sentence-level segmentation is the working compromise, and it has a second benefit that has nothing to do with linguistics: a sentence is a stable, self-contained key. Hash the segment text together with the target language and the glossary version, and you have a cache entry that survives edits elsewhere in the document. Change one paragraph on page 40 and the other 299 pages still hit the cache. It is also the unit that makes resumption sane \u2014 a killed job restarts at the first segment without a stored result, not at the first page. That is the same design <a href=\"\/how-it-works\">Book Fork<\/a> uses: jobs survive restarts, completed segments are never retranslated, and failed segments retry on their own.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The honest part is that sentence splitters break constantly, and every mistake becomes a visible artefact in the target text.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Abbreviations.<\/strong> &#8220;Dr. Smith arrived&#8221; splits after &#8220;Dr.&#8221; unless your splitter carries an exception list. The orphaned fragment then gets translated as a standalone sentence, so the model capitalises it and supplies a verb the original never had. The same trap sits in &#8220;Fig. 4&#8221;, &#8220;No. 12&#8221;, &#8220;e.g.&#8221;, &#8220;i.e.&#8221;, &#8220;vs.&#8221;, initials such as &#8220;J. R. R. Tolkien&#8221;, and any decimal point \u2014 &#8220;3.5 million&#8221; is a sentence boundary to a naive regex.<\/li>\n<li><strong>Languages without a full stop.<\/strong> Thai uses spaces between clauses and no terminal punctuation at all, so a period-based splitter returns one enormous segment per paragraph, or per document. Japanese and Chinese terminate sentences with \u3002 and \uff01 and \uff1f, and often close them with a quotation mark, so splitting on the period alone leaves the bracket in the wrong segment and the model may translate a closing quote as opening.<\/li>\n<li><strong>CJK punctuation and spacing.<\/strong> Full-width punctuation (\u3001\u3002\u300c\u300d\u300e\u300f) does not behave like its Latin counterparts. Ellipses &#8220;\u2026\u2026&#8221; and dashes &#8220;\u2014\u2014&#8221; are doubled characters, and splitting between them produces two half-punctuated fragments that no model can rejoin correctly.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For Latin-script languages, a dedicated splitter earns its dependency. <code>pysbd<\/code> and <code>syntok<\/code> both ship abbreviation handling for several languages, and spaCy&#8217;s trained pipelines segment well if you already have the model loaded for other reasons. Regex on <code>[.!?]<\/code> is not a segmenter, and the artefacts it produces \u2014 mid-sentence capitals, duplicated subjects, sentences that begin with &#8220;and&#8221; because the clause before them was severed \u2014 are the ones readers notice first. A useful sanity check is to log the length distribution of your segments: a long tail of three-word units means the splitter is over-firing, and units of several thousand characters mean it is not firing at all.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One last detail worth protecting: URLs, emails, and inline code should be masked before segmentation and restored afterwards. A full stop inside <code>example.com<\/code> is a sentence boundary to anything that isn&#8217;t told otherwise, and a URL that has been split across two segments will be translated \u2014 mangled \u2014 as prose.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>About Book Fork<\/strong>: Book Fork is an open-source, multilingual document translation product for EPUB and PDF files. It parses documents, segments text, and runs glossary-aware, resumable translation through an OpenAI-compatible model chosen by the user, returning finished PDF and EPUB files with structure, chapters, and layout intact. It is aimed at authors and publishers, translators and editors, agencies and studios, and developers. Users can bring their own OpenAI-compatible model for free or use a Book Fork-managed book for a flat $7 per book, up to 1,000 pages. Learn more at <a href=\"https:\/\/bookfork.space\/en\/\">Book Fork<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-group ezdistro-related has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n\n<h2 class=\"wp-block-heading\">Related<\/h2>\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/bookfork.space\/blog\/2026\/11\/18\/translate-word-document-automatically\/\" target=\"_blank\" rel=\"noopener\">DOCX keeps its structure, which is why the Word path is a different problem<\/a><\/li><li><a href=\"https:\/\/bookfork.space\/blog\/2026\/11\/18\/pdf-translator-app-layout-tables-scanned-pages\/\" target=\"_blank\" rel=\"noopener\">the layout-is-the-document problem, and why columns and tables come back scrambled<\/a><\/li><\/ul>\n\n<\/div>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/bookfork.space\/blog\/wp-content\/uploads\/2026\/11\/pdf-translator-python-how-to-translate-a-pdf-with-python-pdfplumber-pymupdf-and-translation-apis-section-0-rkxjz5.webp\" alt=\"A three-lane diagram of extraction, segmentation and translation, and reassembly, with amber badges marking a severed block, an offset slot and a line overflowing its frame at each junction.\" width=\"1600\" height=\"880\" loading=\"lazy\" decoding=\"async\"><figcaption class=\"wp-element-caption\">The three joins where PDF translation pipelines break: broken segments, off-by-one alignment, and text that no longer fits its box.<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Build a PDF translator in Python: extract reading order with pdfplumber or PyMuPDF, OCR scans, segment sentences, call translation APIs, and handle fonts and tables.<\/p>\n","protected":false},"author":1,"featured_media":402,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-405","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-translation-automation"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.5.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Build a PDF translator in Python: extract reading order with pdfplumber or PyMuPDF, OCR scans, segment sentences, call translation APIs, and handle fonts and tables.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"rastin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.5.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Book Fork Blog -\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs - Book Fork Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Build a PDF translator in Python: extract reading order with pdfplumber or PyMuPDF, OCR scans, segment sentences, call translation APIs, and handle fonts and tables.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-11-19T01:28:47+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-11-19T01:28:48+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs - Book Fork Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Build a PDF translator in Python: extract reading order with pdfplumber or PyMuPDF, OCR scans, segment sentences, call translation APIs, and handle fonts and tables.\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/#blogposting\",\"name\":\"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs - Book Fork Blog\",\"headline\":\"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs\",\"author\":{\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/author\\\/rastin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/pdf-translator-python-how-to-translate-a-pdf-with-python-pdfplumber-pymupdf-and-translation-apis-cover-xg5t27.webp\",\"width\":1536,\"height\":1536,\"caption\":\"Extraction, segmentation and translation, reassembly: the failures cluster at the joins between stages, not inside the model.\"},\"datePublished\":\"2026-11-19T01:28:47+00:00\",\"dateModified\":\"2026-11-19T01:28:48+00:00\",\"inLanguage\":\"en-US\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/#webpage\"},\"articleSection\":\"Translation Automation\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/category\\\/translation-automation\\\/#listItem\",\"name\":\"Translation Automation\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/category\\\/translation-automation\\\/#listItem\",\"position\":2,\"name\":\"Translation Automation\",\"item\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/category\\\/translation-automation\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/#listItem\",\"name\":\"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/#listItem\",\"position\":3,\"name\":\"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/category\\\/translation-automation\\\/#listItem\",\"name\":\"Translation Automation\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/#organization\",\"name\":\"Book Fork Blog\",\"url\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/author\\\/rastin\\\/#author\",\"url\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/author\\\/rastin\\\/\",\"name\":\"rastin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/#authorImage\",\"url\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/wp-content\\\/litespeed\\\/avatar\\\/c894b6c744198ca55c9cba25784289a7.jpg?ver=1795605602\",\"width\":96,\"height\":96,\"caption\":\"rastin\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/#webpage\",\"url\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/\",\"name\":\"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs - Book Fork Blog\",\"description\":\"Build a PDF translator in Python: extract reading order with pdfplumber or PyMuPDF, OCR scans, segment sentences, call translation APIs, and handle fonts and tables.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/author\\\/rastin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/author\\\/rastin\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/pdf-translator-python-how-to-translate-a-pdf-with-python-pdfplumber-pymupdf-and-translation-apis-cover-xg5t27.webp\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/#mainImage\",\"width\":1536,\"height\":1536,\"caption\":\"Extraction, segmentation and translation, reassembly: the failures cluster at the joins between stages, not inside the model.\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/2026\\\/11\\\/19\\\/pdf-translator-python\\\/#mainImage\"},\"datePublished\":\"2026-11-19T01:28:47+00:00\",\"dateModified\":\"2026-11-19T01:28:48+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/\",\"name\":\"Book Fork Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/bookfork.space\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs - Book Fork Blog","description":"Build a PDF translator in Python: extract reading order with pdfplumber or PyMuPDF, OCR scans, segment sentences, call translation APIs, and handle fonts and tables.","canonical_url":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/#blogposting","name":"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs - Book Fork Blog","headline":"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs","author":{"@id":"https:\/\/bookfork.space\/blog\/author\/rastin\/#author"},"publisher":{"@id":"https:\/\/bookfork.space\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/bookfork.space\/blog\/wp-content\/uploads\/2026\/11\/pdf-translator-python-how-to-translate-a-pdf-with-python-pdfplumber-pymupdf-and-translation-apis-cover-xg5t27.webp","width":1536,"height":1536,"caption":"Extraction, segmentation and translation, reassembly: the failures cluster at the joins between stages, not inside the model."},"datePublished":"2026-11-19T01:28:47+00:00","dateModified":"2026-11-19T01:28:48+00:00","inLanguage":"en-US","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/#webpage"},"isPartOf":{"@id":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/#webpage"},"articleSection":"Translation Automation"},{"@type":"BreadcrumbList","@id":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/bookfork.space\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/bookfork.space\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/bookfork.space\/blog\/category\/translation-automation\/#listItem","name":"Translation Automation"}},{"@type":"ListItem","@id":"https:\/\/bookfork.space\/blog\/category\/translation-automation\/#listItem","position":2,"name":"Translation Automation","item":"https:\/\/bookfork.space\/blog\/category\/translation-automation\/","nextItem":{"@type":"ListItem","@id":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/#listItem","name":"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs"},"previousItem":{"@type":"ListItem","@id":"https:\/\/bookfork.space\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/#listItem","position":3,"name":"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs","previousItem":{"@type":"ListItem","@id":"https:\/\/bookfork.space\/blog\/category\/translation-automation\/#listItem","name":"Translation Automation"}}]},{"@type":"Organization","@id":"https:\/\/bookfork.space\/blog\/#organization","name":"Book Fork Blog","url":"https:\/\/bookfork.space\/blog\/"},{"@type":"Person","@id":"https:\/\/bookfork.space\/blog\/author\/rastin\/#author","url":"https:\/\/bookfork.space\/blog\/author\/rastin\/","name":"rastin","image":{"@type":"ImageObject","@id":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/#authorImage","url":"https:\/\/bookfork.space\/blog\/wp-content\/litespeed\/avatar\/c894b6c744198ca55c9cba25784289a7.jpg?ver=1795605602","width":96,"height":96,"caption":"rastin"}},{"@type":"WebPage","@id":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/#webpage","url":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/","name":"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs - Book Fork Blog","description":"Build a PDF translator in Python: extract reading order with pdfplumber or PyMuPDF, OCR scans, segment sentences, call translation APIs, and handle fonts and tables.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/bookfork.space\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/#breadcrumblist"},"author":{"@id":"https:\/\/bookfork.space\/blog\/author\/rastin\/#author"},"creator":{"@id":"https:\/\/bookfork.space\/blog\/author\/rastin\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/bookfork.space\/blog\/wp-content\/uploads\/2026\/11\/pdf-translator-python-how-to-translate-a-pdf-with-python-pdfplumber-pymupdf-and-translation-apis-cover-xg5t27.webp","@id":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/#mainImage","width":1536,"height":1536,"caption":"Extraction, segmentation and translation, reassembly: the failures cluster at the joins between stages, not inside the model."},"primaryImageOfPage":{"@id":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/#mainImage"},"datePublished":"2026-11-19T01:28:47+00:00","dateModified":"2026-11-19T01:28:48+00:00"},{"@type":"WebSite","@id":"https:\/\/bookfork.space\/blog\/#website","url":"https:\/\/bookfork.space\/blog\/","name":"Book Fork Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/bookfork.space\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Book Fork Blog -","og:type":"article","og:title":"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs - Book Fork Blog","og:description":"Build a PDF translator in Python: extract reading order with pdfplumber or PyMuPDF, OCR scans, segment sentences, call translation APIs, and handle fonts and tables.","og:url":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/","article:published_time":"2026-11-19T01:28:47+00:00","article:modified_time":"2026-11-19T01:28:48+00:00","twitter:card":"summary_large_image","twitter:title":"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs - Book Fork Blog","twitter:description":"Build a PDF translator in Python: extract reading order with pdfplumber or PyMuPDF, OCR scans, segment sentences, call translation APIs, and handle fonts and tables."},"aioseo_meta_data":{"post_id":"405","title":null,"description":null,"keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":true,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-11-19 01:50:22","updated":"2026-11-19 01:50:22"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/bookfork.space\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/bookfork.space\/blog\/category\/translation-automation\/\" title=\"Translation Automation\">Translation Automation<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tpdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/bookfork.space\/blog\/"},{"label":"Translation Automation","link":"https:\/\/bookfork.space\/blog\/category\/translation-automation\/"},{"label":"pdf translator python | How to Translate a PDF with Python: pdfplumber, PyMuPDF, and Translation APIs","link":"https:\/\/bookfork.space\/blog\/2026\/11\/19\/pdf-translator-python\/"}],"_links":{"self":[{"href":"https:\/\/bookfork.space\/blog\/wp-json\/wp\/v2\/posts\/405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bookfork.space\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bookfork.space\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bookfork.space\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bookfork.space\/blog\/wp-json\/wp\/v2\/comments?post=405"}],"version-history":[{"count":1,"href":"https:\/\/bookfork.space\/blog\/wp-json\/wp\/v2\/posts\/405\/revisions"}],"predecessor-version":[{"id":406,"href":"https:\/\/bookfork.space\/blog\/wp-json\/wp\/v2\/posts\/405\/revisions\/406"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bookfork.space\/blog\/wp-json\/wp\/v2\/media\/402"}],"wp:attachment":[{"href":"https:\/\/bookfork.space\/blog\/wp-json\/wp\/v2\/media?parent=405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bookfork.space\/blog\/wp-json\/wp\/v2\/categories?post=405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bookfork.space\/blog\/wp-json\/wp\/v2\/tags?post=405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}