Why does mpdf embed whole glyphs when the pdfa option is enabled? - mpdf

Today I have found that PDF/A files generated by mpdf are very huge (I am using some CJK fonts), possibly due to inclusion of the complete glyphs. However, those created by commercial pdf applications (e.g. Adobe Acrobat, FoxIt, etc.) do embed subsets of the glyphs (for characters actually used in a document), even though the PDF/A option is enabled. Why does mpdf embed whole glyphs when the PDFA parameter is enabled?

Related

How to display Chinese characters on Linux embedded devices Qt

I have a software running on an embedded Linux written in Qt/QML. I am using a font family, let's call it SomeFontFamily.otf. This font family doesn't support Chinese characters, therefore when I want to display a Chinese text I am getting empty squares instead. If I run the same software on my desktop Linux I get the same result with Chinese text, but if I add a .font directory in my home folder with a font family that supports Chinese then it displays the characters. So I thought I can do the same on the embedded device and added a .font folder in my home directory with the right font, but unfortunately it didn't work. Then I have found this doc about Qt fonts on embedded devices. It says that I should put my font under lib/fonts directory because Qt will search there for it on embedded devices. I tried it, but unfortunately with no success. Anybody had a similar issue? Just for the record this is not translation related. I just want to be able to display Chinese characters in an english text.
Embedded QT versions often lack features, disabled by people who want to cut on dependencies without checking what the dependencies are there for in the first place.
To get font substitution to work you need a build with fontconfig enabled. To get complex text support (anything that exercises more than latin glyphs) you need harfbuzz, the newer version (harfbuzz-ng) the better.
I have fixed the problem with Arabic language by using my own FontConfig. You have to enable it using FontConfig & Font Qt Embedded
My final solution was actually creating a wrapper class for QFont and adding QFont::insertSubstitution(...) in the constructor for my set font. Then expose it to QML and use it as a default font. It works like a charm.
As a side note: if you have bundled your fonts with a resource file (.qrc) you have to add those fonts with QFontDatabase::addApplicationFont.

Qt how to create font from image?

I need to use some custom font for numbers in my Qt app, but company ask me to use image as font, font file is not allowed(For example: ttf).
the font image like this:
So i wonder is possible to converting the font image to QFont?
like a Qt font generator.
Or any other solution?
There is nothing out of the box that supports what you are looking for. You would need to get around this company rule by building your own TrueTypeFont data programmatically from your image, keeping it in memory only and load that into your application with addApplicationFontFromData(const QByteArray & fontData).
Unfortunately I cannot find a single library that does this, and the TTF format appears dauntingly complex. I would suggest looking into this open source project for font creation. Perhaps you can use this as a starting point? http://fontforge.github.io/en-US/
You may want to find out the reason your company is telling you that you cannot use a custom font. (I just remembered reading that QT has difficulties storing a font as a "resource". If it's not due to copyright issues, then you could suggest not using an image, but storing the entire file in the source code in a text format like base-64. Then convert it back into binary at startup, then load it up as a new font from a QByteArray.
I guess it's about copyright issues ? There are lots of ttf fonts available for completely free commercial use. E.G. have a look at Droid Sans Mono : https://www.google.com/fonts/specimen/Droid+Sans+Mono
Otherwise it would be good to know the reason why ttf is not allowed.
It is possible to create a font from a vector graphic.
If you have resonable high resolution images of every letter (if not already vector graphics) you can try to convert them to vector graphics (SVG).
Afterwards you can use tools to convert SVG to a font. This would be most likely a ttf font which can be used with QFont.

Reporting With Unicode

Firs of all I apologize for my English.
I am developing an asp.net application withe .NET Frame work 3.5 and Sql Server 2008. I am using RDLC for reporting. I have to generate reports in 'Hindi , so I have to use Unicode.
While Running the application and getting report in browser:
in aspx page it shows all Unicode characters properly, no matter what font I have set for it.If font is 'Times New Roman' or 'Arial Unicode MS' the output is same and proper(in the browser). But exporting it to PDF it depends on what font I have set for it. When I have set Font Times New Roman it shows some thing like ???????? instead of Unicode Characters and when I set Font to Arial Unicode MS it works but still there is some problem with few characters.
As we have many fonts pre-installed in our windows systems (like Arial, Times New Roman etc.) , Is there any separate set of Fonts specially for Unicode?
If There is a separate set of fonts for Unicode then what Font are pre-installed on system?(Which font I should use in my web application that it should appear properly on all system, users must not need to install any kind of fonts to see the report on their machine).
If There is not a separate set of fonts for Unicode (as it shows all Unicode characters in aspx page properly no matter what font I choose ) then what is problem with exporting reports to the pdf?
And finally It may be I have some misconcept/miscode about uincode and reporting, then What should I do to generate reports that can be converted in pdf with Unicode ?( I need reports in both formate aspx and pdf). or I should use some other tools for reporting.
because in client side you must have to install that hindi font..
According to this: https://stackoverflow.com/a/163029/1828416, most likely, you need to embbed the font or the characters in your PDF file.
Use Arial Unicode MS Bold for all purposes. It works for me. Arial Unicode Normal gives some problem.

PHPExcel: Custom font?

Is there a way to embed a font to the xls and use it with PHPExcel?
I want custom font because I want to use barcode font in the excel.
I tried to embed a barcode image but random dot appears when printing and the barcode scanner cannot read it.
There isn't. Excel relies on the range of fonts that exist on the client PC where the Excel document is opened. Where a font doesn't exist, it will fall back to members of the font family that exist on that client PC. In the case of a font referenced in an xls file where no member of that font family exists on the client PC, it simply cannot be rendered. This is standard MS Excel behaviour, not specific to PHPExcel-generated files.
The only alternative I can suggest is generating an image file of the barcode, and embedding that image in the xls file.

Alternative to HTML to PDF converter?

I've been using the Winnovative HTML to PDF converter for a few years, but I've noticed the quality can be impared because the images etc have first had to be rendered in HTML before being converted into a PDF format.
Winnovative have another option where you can add objects to the PDF Converter before outputting the result, but as this allows you to add HTML elements, I imagine this works in a similar way to the HTML to PDF converter (in terms of rendering).
Is there an alternative to this so that I can generate a PDF in my ASP.NET Web Application without it first having to be rendered as HTML?
I'm looking for the most high quality option
You can use iTextSharp library. It has an object representation of whole PDF document so it will allow you to add any elements you need without translating it from html elements. It also allows you to convert html to pdf, but of course you can do it manually instead by building PDF document from basic blocks...
If you will use version 4.x then it's free to use in commercial projects (LGPL license). Version 5.x is avaible on Affero General Public License so I believe you have to buy it to use in commercial projects, but the features I've described are avaible in the 4.xversion
try http://wkhtmltopdf.org/
it's lightning fast in comparison to iTextSharp.
For step by step installation check out these articles:
http://www.megustaulises.com/2012/12/mvcnet-convert-html-to-pdf-with-pechkin.html
http://w3facility.org/question/how-to-pass-html-as-a-string-using-wkhtmltopdf/
And this manual:
http://madalgo.au.dk/~jakobt/wkhtmltoxdoc/wkhtmltopdf-0.9.9-doc.html

Resources