I utilized bootstrap-table to display my data. However, when I export the content to a PDF format, the Indian currency symbol does not appear in the resulting PDF document.
example : https://live.bootstrap-table.com/code/ShreeSoftech-Rupesh/15888
Could someone please assist me in resolving this issue?
2
Answers
The issue you’re experiencing is likely related to the encoding of the Indian Rupee symbol (₹) in the PDF. This problem might be due to the specific library or method you’re using to export the content to PDF, which may not be handling Unicode characters properly. Here are some steps you can try to fix the issue:
Specify Unicode Encoding: Ensure that the PDF generation process is using Unicode (UTF-8) encoding, which should support the ₹ symbol.
Use a Suitable Font: If the font you’re using doesn’t contain the ₹ symbol, it may not appear in the PDF. Try using a font that is known to support this character.
Check Export Options: If you are using a library or a plugin to export the content to PDF, investigate its documentation to see if there are specific options or settings related to character encoding, fonts, or internationalization that need to be configured.
Alternative Character: If you still experience issues, you might want to replace the ₹ symbol with the INR abbreviation as a workaround.
Create a Minimal Example: If the issue persists, create a minimal example that reproduces the problem. This can help you isolate the cause and might make it easier for others to assist you in troubleshooting.
Here’s an example of specifying a Unicode font with a common PDF generation library, such as jsPDF (assuming that’s what you might be using):
Make sure the font you’re using is loaded and supports the character in question. If you can provide more specifics about the code and the libraries you’re using, I may be able to offer more targeted assistance.
The PDF is producing perfectly what has been designed by jsPDF 1.5.3
here it is in HEX
So it placed
¹
the best it could, sadly it looks like UTF-16 (could have done better with a nudge, to stick to ANSI)Here it is as Arial
So the text is normal for American $¢ or ¥ (and some Western European countries such as £sd or £p and Sw.F.
Others such as € are variable across applications, it is not in the chart above as western! and certainly there is no ₹ only Rs in ANSI/ASCII) e.g. basic PDF with a Sans Serif font which jsPDF will naturally use PDF standard /Helvetica and PDF readers will use their own "substitute fonts" such as MS Arial or Adobe Myriad or GhostScript Nimbus (Anything as long as it is not Licensed Helvetica).
So what is the answer ?
Well that depends on the application so for jsPDF you can use a Virtual font for embedding (even one with a single character) that include Global (non American) currencies.
I do understand the "official" post 2010 modern form is
₹
.However adding fonts "Bloats" PDF sizes phenomenally so the simplest answer is use American
Rs. 100
its smaller storage, easier to compact in the PDF and does not need tons of programmatic fiddling "to and fro" between font families and their styles for¹
single character with similar memory drain and slow downs.One alternative compromise, would be to add it once as an "Icon" at the top of the column.