Barcode generation in Qt4 - c++

Any ideas for barcode generation into a textbox in c++ under Qt4?
The idea is to have it in some kind of text format to save it and be able to read it later on.
What about generating the image for printing?
Thanks in advance.

Generating a barcode is as simple as using a barcode font. You can embed the font in your application, and create barcode wherever you can put text.

It depends on what kind of a barcode you are talking about, however, a search on Codeproject yielded this interesting library that is written in C#, however it can generate Code 39, Code 128, Interleaved 2 of 5, to name but a few. Perhaps, this could be recompiled to make it look like a COM object using Runtime Callable COM Wrapper (RCCW), meaning on the C++ side, it looks like a COM library? And hence interact with it from a QT/C++ runtime environment.
Hope this helps,
Best regards,
Tom.

Generating barcode with Qt is quite easy - as Reverend Gonzo pointed out, you use a barcode font.
Then you can paint it with QPainter onto anything. Or print it.
I wrote a post/tutorial on generating code128 with Qt, github example included.
How to generate barcode with a font in Qt

Please check out zint, which can be found on Sourceforge.

Related

Showing text messages in augmented reality applications with ARToolkit

I would like to implement a simple AR desktop application. This application should first recognize a marker out of a set of pre-registered ones, and then, show on screen some particular information related to the detected marker.
I was thinking on using ARToolkit, even if it is quite old and not anymore supported.
Do you think ARToolkit is a good solution?
How can I show text messages on screen using ARToolkit?
I found an interesting article here http://mycodelog.com/2010/03/23/printw/.
It easily explains how to implement a "printw" function that works exactly like printf.
osgART could be helpful http://osgart.org/wiki/index.php/Main_Page

Windows C++ Hex Viewer GUI component

I'm looking for a Windows C++ (or a Embarcadero Delphi/C++ Builder VCL component) GUI component for a professional looking Hex Viewer/Editor. While pretty easy to build up a rudimentary one I require a polished modern looking component. (Can handle arbitrary amounts of data, loading from some sort of stream as needed. Colors/Fonts customizable. Highlight byte selections/individual bytes)
2 of the more usable hex viewer/editor components from applications I've seen in action are below:
http://niiconsulting.com/checkmate/wp-content/uploads/2009/10/fileinsight-2.jpg
http://www.the-interweb.com/bdump/hexer/hexer-linux.png
Can anybody recommend anything?
Thanks in advance.
After a quick search on the interwebs, I found the following component for Delphi:
http://www.tkweb.eu/en/delphicomp/khexeditor.html
QHexEdit2 is now able to edit large files (> 2 GBytes) and is available for Qt4, Qt5, PyQt4, PyQt5. It is now hosted on Github
https://github.com/Simsys/qhexedit2
You didn't mention Qt as an option as a C++ library to use. But it sounds like your circumstance may be flexible. So if you're able to use it there are a couple of options I noticed.
There's a hex component that you can drop in as a replacement for QPlainTextEdit or whatever:
https://github.com/Simsys/qhexedit2
The webpage for that says that the size of data has in general to be below 10 megabytes. A heavier-weight paging solution exists as a program called LFhex (source in the download)
http://stoopidsimple.com/lfhex

How to open and display a PDF file using Qt/C++?

I am trying to open and read a PDF file using Qt, but there is no specific way to do that.
I know the subject is a bit old, but...
I found a really simple way to render PDFs in Qt via QtWebKit using pdf.js (http://mozilla.github.com/pdf.js/).
Here is my realization of the idea for Qt5 and the WebEngine: https://github.com/Archie3d/qpdf
Qt itself does not include PDF reading/rendering functionality as far as I know. You might want to have a look at libpoppler which has Qt bindings.
I found this very interesting article on qt-project.org - "Handling PDF - Qt Project".
This page discusses various available options for working with PDF documents in a Qt application. The page does not exactly show how to "open and display an existing PDF document" but it can help you deduce something useful out of all that is explained there.
Here, the page says:
For rendering pages or elements from existing PDF documents to image
files or in-memory pixmaps (useful e.g. for thumbnail generation or
implementing custom viewers), third-party libraries can be used (for
example: poppler-qt4 (freedesktop.org) and muPDF (mupdf.com)).
Alternatively, the task can be delegated to existing command-line
tools (like poppler-utils (freedesktop.org) and muPDF (mupdf.com)).
You can use PdfViewer which is a lightweight PDF viewer that only uses Qt. It contains a PdfView widget which can be easily embedded in your application.
Simple answer : it is not supported in the Qt API.
Other answer : you can code it, I suggest you have a look at this Qt application which uses Ghostscript
The best way I have found to open a pdf is using QProcess in Qt.
You may want to use okular for pdf proccessing.
I know this is an old post, but I stumbled on it during my initial search so I figured I would post some documentation from the solutions I used.
As of Qt 5.10
Check out the QPdfDocument Class. This class can open a PDF and you can use the render function to render a page to an image. I use the QQuickPaintedItem to then "draw" this image but I am sure there are more ways to handle the QImage output.
Prior to Qt 5.10
I used libpoppler to do a VERY similar process.
#include <poppler/qt5/poppler-qt5.h>
Use the Poppler::Document Class to load and handle the entire PDF document and look at the Poppler::Page::renderToImage function to output the page as a QImage.
Qt does not support reading PDF files out of the box and among many approaches you can use Adobe's PDF Reader ActiveX object along with a QAxObject.
You may want to check out this link which describes how to read PDF files in Qt/C++ using ActiveX and has a downloadable example project.

How to extract selected area of the gui component to PDF in QT

I need to make the tool like Snagit and to take the picture the selected area of the component. I'm searching how to make this tool in Qt.
I firstly prefer using Qt native library but if there is no library which fullfills this requirement, any good c++ libray can be accepted for me.
Any help will be appreciated.
Thanks
I'm not sure to understand exactly what you want. I assume you want to take a screen shot ? and then put this picture into a PDF document.
To take a screenshot with Qt, have a look at this :
http://doc.qt.nokia.com/4.0/widgets-screenshot.html
This will show you how to take a screenshot (using QDesktopWidget) and get a QPixmap.
You can then display this QPixmap into a QTextDocument (see QTextDocument::addResource) and print this document into a PDF file. Something like this :
QPrinter MyPrinter(QPrinter::HighResolution);
MyPrinter.setOutputFormat(QPrinter::PdfFormat);
MyPrinter.setOutputFileName("test.pdf");
MyPrinter.setPageSize(QPrinter::Letter);
MyPrinter.setColorMode(QPrinter::GrayScale);
MyPrinter.setOrientation(QPrinter::Landscape);
MyTextDocument.print(&MyPrinter);

C++ Library to render ODF documents?

I am unable to find any open source libraries to render ODF documents using C++. I found ODKit suporting Java and AODL for .NET C#.
Does any one have any idea or provide me any pointers.
I found a Qt source to parse ODF. Qt already has built in ODF writer.
KOffice supports ODF and is written in C++. I suspect they may have solved whatever it is you are trying to solve. http://www.koffice.org
It may not be the most elegant solution but OpenOffice itself is capable of rendering and the OOoSDK can be used from C++ as seen here for writer and here for spreadsheet.
There is none. You're better AODL or any of the other libs available (python, perl, java, etc) and doing a binding to it
KOffice can be an idea, but if I just want to display an odt file in a nice Qt QWidget, but I don't want to depends on DBus and a lots of Kde feature.
The Idea is to take a look a Flake and KoText libs as Thomas Zanders says on this Forum.