Can anyone share a chinese supported pdf template sample - pdf-generation

Is there anything we need to change on pdf template level to support Chinese or Japanese . I am using a fillable template. While writing it with my pdf library(using tcpdf) it is giving some garbled text. While copy pasting Chinese text to this template field also gives some squares where as English is filling perfectly. Does anyone out there have a sample fillable pdf template that supports Chinese to share?

generally you need to embed font to properly display foreign characters in a PDF. I've not tried using tcpdf but saw posts that say embedding a TTF (true type font) of the correct language seems to do the trick.

Related

Cyrillic and GhostScript

I am struggling to convert my PCL file to PDF using GhostScript. The conversion itself is not issue, but it appears that Cyrillic is problem. As you can see on attached picture, it considers only the colon and period symbol.
I tried different fonts and symbol sets, but I never got correct result.
I was also trying to convert cyrillic TTF to soft font via PCL Paraphernalia but I was not successfull with using the font in my PCL.
Using following command:
gpcl6win64.exe -dNOPAUSE -sDEVICE=pdfwrite -dNOCACHE -dRENDERTTNOTDEF -sOutputFile=output.pdf CYR.prn
My file:
PDF output:
Please advise.
Thank you
At a guess, you have not supplied the font, or the font you are using does not contain Cyrillic glyphs. Colon and period are obviously going to be present in any Latin font, Cyrillic glyphs generally are not. Any glyphs not present in the font will be replaced by the /.notdef glyph, which is usually a non-marking glyph (except for TrueType fonts where it's usually a hollow square).
If that's your entire PCL file then I can't say I'm surprised it doesn't work as you expect, you haven't downloaded a font. I don't know PCL well enough to say exactly what that minimal file is doing but here's a thought: try using gpclwin64 to render the PCL to the display. If that doesn't work then there's no way it's going to result in a PDF file which works.
Basically you're going to have to download a soft font containing the glyphs you want to use encoded at the character codes you want to use.
NB: I'd strongly advise against using -dNOCACHE because that will hurt performance on large text-heavy files.

Unicode characters in Jasper Report [duplicate]

I am trying to export jasper as pdf but It does not show the cyrillic values. When I export it as excel it does show and the output is fine, but when I try to export is as PDF it does not export the cyrillic values. The cyrillic values are not written in cyrillic font, they are written as cyrillic keyboard.
The code I use to export is:
JRExporter e = new JRPdfExporter();
e.setParameter(JRPdfExporterParameter.JASPER_PRINT, jasperPrint);
e.setParameter(JRPdfExporterParameter.OUTPUT_STREAM, outStream);
e.setParameter(JRPdfExporterParameter.OUTPUT_FILE_NAME, NAME);
I even tried to specift the parameter below:
e.setParameter(JRPdfExporterParameter.CHARACTER_ENCODING, "UTF-8");
but did not succeed. Any suggestions?
Jasper report uses iText and always when a char is not rendered in pdf this should be the checklist:
Is my actual .tff supported (OpenType) and can the font actually render the character. Not all fonts render
all characters in UTF-8, see How can I test if my font is rendered correctly in pdf?
Do I pass correct encoding to iText. In doubts (or in general) use the encoding Identity-H this is recommend for newer PDF standards and gives you the ability to mix different encoding.
Is my font embedded so that if I share the pdf also computers not having this font can display the content?
How can I ensure this is JasperReport?
The deprecated method was to set attributes on the textElement
<textElement>
<font pdfFontName="Helvetica" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
<paragraph lineSpacing="Single"/>
</textElement>
The current non deprecated method v 3-6, is to add Font Extensions and this is easily achieved by using tools like iReport or JasperSoft Studio that can generate a .jar of your font extension so that you can include it in your classpath directly.
How to generate font extension .jar using iReport or JasperSoft Studio.
EDIT: The problem of OP was 1 on checklist (.ttf font could not render), but surely he should consider both 2 and 3 using non deprecated method.

Laravel failing to parse Arabic lines

I am trying to build a website using Laravel. I wanted to add Arabic language so I created a folder for it and made it the default in the config.php file.
Every time I use (trans) or (Lang::get) to load line from the Arabic file, not only the is not loaded right, but also the whole array is loaded with random letters instead of the Arabic text.
I tried changing the encoding of the file to UTF-8 or Unicode (both the Arabic file and the view) and I got really weird results (Japanes/Chinese letters sometimes).
is there something I am missing?

How can I correctly print Arabic through Ruby?

I'm trying to generate images through RMagick that contain Arabic text that has been parsed from an excel spreadsheet. Arabic letters change shape depending on their neighbors and this seems to happen in excel for displaying purposes only. The letters are not stored in their modified form, so they print out incorrectly. Does anyone know of a library that addresses this? TIA
What version of Ruby are you using? Also, is ImageMagick supposed to render Arabic text correctly in the first place? If not, you might want to use Prawn or something to generate a PDF file...
You need to reshape Arabic text in Ruby for ImageMagick/RMagick to render it correctly.
This is already solved for Java(Better-Arabic-Reshaper) and Python(arabic_reshaper). Do the same task in Ruby text before passing it to ImageMagick. linux CLI: how to render Arabic text into bitmap

zend_pdf right to left languages problem

i am using zend_pdf to create pdf files from persian language texts.
i have two problem:
1- i want to change document's direction to right to left as persian, arabic and some other languages are.
2- i use Zend_Pdf_Font::fontWithPath('myfont.ttf'); to set a persian font. but when i render the pdf document i see that characters are separated one by one. but in persian characters of a word are joint together.
thx in advance.
i finally used tcpdf class for generating pdf files using php. it has good support for RTL languages and UTF. it also has a good fiture for converting html to pdf.

Resources