I'm using Delphi Tesseract wrapper which is available at https://github.com/CloudDelphi/TTesseractOCR4. Based on example here: Get font of recognized character with Tesseract-OCR I should call api.GetIterator() method to get WordFontAttributes(). As I see Delphi wrapper does not support api.GetIterator() directly but has TTesseractPageLayout.AnalyseLayout function to access GetIterator().
In OnRecognizeEnd I call AnalyseLayout, which returns words' texts but not font names:
Tesseract.PageLayout.AnalyseLayout;
for TesseractWord in Tesseract.PageLayout.Words do
begin
memo1.Lines.Add(TesseractWord.Text);
memo1.Lines.Add(TesseractWord.FontName);
end;
Could you please help me to resolve the issue?
It seems that you are using tesseract version >= 4.0.0.0.
On those versions, the recognition is done with neural networks (LSTM engine), so the font name is not available. The latest version that you can get the font name, is version 3, which uses the old engine.
You can read about it in the following links (user summited issues on official github repo):
https://github.com/sirfz/tesserocr/issues/292
https://github.com/tesseract-ocr/tesseract/issues/3820
https://github.com/tesseract-ocr/tesseract/issues/1074
Related
Non-Latin characters are not truncated properly so I modified the fragmentText() function to truncate on white space. file is in:
"C:\CocosCreator\resources\engine\cocos2d\core\label\CCTextUtils.js"
fragmentText: function (stringToken, allWidth, maxWidth, measureText) {
return "function called";
}
The problem is that I see the changes in Cocos Creator editor and the text is truncated as I want, but I see no effect on the browser as the function is never called.
Why the function is not called when I build?
P.S: I use Cocos Creator 1.10 but also have 2.1.1 installed in C:\CocosCreator_2.1.1
I guess you forget to recompile the engine.
Check the step 1.3 on the website and try again.
1.3 Change and Build
I need to develop a printer driver which can:-
Read the printed file (knowing the data inside the file)
Write extra information to the end of printed file. (eg. bar-code or QR code)
I plan to use V4 printer driver as template for me to start my development. I already tried to built this V4 printer driver in Visual Studio.
V4 printer driver solution explorer
Understanding the architecture of V4 printer driver may need lot of times. Besides that, I am still new in driver development, so it is hard for me to understand the document provided by Microsoft.
Can anyone suggest where should I start to code and recommend me any useful method/function or library. It will be useful if anyone can recommend some useful related reading material and what basic knowledge should I know.
See the Microsoft sample code here.
Create a "Render Filter" project (C++ project) in your "V4 Printer Driver" solution and add the sample code in "StartOperation_throws" method of newly created Render Filter.
Then use following sample code to add a custom content to your file:
XPS_COLOR testColor;
testColor.value.sRGB.alpha=0xFF;
testColor.value.sRGB.red=0xFF;
testColor.value.sRGB.green=0xFF;
testColor.value.sRGB.blue=0xFF;
testColor.colorType = XPS_COLOR_TYPE_SRGB;
FLOAT Font_Size = 14;
XPS_POINT OrgPoint = {123,123};
LPCWSTR TestStr = _T("Sample Text");
LPCWSTR Name_fnt = _T("SampleFontFile.TTF");
at the end, call "AddCustomTextToXpsDoc" using above parameters to add your text in
printable xps file.
problems to print with different fonts on my Zebra ZQ520:
as described in documentation, I've downloaded some new font through the official Zebra Font Downloader program, comic and verdana. After this, I found the new fonts in E: storage area. So the script:
^XA^HWE:^XZ
give me:
LIST OF FONT LINKS
- DIR E:.
* E:COMIC_02.CPF 7359
* E:VERDAN02.CPF 163 ....
- 66589184 bytes free E: ONBOARD FLASH
and trying to print example string from font downloader program, it print with the installed font with success.
The problem appens if I try to print a label. The printer seems not consider the .CPF files in ZPL commands.
My tests, without success, are:
1) following the procedure indicated in https://km.zebra.com/kb/index?page=content&id=SO7891 , assigning a designator to new font, with the script:
^XA^CWQ,E:COMIC_02.CPF^XZ
and trying to print something as:
^XA^FO50,50^AQN,50,50^FDSAMPLE CoMiC^FS ^XZ
seems not working (is it not possible to assign a designator on .CPF files??)
2) (not working too) test, I tryed to print something with the ^A# command, also without success. Example:
^XA^FO50,50^A#N,50,50,E:COMIC_02.CPF^FDSAMPLE CoMiC^FS ^XZ
Where is the problem? with printer (updated with the last firmware, V76.19.15Z)?
or ZPL can't print font stored in .CPF files?
or ..??
thanks!
The ZQ500 supports multiple printing languages. It ships with the PnP string stating that it is a CPCL printer. This tells the Zebra Setup Utility to generate a CPCL compatible font (.CPF). Since you are looking to print using ZPL you need to generate a font compatible with ZPL.
https://km.zebra.com/resources/sites/ZEBRA/content/live/SOLUTIONS/8000/SO8535/en_US/ZebraNet_Bridge_Font_Converting.pdf
This will use a different program to package a .ttf font for the printer. ZPL has support for truetype fonts so you will have better scaling of the font.
The ^CW and ^A# commands will both work with the ttf font.
We are converting word to pdf using the openoffice(3.4.1 version) in java with JODConverter.
below is the code used.
OpenOfficeConnection connection =
new SocketOpenOfficeConnection(2100);
try
{
connection.connect();
DocumentConverter converter =
new OpenOfficeDocumentConverter(connection);
converter.convert(inputFile, outputFile);
connection.disconnect();
return "Sucess " + DestinationPath + DestinationFileName;
}
catch (Exception localException1) {
}
The problem is that after random no of days the converted PDF contains the garbled fonts.
like # # ! $ $ " % &
The only solution we have so far is to restart the server. System guys are saying the the problem is with Open Office.
We are using open office to convert the document since it converts the doc files exactly including all the formatting and table structure.
what could be the solution to this.
So OpenOffice can be a little temperamental when running on a server, especially as it isn't multi-threaded and you end up having to run a pool of OpenOffice processes - see How can I use OpenOffice in server mode as a multithreaded service?.
Added to that often the rendering is off when converting to PDF - see https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=68865 which is why you may want to consider using a conversion service to automate the conversion tasks for you ?
For complete transparency I work for Zamzar (an online file conversion service), we have recently released a developer API - https://developers.zamzar.com/ that allows you to convert between a multitude of file types, specifically applicable to you here in that we support both doc and docx to pdf with little or not loss in the way the PDF is rendered. It maybe worth a look to see if this is a better alternative to trying to run your own solution through OpenOffice on a server.
I have a progressbar in my form and I need to change its color. I need it to be Yellow and so I am using this code:
SendMessage(ProgressBar5.Handle, PBM_SETBARCOLOR, 0, clYellow);
I am using Lazarus and I couldn't use the SendMessage(); procedure. Then I have googled a bit and I found that I need to include in the uses the lclintf library.
Now I have another hassle because Lazarus can't recognize the parameter PBM_SETBARCOLOR. In fact it states:
unit5.pas(245,50) Error: Identifier not found "PBM_SETBARCOLOR";
I see that the first line of code that I wrote is the only way to change the color of a ProgressBar from green to the one I need.
Any help? I am using the latest version of Lazarus.
The PBM_SETBARCOLOR is declared in the commctrl.pp unit of freepascal, same as in Delphi.
You could also declare it as a constant with value 1033 (WM_USER + 9).