Incorrect Ruble-symbol on Invoice PDF prestashop 1.6 not showing properly - pdf

Using Prestashop 1.6 - and on the PDF's (Invoice & delivery) the Russian Ruble symbol won't render properly, converts to a "square". It is working without problem on all other areas of our site. Does anyone know how I can fix this? Thank you

It is linked to the font include in TCPDF, i think the font use for your iso code not include this symbole.
The font folder for TCPDF is :
https://github.com/PrestaShop/PrestaShop/tree/1.6.1.6/tools/tcpdf/fonts
How to found the font use by TCPDF?
https://github.com/PrestaShop/PrestaShop/blob/1.6.1.6/classes/pdf/PDFGenerator.php
In this file you can know what font use for your country iso code
The font use depend to country iso code, so for RU the font is freeserif.
So the font freeserif not include Rouble.
Solution?
Solution 1
The easy solution is to change in the https://github.com/PrestaShop/PrestaShop/blob/1.6.1.6/classes/pdf/PDFGenerator.php the font for your iso code by (dejavusans, cid0jp, ..) depending font in the folder tools/tcpdf/fonts.
Solution 2
The second solution, is to download TTF file who include the symbol(example you can search/download a font in http://www.dafont.com/) and generate a valid file with online converter
http://fonts.snm-portal.com/ (it is a first result for my search in google)
After you upload the file(s) generated in folder tools/tcpdf/fonts and edit the file PDFGenerator.php to point to your new font.

Related

Gujarati fonts not displaying in PDF properly using itext 5.5.5 and xmlworker 5.5.5

I am using arial .ttf file. I have tried different font file for gujarati such as lohit, padmaa, shruti but it not displaying properly. The characters are not getting substituted properly.
In PDF it displays as :
અરથ પરજ ડરમ વૈભવ સવગે
Originally it should display as:
અર્થ પ્રજા ડ્રમ વૈભવ સ્વર્ગે
I have tried using GlyphSubstitutionTableReader but its not working for me.
Please guide me. Thanks in advance.
iText 5 currently doesn't support any Brahmic scripts. The reason is that these require an implementation of a specific font table called GSUB, which simply isn't there yet. There is no way to get this to display correctly with iText 5.5.5, but anyone is welcome to try and implement it.

How to use Verdana Font in Stamper (iText PDF)

I want to use Verdana as a font while stamping a PDF file with iText PDF. The original file uses Verdana, which isn't an option in the class Basefont.
Here is the function to create my font right now:
def standardStampFont() {
return BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, false)
}
I'd like to change that to the Verdana Font, but simply exchanging the Part BaseFont.HELVETICA with "Verdana" doesn't work.
Any idea? Thanks in advance!
As documented, iText supports the Standard Type 1 fonts, because iText ships with AFM file (Adobe Font Metrics files). iText has no idea about the font metrics of other fonts (Verdana isn't a Standard Type 1 font). You need to provide the path to the Verdana font file.
BaseFont.createFont("c:/windows/fonts/verdana.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED)
Note that I change false to BaseFont.EMBEDDED because the same problem you have on your side, will also occur on the side of the person who looks at your file: his PDF viewer can render Standard Type 1 fonts, but may not be able to render other fonts such as Verdana.
Caveat: The hard coded path "c:/windows/fonts/verdana.ttf" works for me on my local machine because the font file can be found using that path on my local machine. This code won't work on the server where I host the iText site, though (which is a Linux server that doesn't even have a c:/windows/fonts directory). I am using this hard coded path by way of example. You should make sure that the font is present and available when you deploy your application.
Adding this line makes sure the FontFactory actually registers the fonts in the operating systems' default fonts directories:
FontFactory.RegisterDirectories();
After that all the installed fonts can be found using something like
var myfont = FontFactory.GetFont("Verdana", 10f, iTextSharp.text.Font.NORMAL);
I get that this post is old, but it's still relevant I guess.

Unable to show Hindi(Unicode) characters in BIRT generated PDF

BIRT is unable to render Hindi language characters in generated PDF file. The same design file, when rendered as Word document or HTML or any other format, I am able to see the unicode characters.
I have set Arial Unicode MS as the font type in the design file and tried with few samples from google translate. Please let me know if I'm missing anything.
Thank you.
The most probable BIRT can't find correct font files.
You have to configure pdf fonts correctly (see. file fontsconfig.xml).
I've similar issue with Cyrillic and Chinese fonts.
What I fixed in the file:
...
<font-paths>
<path path="fonts" />
<!--path path="C:/windows/fonts" />
<path path="d:/windows/fonts" />
...
<path path="/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType" /-->
</font-paths>
Create fonts folder and put all necessary fonts (a bit tricky question is where fonts folder must be. It depends how you're using BIRT).
Optionally you can put correct font files in JRE/lib/fonts folder you're using.
If you are working on JavaFx Desktop App.It will work.
If you are using BIRT viewer deployment using fontsConfig.xml because all configs are bundled in org.eclipse.birt.runtime_VERSION-XXX.jar
So you can use this way just override fontConfig_Pdf.xml file and add your Font in this file
<composite-font>
<font font-family="mangal" catalog="Western"/>
</composite-font>
and after that add this line code in your BIRTserviceImpl Class where you are setting the RuntimeEngine
EngineConfig conf = null;
conf.setFontConfig(new File("fontsConfig_pdf_win.xml").toURL());
conf.setEngineHome("{dir}/birt-runtime-4_4_1/ReportEngine");
eng = new ReportEngine(conf);
this line will help to change runtime fonts config and
copy your hindi fonts and paste into jre/lib/Fonts and C:/windows/Fonts also

<Error>: FT_Open_Face failed: error 85

I am trying to install a custom font into my iPhone application. When I add the 'Fonts provided by application’ key into my info.plist file I get the following error ': FT_Open_Face failed: error 85.’
I am not sure what the problem is as I have successfully been able to use custom fonts in the past.
Any help will be appreciated.
If you leave the first element in your font array in the plist (index 0) blank, you will get this error.
PostScript fonts cannot be used with UIFont directly. You can use them only with CoreText or CATextLayer.
This can occur if the font in question is a Font Suitcase format. Open your application package, and if the font .ttf file shows a size of "Zero bytes", it's probably a font suitcase.
Files of this type can be converted using Fondu.
When running Fondu, I had to specify not just the suitcase file, but the resource fork inside it:
fondu mysuitcasefont.ttf/..namedfork/rsrc
This will extract any fonts in the suitcase to the current directory. It is these extracted files you will want to include in your iOS project and reference from the .plist.
I received this error when using a .ttf font. I was able to correct it by removing the file extension from the filename in (a) the resource in xcode and (b) the "Fonts provided by application" array in the .plist file.
Hopefully this will help.
I was trying to use Google Signika font on my App, and got the exact issue.
I solve the issue by using the .otf version of the font
Accepted answer is totally wrong and unnecessary. Probably you made a mistake when writing your font name.
Thats rules for that.
First Step : Write font name before .ttf extension. Example: For FFFTusj.ttf => FFFTusj
Second Step : Write - and after font style. Example: Bold or Medium etc. Example: #"FFFTusj-Bold"
And also dont forget add your font file to your project.
Check this link:
http://www.bycoder.com/post/2013/03/28/XCode-Custom-font-doesnt-work
If your font is REGULAR dont write -Regular at end of font name.

Custom fonts on iOS app - working in Simulator but not iPad

Encountering a weird problem here. I'm developing a game for my school project (non-commercial), and I'm using a custom font Black Chancery (free under GNU GPL). I followed the instructions from multiple sources, which includes:
Add the font to the project (TTF).
Modify app-Info.plist to add the font to it ("Fonts provided by application").
Using [UIFont fontWithName:#"BlackChancery" size:30] when the font is needed.
I could get the font displayed in the Simulator, however when I load it into my iPad, the default system font is used. I'm pretty sure there isn't a problem with the font itself as it displays in the simulator, and I've used FontForge to open the font without any warnings (following from This Question).
Any help is greatly appreciated. Thanks! :)
I can only guess as you haven't posted the contents of your plist or a directory listing of the bundle, but many cases of "resource works on the simulator but not on the device" are caused by the fact that the OS X filesystem is normally configured to be case-insensitive while the filesystem on the device is case sensitive. For example, if your file is named "BlackChancery.TTF" and your plist refers to it as "BlackChancery.ttf", it will be found on the simulator but not on the device.
I was having problem with font not recognizing, I fixed it by checking the correct name of the font by checking info of the font file by Get Info option. In my case the file name was written xyzfont.ttf but actually it was XyzFont.TTF in the info, i replaced and it worked.
Hope, it helps someone.
Another Way
I have come across one more way of finding the correct name, is by installing the font in the FontBook..
Just open FontBook from Finder and select User now from File->Add Fonts select the font you want to add into your application, after little processing the FontBook will show the Font listed in with the Correct name, use the name in the FontBook ignoring the actual ttf file name you have imported or, added to plist.. It should work..
I had the same problem which was resolved with a slight variation on iphonc's solution. The case sensitivity was directly related to the file extension. The problem was associated with my font file named: Choc.TTF
I had to remove the reference to the file in xCode 4.1
Rename the file to Choc.ttf (note lower case file extension)
Add the reference back into xCode
Perform a clean and re-build for the device
Conclusion (in my particular case):
Case sensitivity applies not JUST to the file name, but to the file extension as well (i.e. iOS device appears to tolerate only lower case).
My answer is different from all the rest. I had a problem because the font was all one word and lowercase "compassnormal.ttf" and the name in the file was Compass. So, my code was:
[UIFont fontWithName:#"Compass" size:24]]
Bundle Resource said:
compassnormal.ttf
~info.plist said:
compassnormal.ttf
None of this worked until I changed the actual filename to match it's official name in fontbook.
deleted all references from Bundle Resources and ~info.plist;
added font with updated name to Bundle Resources;
updated plist with new name;
tested in simulator and on device, Voila!
I have also experienced a problem with fonts containing the dash (-) character. Remove that character from your font names and try with that.
So your font named Gotham-Black.ttf should be named GothamBlack.ttf
Also check that your fonts are not zero bytes. I had this same issue and it turned out that my font files had emptied themselves at some stage. Probably when rearranging them in XCode and AppCode.
You have to use the real font name in the [UIFont fontWithName:#"... method! Not the ttf filename!!!
This real name is mostly far away from the filename. Just open the rtf in the Mac font utility. In the header you see the font family!!! Only the family!!! if you now use
NSArray *fontNames = [UIFont fontNamesForFamilyName:#"MyFontNameFamily"];
NSLog(#"%#", fontNames);
in your code, you get the real real real name in the console ;-)
But in the plist entry you still need the (case sensitive) filename!!!
I have the same issue on Xcode 6. My file name was My Font.ttf, it doesn't work. I manage to make it works when I rename it to My Font.TTF, just change the file extension to uppercase.