Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

PdfWriter writes non-conformant `/MarkInfo << /Marked true >>` instead of `/MarkInfo << /Tagged true >>` (ISO 32000-1)

Aperta Adatta ai principianti
#1,643 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
backend

Direzione di ricerca

In PdfName è definita la costante MARKED e PdfWriter.getCatalog(PdfIndirectReference) la usa durante la creazione del dizionario MarkInfo del catalogo. Leggi queste due posizioni, poi controlla il catalogo generato dopo aver chiamato PdfWriter.setTagged(). Il lavoro è completato quando contiene /Tagged true, come specificato, invece di /Marked true.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Describe the bug

When a document is marked as tagged via PdfWriter.setTagged(), the catalog of the generated PDF contains:

/MarkInfo << /Marked true >>

According to ISO 32000-1:2008 §14.8.2 (Mark Info), the entry that marks a tagged document in the MarkInfo dictionary is Tagged:

Tagged (Optional; PDF 1.4) — A boolean indicating whether the document contains semantic information that aids accessibility (true) or not (false).

The name Marked is not defined by the specification. The structural tree (StructTreeRoot) is generated correctly, but the flag that tells viewers and assistive technology the document is tagged is invalid — so documents produced with setTagged() are not recognized as tagged by PDF validators and PDF/UA (ISO 14289) conformance checks. In practice this makes it impossible to produce conformant tagged / PDF/UA documents with this library.

org.openpdf.text.pdf.PdfName (line 1677):

public static final PdfName MARKED = new PdfName("Marked");

consumed by org.openpdf.text.pdf.PdfWriter.getCatalog(PdfIndirectReference) (line 1056):

PdfDictionary mi = new PdfDictionary();
mi.put(PdfName.MARKED, PdfBoolean.PDFTRUE);
...
catalog.put(PdfName.MARKINFO, mi);

The value appears to have been carried over from iText 2.1.x, where the same non-conformant constant exists.

To Reproduce
Document doc = new Document();
PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream("out.pdf"));
writer.setTagged();
doc.open();
doc.add(new Paragraph("Hello tagged PDF"));
doc.close();
Expected behavior
/MarkInfo << /Tagged true >>

Suggested fix

public static final PdfName MARKED = new PdfName("Tagged");
System
  • OS: Windows
  • Used font: Helvetica
  • OpenPDF version: 3.0.5
Additional context

PdfName.MARKED has exactly two occurrences in the 3.0.5 source: its definition and PdfWriter.getCatalog — nothing in the library ever reads this entry back, so changing the constant to the spec value "Tagged" only affects newly written documents (and documents written with /Marked were non-conformant to begin with, so there is no conformant reading behaviour to preserve). Suggested one-line fix:

public static final PdfName MARKED = new PdfName("Tagged");
Lingua principale
Java
Stelle
4.4k
Fork
714
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di LibrePDF/OpenPDF

Tutte le issue di LibrePDF/OpenPDF

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.