[Bug]: FreeText annotations with Czech characters lose accented letters when exported with `saveAsCopy()`
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, typescript
- Ambito
- backend-api-design
Direzione di ricerca
Start by running the reproduction testbed linked in the issue with @embedpdf/snippet@2, then trace how exportPlugin.saveAsCopy() serializes FreeText annotation text and its font into the exported PDF. Compare the exported text stream with the original Czech pangram to locate where characters are dropped. Done when the exported PDF preserves all listed Czech characters in standard PDF viewers; the issue names no source files or tests.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
When I export a document containing FreeText annotations with Czech characters using exportPlugin.saveAsCopy(), several accented letters disappear in external PDF viewers (such as Google Chrome or Okular).
For example, typing the Czech pangram:
Příliš žluťoučký kůň úpěl ďábelské ódy (č, š, ž, ř, ď, ť, ň, ě, ů)
renders in the exported PDF as:
Píliš žluouký k úpl ábelské ódy (, š, ž, , , , , , )
I am not an expert on the PDF format internals, but encoding of Czech characters seems to be broken, perhaps UTF-8 is not supported in the exported font?
Environment
@embedpdf/snippet@2- Export method:
exportPlugin.saveAsCopy() - Viewers tested:
- Google Chrome
- Firefox
- Okular
Steps to Reproduce
You can run the standalone reproduction testbed reproduce_issue.html or run the following snippet:
<!DOCTYPE html>
<html>
<body>
<div id="pdf-viewer" style="width: 100vw; height: 100vh;"></div>
<script type="module">
import EmbedPDF from 'https://cdn.jsdelivr.net/npm/@embedpdf/snippet@2/dist/embedpdf.js';
const viewer = EmbedPDF.init({
type: 'container',
target: document.getElementById('pdf-viewer'),
src: '/sample.pdf'
});
const registry = await viewer.registry;
const annotationApi = registry.getPlugin('annotation').provides();
const exportPlugin = registry.getPlugin('export').provides();
// 1. Add a FreeText annotation with Czech characters
await annotationApi.importAnnotations([
{
annotation: {
id: 'czech-pangram',
type: 3, // FREETEXT
pageIndex: 0,
contents: 'Příliš žluťoučký kůň úpěl ďábelské ódy (č, š, ž, ř, ď, ť, ň, ě, ů)',
rect: {
origin: { x: 50, y: 180 },
size: { width: 480, height: 50 }
},
fontSize: 14,
fontColor: '#000000'
}
}
]);
// 2. Export the PDF
const arrayBuffer = await exportPlugin.saveAsCopy().toPromise();
// 3. Download the PDF and open it in Chrome, Acrobat, or Preview
const blob = new Blob([arrayBuffer], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'exported.pdf';
a.click();
</script>
</body>
</html>
What I See (Observed Results)
- Inside the EmbedPDF web viewer, the text displays completely fine with all Czech diacritics visible.
- When downloading the exported PDF and opening it in any standard viewer (Chrome, Acrobat Reader, Apple Preview, etc.):
- Original input:
Příliš žluťoučký kůň úpěl ďábelské ódy (č, š, ž, ř, ď, ť, ň, ě, ů) - Rendered in PDF:
Píliš žluouký k úpl ábelské ódy (, š, ž, , , , , , )
- Original input:
- Notice that letters like
šandžare kept, but letters likeč, ř, ď, ť, ň, ě, ůare completely dropped. - When inspecting the raw PDF text rendering stream in Python (
pypdf), the missing letters appear to be completely omitted from the text stream:(P) Tj % Missing 'ř' (from 'Příliš') -> rendered as 'Píliš' (\xedli\x9a \x9elu) Tj (ou) Tj % Missing 'ť' and 'č' (from 'žluťoučký') -> rendered as 'žluou' (k\xfd k) Tj ( \xfap) Tj (l ) Tj % Missing 'ě' (from 'úpěl') -> rendered as 'úp l' (\xe1belsk\xe9 \xf3dy \() Tj % Missing 'ď' (from 'ďábelské') -> rendered as 'ábelské' (, \x9a, \x9e, ) Tj % Only 'š' and 'ž' exist; 'č' is dropped (, ) Tj % Missing 'ř' (, ) Tj % Missing 'ď' (, ) Tj % Missing 'ť' (, ) Tj % Missing 'ň' (, ) Tj % Missing 'ě' (, ) Tj % Missing 'ů' (\)) Tj
Expected Behavior
The exported PDF should display all characters typed into the text annotation, including all Czech letters and diacritics (č, ř, ď, ť, ň, ě, ů), just like they look inside the web viewer.
Files
- Lingua principale
- TypeScript
- Stelle
- 4.5k
- Fork
- 317
- Merge medio
- 10h 16m
- PR unite (30g)
- 174
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di embedpdf/embed-pdf-viewer
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
embedpdf/embed-pdf-viewer#1098 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
embedpdf/embed-pdf-viewer#921 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
embedpdf/embed-pdf-viewer#889 ·
I maintainer di solito rispondono entro 1 giorno
-
[v2] TaskQueue: equal-priority tasks can run out of order when a randomUUID id starts with digitsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
embedpdf/embed-pdf-viewer#874 ·
I maintainer di solito rispondono entro 1 giorno
-
Free text stays scrolled to the caret after editing endsForse già presa @chahore l’ha presa 36 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
embedpdf/embed-pdf-viewer#861 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di embedpdf/embed-pdf-viewer
Issue simili
-
area-templates triage:bot-seen triage:needs-human
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
microsoft/aspire#22356 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Archiving an agent that is not loaded keeps its old updatedAtForse già presa @luoph l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
content triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
contributor: external needs review severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
expo/expo#53642 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
JSPrismarine/JSPrismarine#3214 ·
I maintainer di solito rispondono entro 1 giorno