Exporting and sharing your book PDF
Three ways to get a merged PDF out of a project. All three run as async jobs on the worker — the request comes back immediately with a status and the PDF lands seconds to minutes later depending on page count.
The three modes
- Translated pages only (translate-intent only) — merges every
COMPLETED page's rendered PDF, in page order. Skips pages still waiting for translation.
- All pages — includes UPLOADED and NEEDS_REVIEW pages by
wrapping their source scan via img2pdf so the export has a placeholder for every page. Scan-only projects automatically use this mode since they never have "translated" PDFs.
- Selected pages only — appears in the export modal when you're
in selection mode with at least one page selected.
- Share as link — instead of downloading, mints a public URL
(api.babelpage.com/share/{token}) you can send anyone. The recipient's browser opens it, waits on a branded "Preparing…" page if needed, and gets the PDF. No account required. Default expiry: 30 days. Revokable from the project.
How the async pipeline works
- Tap Export → pick a mode → confirm.
- Backend creates an
export_jobsrow and enqueues a Celery task.
Response returns immediately with the job ID.
- Mobile polls
GET /export-jobs/{id}every 2.5s. Modal shows a
"Merging pages…" spinner.
- Worker downloads each page's PDF (or wraps its source image),
merges via PyPDF2, uploads the result to projects/{id}/exports/{jobId}.pdf on GCS.
- Once the job flips to COMPLETED, the mobile grabs a signed URL
and streams the PDF to the OS share sheet.
Why the "Preparing your PDF…" page for share links
Share links let recipients open a URL immediately, but the merge is still async. When they hit the link before the worker finishes, the share endpoint returns a small branded holding page that auto- refreshes every 5 s. As soon as the job completes, the next refresh 302-redirects to the signed GCS URL and the PDF opens.