Decoding a image of a QR code with Delphi and a webcam - delphi

So I am looking for a solution to read a QR code from delphi with a webcam.
I found this example project to capture the webcam's image and save it to a .bmp file : linky
So I have the image that I want to scan. Now I would like to know how to get its contents in string format in Delphi. So to read the QR code I found ZBar which is exactly what I need. I just cant figure out how to use it with delphi.
I want to know if there is a way I can either implement the libraries ZBar supplies or somehow run ZBar and just receive the decoded text ?
ZBar has a command prompt example so I thought that it would be possible to run the command prompt, receive the results and just format the strings to find the code (like this). But that seems rather hacky and I am sure there must be a better way. I also could not get any of the answers to work.
I am using delphi 7 or xe3 if thats a factor.
Thanks for your time and suggestions.

The famous ZXing library finally has been ported to Delphi, but it is for the modern Delphi versions like Delphi 10.4, because there are new features used like in-place filling of dynamic arrays. I tried to rewrite it for Delphi 6 and didn't manage that.
Here is the link: https://github.com/Spelt/ZXing.Delphi
There is also an example for a webcam.

Related

Shapelib.dll does not work properly on Win 64 Platform (Delphi 10.3)

Shapelib is a library originally written in C, which provides the ability to write simple programs for reading, writing and updating ESRI Shapefiles.
I managed to compile shapelib.dll for 32bit and 64bit on the basis of https://github.com/OSGeo/shapelib and then I wanted to test if that works with the help of ShapeFileII.pas (available in that repo).
I am using Delphi 10.3. I started with Win32 and I wrote simple program which opens .shp file and reads geometry type and coordinates. Everything worked exactly how I wanted.
Then I add Win64 platform and wanted to test it. Unfortunately, program does not work properly on Win64. I can read only geometry type, other info like coordinates etc. are mostly null.
Did someone try to use shapelib library?
Could you give me a hint? Maybe there is some distincion between Win 32/64 data types?
I appreciate any kind of help.
Update
To be more precise, I added screenshot covering the same test object on Win32 and Win64. Running on Win32 gives me values just how i want - I need especialy nVertices and padfX, padfY, padfZ. Running on Win64 gives me incorrect value of nVertices (0) and weird one-line displacement (padfX in Win32 is now padfY in Win64).
Besides eventual 32/64 bit related issues,
ShapeFileII.pas
That's a 20 years old legacy code.
I would recommend using the free ArcView ShapeFile OCX and DLL, instead.
VB6 OCX & DLL, .NET 64bit specific and AnyCPU DLLs are included.
Pascal code snippets used to be included in the library's docs, as far as I remember.
In any case better check the author's repository:
https://github.com/rosspickard/ArcShapeFile

Covnerting PDF's to TBitmap image

what is the easiest method to convert a PDF into a TBitmap image in delphi?
if there are any commercial available tools for delphi, I can buy one if it is reliable and or not expensive...
I am thinking of some kind of viewer which I can browse pages.. zoom... and export in the desired resolution..
I have had good results with QuickPDF. It's relatively inexpensive and there is a trial version available.
You could try using the ghostscript api from delphi (see http://ftp.uasw.edu/pub/ghostscript/contrib/ for delphi example files) to convert to a bitmap.
Though I've not used it (was just aware of its existence) I would expect you should be able to put the data into a memory stream and read it from there.
Though, if your software is going to be non-open source it could be an issue .

TWAIN scanning components for Delphi

I need to add TWAIN scanning to an Delphi application and am having trouble locating an off-the-shelf component to do so.
I downloaded TDelphiTwain but, when used in D2010 on Windows Vista, it does not appear to recognize any Twain sources on my system. I also tried the trial version of Twain Toolkit for Delphi from MCM which has the advantage of being currently updated (DelphiTwain's last update was 2004), but the Twain Toolkit will not even compile on my system (I think some of the DCUs are out of date).
Can anyone suggest a simple method of getting TWAIN scanning into my Delphi application?
UPDATE: Using vcldeveloper's update to DelphiTwain (see below) I was able to get this working. Also, I also discovered that Envision Image Library supports Twain scanning as well as assisting in handling multi-page TIFFs, and has been updated for compatibility with D2010.
Late Breaking UPDATE VCLDeveloper's code, below, works fine. However, I settled on Envision library which includes the ability to easily create multi-page TIFF files. I got the Envision scanning, including multi-page file handling, implemented in a few hours.
I changed DelphiTWAIN to work with Delphi 2009 and 2010. You can download the source code from here: http://www.kluug.net/delphitwain.php
Additional links are here:
http://torry.net/pages.php?id=507
and here: http://www.delphipraxis.net/1179589-post3.html
Another graphic library that also supports TWAIN scanning is ImageEn which also can save the scanned documents as PDF (as well as numerous graphical formats). That feature alone sold me on that product years ago.

How do I get Acrobat Reader Imported into Delphi 2007?

I have imported Acrobat Reader using Components | Import Components. The AcroPdf_TLB unit is created in the Imports directory.
When I try to use the AcrobatReader component, as follows ...
AcroDoc := TAcroPDF.Create(nil);
... I get an 'Unspecified Error' exception (EOleSysError). Any ideas?
Thanks, Pieter.
If you are unhappy with the results you are getting there (I was), you might consider giving QuickPDF a try. The price is not unreasonable, they have lots of good PDF functions included and you can display a PDF accurately in a TImage control with a call to RenderPageToStream. One thing I discovered working with form fields is that I had to use their FlattenFormField before rendering to get the form field contents to be included in the rendered image.
Follow up:
I did not mention originally that QuickPDF also works for printing. For form fields, you have to do the same FlattenFormField routine, but the results look good with much less overhead than relying on Acrobat Reader.
We use the Adobe Reader plug-in and face this issue often. It particularly surfaces after a user performs a web-update on the Adobe Reader.
Try un-installing (via the Control Panel), then re-installing the latest Adobe Reader.
That invariably clears the issue for our users.
Put the component on a TForm, then it probably works.
The Acrobat ActiveX/COM object is notorious for not supporting interfaces of older versions properly. You get EOleSysErrors all over the place.
What I have personally done for a couple of clients, is load the PDF documents in a TWebBrowser.
TWebBrowser is a wrapper around the ActiveX/COM component that Internet explorer uses to display everything.
Adobe is pretty good in making that work with each Acrobat update, so the TWebBrowser then also works.
Note that this only makes sense for displaying the PDF document.
--jeroen
We successfully used the acrobat v6 reader component in our Delphi 7 app, but found that it really requires acrobat v6. Users today who install only acrobat v9 get an error when they use our app to view a pdf because the acrobat component is not backward compatible in this way.
So yes, you can do it, but there are probable issues going forward.
A third party tool is prob best...

Delphi - Displaying All Image Format

Im a newbie programmer in Delphi. I need help, I have a small project which I need to display all kind of image format.
Please suggest what should I do or any component in delphi that support all image format? thanks for the help in advance.
Have a look at the GraphicEx library available from www.soft-gems.net. This should give you most (if not all) of the formats you want.
I found a Library that suites my need. It called vampyre library and works amazing. It support TIFF,tif, animating gif and many more
You can use several image types with the standard TImage component. At least bmp and jpg (if you use the Jpeg unit).
Version 2009 added some more. Image formats (I thought at least png and wmf).
There are a lot of third party components for image display/processing. A google search will show them all.
GraphicEx should be a good start. It's free and contains the most used formats.
Both ImageEn and Imaging Toolkit for Delphi offer wide range of supported format
and you can find more in torry site

Resources