Skip to content
halilibrahimd27Public

About

Translate PDF and DOCX papers in your browser and keep their layout — automatic, private, with a meaning check for academic text. No backend.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

303 Commits

Folders and files

Repository files navigation

samepage

Same page, new language.
Translate a PDF, Word or PowerPoint document in your browser and get the same document back —
headings, tables, figures, formulas, footnotes and page layout intact.

Open samepage · Demo paper · How it works · Privacy

Live CI License: AGPL-3.0

A Turkish demo paper translated into English: quality report and side-by-side preview

samepage is built for academics who need their paper in another language — English, German, Turkish and 14 more — looking like the original, without uploading it anywhere, without an account and without paying for an API, and without a translation that quietly changes what the paper says.

Features

  • Same layout. PDFs are re-typeset into their original boxes with matching fonts. Word and PowerPoint files keep every style, table, equation, chart, footnote and speaker note. A side-by-side PDF (original | translation) comes with every PDF.
  • LaTeX and Overleaf. Drop a .tex file or a project .zip (Overleaf: Menu → Download → Source): the prose is translated and every command, formula, citation, reference and label is kept, the document language switched in babel/polyglossia. The project comes back as a .zip you can upload to Overleaf again.
  • Editable Word file of a PDF. Every translated PDF also downloads as a Word document laid out like the PDF — its margins, one or two columns, type sizes, leading, indents and justification, the title block and wide tables across both columns, an author grid as on the page — in Word's own styles, so it also takes a journal's template. Headings, paragraphs, tables and footnotes are text you can edit, figures and display formulas pictures. Tables are found with full, booktabs or single rules and also without any rule, from their caption, and keep their rules and column alignment; footnote marks become Word footnotes and every reference entry its own paragraph.
  • Meaning first. Numbers, units, citations, formulas and identifiers are locked. Each paragraph is translated from its own language — an English abstract in a Turkish paper, a German quotation, the Arabic body of a paper with an English abstract — and one already in the target language stays as written. Code in Word and PowerPoint files (commands, listings) stays as written. A meaning check translates the result back and flags lost negations, softened or hardened claims ("results suggest" → "results reveal") and changed quantifiers ("most" → "all"), asking again in English before it reports one. You can compare every paragraph sentence by sentence, even in a language you do not read. With your own Claude key, the flagged sentences are revised automatically (British or American spelling).
  • Abstract only. For journals that ask for a second-language abstract: samepage finds the title, abstract and keywords, lets you edit them and translates just those.
  • References the APA way. The reference list stays as published; optionally, titles in another language get their translation in brackets after them (APA 7): “Makine çevirisi [Machine translation].”
  • A glossary from your paper. Tool names, code and field terms ("confidence interval", "randomized controlled trial") are suggested to keep or translate consistently. Nothing is applied until you tick it. Share a glossary with your lab as a pack (one spreadsheet with a column per language) or import a TBX termbase (IATE exports one); each person takes the columns of their own language pair.
  • Save your work as a project. A .samepage file keeps the document, its translation, your corrections and glossary. Open it later — in any browser, on any computer — and carry on without translating again. API keys are never saved in it.
  • An honest quality report. A layout score per page and every compromise listed — nothing is dropped or shrunk silently: a lost percent sign or bracket, a misread number in a scan, a table that was not recognised. Correct any paragraph and rebuild the document in place.
  • Scanned papers too. PDFs without a text layer are read with OCR on your device.
  • Private by design. No backend, no account, no analytics. Your glossary and the translation cache stay in your browser.

How it works

  1. Drop a PDF (text-based or scanned), DOCX, PPTX or LaTeX (.tex or a project .zip). The source language is detected; choose the target language.
  2. Choose Whole document, or Title, abstract and keywords, and press Translate.
  3. Read the quality report: its summary line gives the score; "needs attention" and "meaning check" list what deserves a look.
  4. Download the translated document, the side-by-side PDF, an editable Word file (for PDFs) or the report.

Demo: the Turkish demo paper translated into English, its quality report and side-by-side preview, then its title and abstract alone

It works the same on a phone:

samepage on a phone: the demo paper chosen and its language detected     samepage on a phone: downloads, quality report and preview after the translation

Interface: English, Turkish, German, French and Spanish.

Languages: Turkish, English, German, French, Spanish, Italian, Portuguese, Dutch, Polish, Czech, Romanian, Hungarian, Swedish, Russian, Ukrainian, Bulgarian and Greek — in any direction.

Browser extension

extension/ adds Translate this PDF with samepage to the context menu of a PDF tab or link (Chrome, Edge, Firefox): the PDF opens in samepage without saving it first. From Zotero, drag a PDF attachment onto the samepage page.

Privacy and engines

samepage is a static site with no backend. Your document is opened, analysed and rebuilt entirely inside your browser; the file itself never leaves your device. Only the text that needs translating is sent, and only to the engine you choose:

