Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a pdf bcmap file?

I am using a pdfjs viewer in my web application and it comes with all these bcmap files. I traced the network traffic and they are not being called for.

I don't really want to add these files to version control or the issue tracking system b/c there are so many of them, if they will not be needed.

enter image description here

What is a bcmap file?

like image 733
toddmo Avatar asked Sep 24 '15 15:09

toddmo


1 Answers

The word "bcmap" stands for "binary cmap".

CMaps (Character Maps) are text files that are used in PostScript and other Adobe products to map character codes to character glyphs in CID fonts.

See this document by Adobe to see what CID fonts are good for. They are mostly used when dealing with East Asian writing systems. (This technology is a legacy technology, so it should not be used in pdfs created by modern tools)

pdfjs needs the CMap file when it wants to display such CID fonts. For that, you need to provide the CMaps.

You specify the url to the folder where the CMaps are stored via settings on the PDFJS global object.

  PDFJS.cMapUrl = '../web/cmaps/';

By default, pdfjs will try to load a file with the name of the required CMap and no extension, for example "../web/cmaps/Hankaku".

If you enable the setting cMapPacked like this:

PDFJS.cMapPacked = true;

pdfjs will instead try to read a compressed version of the CMap file with the extension ".bcmap", for example "../web/cmaps/Hankaku.bcmap".

The compression itself is done with the tool at https://github.com/mozilla/pdf.js/tree/master/external/cmapscompress.


Conclusion: Include the files and set the PDFJS options correctly if there is a possibility that you need to display pdfs with East Asian texts that were created by legacy pdf creation tools. Don't include the files if you are certain you won't need to display such files.

like image 171
NineBerry Avatar answered Oct 10 '22 20:10

NineBerry