If you add a font which is Unicode the text is displayed fine but if you try to search for text in Adobe it wont find any text.
To fix this an Object which maps Unicode must be added. It is not a big change in code if you define the lower Unicode set to match the ASCII set.
This might be an English only thing, Adobe might work fine in a different language.
This code replaces the unicode font test: from "If Fonts()\unicode" all the way to "else"
Code: Select all
If Fonts()\unicode
; Page 279
ipdf_Out("<</Type /Font")
ipdf_Out("/Subtype /Type0")
ipdf_Out("/BaseFont /"+tempfontname$+"-UCS")
ipdf_Out("/Encoding /Identity-H")
ipdf_Out("/DescendantFonts ["+Str(pdfN+1)+" 0 R]")
ipdf_Out("/ToUnicode "+Str(pdfN+2)+" 0 R")
ipdf_Out(">>")
ipdf_Out("endobj")
ipdf_NewObj()
; PDF-Reference : PDF32000_2008.pdf page 269
ipdf_Out("<</Type /Font")
ipdf_Out("/Subtype /CIDFontType2")
ipdf_Out("/BaseFont /"+tempfontname$)
ipdf_Out("/CIDSystemInfo <</Registry (Adobe) /Ordering (UCS) /Supplement 0>>")
ipdf_Out("/FontDescriptor "+Str(pdfN+2)+" 0 R")
; Font-Width
HexData$="/W ["
For i=0 To fonts()\numglyphs-1
ForEach Fonts()\glyph_list(i)\char_no()
HexData$+StrU(Fonts()\glyph_list(i)\char_no(),#PB_Long)+" ["+StrU(Fonts()\glyph_list(i)\scaledwidth,#PB_Long)+"] "
Next
Next
HexData$+"]"
ipdf_Out(HexData$)
ipdf_Out("/CIDToGIDMap "+Str(CIDToGIDMap)+" 0 R")
ipdf_Out(">>")
ipdf_Out("endobj")
ipdf_NewObj()
ipdf_Out("<<")
ipdf_Out("/Length 345")
ipdf_Out(">>")
ipdf_Out("stream")
ipdf_Out("/CIDInit /ProcSet findresource begin")
ipdf_Out("12 dict begin")
ipdf_Out("begincmap")
ipdf_Out("/CIDSystemInfo")
ipdf_Out("<</Registry (Adobe)")
ipdf_Out("/Ordering (UCS)")
ipdf_Out("/Supplement 0")
ipdf_Out(">> def")
ipdf_Out("/CMapName /Adobe-Identity-UCS def")
ipdf_Out("/CMapType 2 def")
ipdf_Out("1 begincodespacerange")
ipdf_Out("<0000> <FFFF>")
ipdf_Out("endcodespacerange")
ipdf_Out("1 beginbfrange")
ipdf_Out("<0000> <FFFF> <0000>")
ipdf_Out("endbfrange")
ipdf_Out("endcmap")
ipdf_Out("CMapName currentdict /CMap defineresource pop")
ipdf_Out("end")
ipdf_Out("end")
ipdf_Out("endstream")
ipdf_Out("endobj")
Else
I created a page so you can download PurePDF.pb with the changes I've made and you can read a list of changes.
None of the changes should break your code. Most of them just repair stuff that was not working.
http://normeus.com/data/uploads/pb/PurePDF.pb
http://normeus.com/data/uploads/pb/purepdf_res.pb
http://normeus.com/purepdf-changes/
Thank you.
Norm