Engine Where your text goes
Google Translate (default) Google, through Google's website translator. Works on phones.
Chrome built-in translator Nowhere — translated on your device (desktop Chrome and Edge)
Advanced: Claude API / local LLM Anthropic under your own key, or your own computer (localhost)
Optional: polish with Claude Only the sentences the meaning check flags, to Anthropic under your own key
  • No analytics, no telemetry, no third-party scripts in the app. Fonts, OCR models and WebAssembly are served from this site, and a Content Security Policy limits the app's own connections. The one exception is the Google engine: Google's translator script runs in a separate, invisible helper page (translate.html, same site, its own stricter policy), loaded only when you translate with Google. It may set Google's own googtrans cookie. That page is on the same site as the app, so Google's script could read what the app keeps in this browser (glossary, translation cache, a remembered API key); if that matters to you, don't remember keys on this device, or translate with the Chrome built-in engine.
  • The glossary and the translation cache live only in this browser (IndexedDB) and can be cleared in Settings. API keys for the advanced engines are kept in memory unless you choose to remember them on this device.

Quality contract

  1. Meaning first. Academic text must not drift in meaning. Every translation is validated (numbers, citations, formulas, formatting, language) and retried when it fails; the meaning check flags what validation cannot see. samepage never shortens or paraphrases body text to make it fit the page.
  2. Word and PowerPoint — structure-perfect. Only the text is swapped. Fixed-size containers are repaired (rows grow, text boxes fit their text, slide text uses PowerPoint's own shrink-on-overflow) and every repair is reported.
  3. PDF — near-identical layout. When a translation does not fit, the layout repair engine uses free space, careful typography and consistent scaling; as a last resort it keeps a label in the original with the translation as a PDF note, or moves the end of a paragraph to overflow notes. Every compromise is reported.

How it is tested

Besides unit, golden and end-to-end tests on synthetic documents, samepage is checked against 88 real open-access papers in 17 languages — the scores by language and field are on the quality page — engineering, mathematics, physics, chemistry, medicine, nursing, public health, computer science, biology, economics and law — plus round trips (a paper translated into another language and back) to measure meaning drift. In live runs with the free Google engine on 29 papers in all 17 languages (about 8,100 paragraphs, including chemistry, law and mathematical physics), 99.9 % of the paragraphs came out translated with their numbers intact; the rest, OCR noise of a 1979 scan, were kept in the original and reported. About 2 % carried a warning to review. Word documents were run the same way: 54 papers from Zenodo in 19 languages (about 14,300 paragraphs, with code, tables, footnotes, text boxes, Arabic and mixed-language papers), 99.9 % translated, 2.2 % with a warning, the structure of every file intact. Those papers are not part of this repository; media/demo-paper.pdf is a fictional paper written for the demo, so you can try samepage with it.

Limitations

  • Not supported: right-to-left and CJK target languages, right-to-left and CJK PDFs, vertical CJK, encrypted PDFs, form field values and text inside raster images (left untouched and reported). Arabic, Hebrew, Persian, Chinese, Japanese or Korean passages in a Word or PowerPoint file are translated from their language into the offered ones (right-to-left text then reads left to right).
  • OCR errors (rare letters, names, small print) carry into the translation of scanned PDFs, and the scanned text is covered with the paper colour rather than removed; hard-to-read pages are flagged.
  • Inline math in PDFs is re-set in the Noto fonts; display formulas are left untouched.
  • Private-use symbols without a Unicode meaning can be lost (reported per page). A page whose text cannot be removed without moving the text around it is rewritten from a normalised copy, or kept as it is with the translations as PDF notes (reported).
  • On pages dense with display formulas, a longer translation may not fit between two formulas; the lines then touch and the page is marked "Needs review". The Word file is not affected.
  • A math glyph the PDF gives no character for (often a large ∑ or √) is printed as "�" in the translated PDF rather than guessed, and in the Word file such a small symbol comes after its paragraph as a picture instead of inside the line.
  • The Word file uses fonts every computer has (Times New Roman for an unknown serif), so its pages run longer than the PDF's, and figures follow the reading order.
  • Very long PDFs (hundreds of pages) need a lot of memory; translate them in page ranges.
  • Translation quality depends on the engine. The meaning check flags paragraphs where a negation, a hedge, a quantity or a number may have changed, and repairs what it can; always review academic text before publishing.

Development

Requirements: Node.js 24+.

npm ci
npm run dev          # local dev server
npm run build        # production build (base /samepage/, CSP injected)
npm run test         # unit + property tests
npm run test:golden  # DOCX/PDF golden, identity and layout-fidelity tests
npm run test:e2e     # Playwright end-to-end tests (production build)
npm run fixtures     # regenerate the synthetic corpus (LaTeX needs tectonic)
npm run bench:fetch  # download the benchmark's open-access papers (not part of the repository)
npm run bench        # structure benchmark: tables, footnotes, references, lost words per paper

See CONTRIBUTING.md for the architecture overview and the rules contributions must follow. The site is fully static: to self-host, serve the dist/ folder from any web server. The CSP is generated from build/csp.ts; widen connect-src there to use another translation endpoint.

License

AGPL-3.0-only. samepage uses MuPDF.js (AGPL) for PDF processing. Bundled Noto fonts (including Noto Sans Math) are licensed under the SIL Open Font License (public/fonts/OFL.txt). OCR uses Tesseract through tesseract.js-core and the best_int language models (Apache-2.0), served from this site. The demo paper and all test documents are synthetic and part of this repository.

About

Translate PDF and DOCX papers in your browser and keep their layout — automatic, private, with a meaning check for academic text. No backend.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages