Open blerner opened 6 years ago
From the spec: Possible values include those in the following table
. A quick google search shows that there are rtf documents which use other codepages (for example google ansicpg10002
). For maximum document compatibility I want to keep the default as is. What I could do is load the codepages as an external module / additional script, that way you could supply your own cut down cptable for scenarios where you know which codepages will be used.
@zoehneto - I am also interested in using this library but it currently would double the size of our deployment bundle. How hard would it be to do what you described above so that I could provide only the code page that I need?
In theory you'd only have to add the library to the webpack externals, remove the include from the dev / prod config and add a peer dependency to the package.json (on the rtf.js side, you'd still need to adapt your config to provide codepagejs appropriately). I currently don't have time to look further into it, but I'd be happy about a PR, if you want to implement the feature.
I will take a look and see if its something I can do quickly or if I run into any roadblocks. 👍🏼
I attempted to do this but ran into issues, mainly because this package was designed to be available in the browser, and the codepage tables are baked in. What I played with is on this branch: https://github.com/lounsbrough/rtf.js/tree/extract-codepage. I think someone more familiar with the app would need to address, or decide what the best path is.
Hi!
The codepages currently takes up the majority of our bundle-size:
According to the RTF spec (https://www.microsoft.com/en-us/download/details.aspx?id=10725), there are only a few codepages needed in RTF:
As far as I can tell, rtf.js supports 145 code pages (searching for
cptable[###] =
in the RTFJS.bundle.js file), and eliminating ones that aren't necessary could cut down the bundle file size substantially.