mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Use stringToPDFString
to sanitizing bad "Prefix" entries in Page Label dictionaries
It seems that certain bad PDF generators can create badly encoded "Prefix" entries for Page Labels, one example being http://ukjewishfilm.org/wp-content/uploads/2015/09/Jewish-Film-Festival-Programme-ONLINE.pdf. Unfortunately I didn't come across such a PDF file while adding the API support for Page Labels, but with them now being used in the viewer I just found this issue. With this patch, we now display the Page Labels in the same way as Adobe Reader.
This commit is contained in:
parent
9f8d67475e
commit
2d8d8b5e53
4 changed files with 15 additions and 3 deletions
|
@ -302,8 +302,9 @@ var Catalog = (function CatalogClosure() {
|
|||
assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
|
||||
style = (s ? s.name : null);
|
||||
|
||||
prefix = labelDict.get('P') || '';
|
||||
assert(isString(prefix), 'Invalid prefix in PageLabel dictionary.');
|
||||
var p = labelDict.get('P') || '';
|
||||
assert(isString(p), 'Invalid prefix in PageLabel dictionary.');
|
||||
prefix = stringToPDFString(p);
|
||||
|
||||
start = labelDict.get('St') || 1;
|
||||
assert(isInt(start), 'Invalid start in PageLabel dictionary.');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue