Unplanned
Last Updated: 20 Apr 2021 13:03 by ADMIN
Radek
Created on: 19 Apr 2021 06:01
Category: PDFViewer
Type: Feature Request
1
PdfViewer: Handle import of documents containing an invalid code space range in the embedded CMap table
When the document contains an invalid code space range in the embedded CMap table the CMap table is not correctly imported, which leads to wrong character mapping in the text selection.
2 comments
ADMIN
Martin
Posted on: 20 Apr 2021 13:03

Hello Radek,

According to the Pdf SpecificationWhen defining ranges of this type, care must be taken to ensure that the value of the last byte in the string is less than or equal to 255 − (srcCode2 − srcCode1). This ensures that the last byte of the string is not incremented past 255; otherwise, the result of the mapping is undefined and an error occurs. - from the "ToUnicode CMaps" section

The CMap in this document: 

16 0 obj
<< /Length 348 >>
stream
/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo
<<
/Registry (Adobe)
/Ordering (UCS)
/Supplement 0
>> def
/CMapName /Adobe-Identity-UCS2 def
/CMapType 2 def
1 begincodespacerange
<0000> <ffff>
endcodespacerange
1 beginbfrange
<0000> <ffff> <0000>
endbfrange
endcmap
CMapName currentdict /CMap defineresource pop
end
end
endstream
endobj

And when you check the range "<0000> <ffff>", where srcCode2=65535 ("ffff") and srcCode1=0 ("0000"), so according to the stated above this makes this range invalid. So, the purpose of this feature request is to handle such invalid cases.

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Radek
Posted on: 19 Apr 2021 13:08

Hi,

I'm not yet very familiar with pdf structures, but could you please give me more information about this problem?

Is this a document error, so it doesn't meet a certain standard? Or it is about classic functionality of other PDF viewers that is not currently available in PdfViewer?

Thank you for help.

Best regards.
Radek Huráb.