[Bug]: Exported annotations are completely invisible in Mobile Chrome (pen, highlighter, shapes via `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
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, typescript
Direzione di ricerca
Start by reading the export plugin entry point and the annotation export code that handles saveAsCopy(), then inspect the attached exported PDF for how its annotations are serialized. Compare the exported annotations with PDF viewer expectations for appearance streams and check existing export tests. Done means exported ink, highlighter, text, and shape annotations render with their intended appearance in Chrome and Firefox as well as Acrobat.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
When I export a document containing annotations (pen drawings, highlighters, text notes, shapes) using exportPlugin.saveAsCopy(), the exported PDF renders inconsistently across different PDF viewers:
- Mobile Chrome (Android & iOS): All annotations are completely invisible. The document opens, but none of the drawn pen strokes, highlighters, or markings show up at all.
- Desktop Adobe Acrobat: Looks as it should.
I am not an expert on the PDF format internals, but from inspecting the generated PDF structure, I suspect this might be due to a missing /AP (appearance stream) on the exported annotations, causing viewers without built-in fallback renderers (like mobile Chrome) to ignore them entirely.
Environment
@embedpdf/snippet@2- Export method:
exportPlugin.saveAsCopy() - Viewers tested:
- Google Chrome on Android (annotations completely invisible)
- Desktop Adobe Acrobat -- all good
Tested Annotation Types
This affects multiple annotation and pen types created in EmbedPDF:
- Ink (Pen): Freehand pen drawings (red, blue, etc.)
- Ink Highlighter: Translucent highlighter strokes
- FreeText: Text notes
- Shapes: Lines, rectangles, and circles
Steps to Reproduce
You can run the standalone testbed reproduce_issue.html or use 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. Draw or import ink / highlighter / text annotations
await annotationApi.importAnnotations([
{
annotation: {
id: 'pen-red',
type: 15,
pageIndex: 0,
rect: { origin: { x: 80, y: 80 }, size: { width: 260, height: 60 } },
inkList: [{ points: [{ x: 80, y: 80 }, { x: 160, y: 140 }, { x: 240, y: 80 }, { x: 340, y: 140 }] }],
strokeWidth: 4,
strokeColor: '#E44234',
opacity: 1.0
}
},
{
annotation: {
id: 'highlighter-yellow',
type: 15,
pageIndex: 0,
intent: 'InkHighlight',
rect: { origin: { x: 80, y: 220 }, size: { width: 320, height: 26 } },
inkList: [{ points: [{ x: 80, y: 233 }, { x: 400, y: 233 }] }],
strokeWidth: 22,
strokeColor: '#FFCD45',
opacity: 0.5
}
}
]);
// 2. Export the PDF
const arrayBuffer = await exportPlugin.saveAsCopy().toPromise();
// 3. Download the PDF and open it on an Android phone in Chrome
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, all pen strokes, highlighters, and text look great and render exactly as expected.
- When clicking export and opening the downloaded file:
- On Chrome on Android: The PDF opens normally, but none of the pen or highlighter strokes are shown. The page looks completely blank/unmarked.
- On Firefox: The highlighters and pen strokes appear as thin 1px lines instead of their drawn thickness.
- When inspecting the exported PDF with a parser tool (
pypdf), I see:
It seems like without anAnnot: Subtype=/Ink, NM=pen-red Has /AP: False (or missing appearance stream)/APentry, mobile viewers don't know how to draw the strokes, so they just ignore them.
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
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
lingdojo/kana-dojo#34223 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
bug status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
mastra-ai/mastra#30587 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area:web p2 product:business triage:active type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
cuadrao-ai/argus#2228 ·
I maintainer di solito rispondono entro 1 giorno
-
.Needs Triage .Team/Metabot Priority:P3 Type:Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
metabase/metabase#87252 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
NuGet registry builds every URL from ROOT_URL, ignoring the host the client usedForse già presa @gritse l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno