I am Interested in printing some text on a Pre-Printed Document.
how am i supposed to align the text & print it on the Document ?
I am Interested in printing some text on a Pre-Printed Document.
how am i supposed to align the text & print it on the Document ?
take a look at QTextDocument and QTextEdit (which uses QTextDocument).
Another thing would be to use QGraphicsView where your QGraphicsScene would have the existing content as background and then you can use QGraphicsTextItem to position some additional text, and at the end you can render scene to the printer.
Hope that I understood you right :]
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
The "Pre-Printed Document" am i referring to is a Pre-Printed Paper , ie some printing has been done on a paper sheet , now i need to print some additional text at some desired locations on the paper.
So you can take a look at this example: http://doc.qtsoftware.com/4.5/demos-textedit.html and you can find it in Qt Examples & Demos -> Demonstrations -> Text Edit.
As for the solution with QGraphicsView you can make something like page preview with QGraphicsTextItems in it, and make some of these items be editable and maybe movable
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
Use a typewriter
@Ini : No need of Typewriter !
i found a solution.i used QPainter::drawText() to align the text at a desired location on the Pre-Printed form (paper)
Here is the Code :
QPrinter printer(QPrinter::HighResolution);
printer.setPaperSize(QPrinter::A4);
printer.setOrientation(QPrinter::Portrait);
printer.setFullPage(true);
QPainter painter(&printer);
QPointF pt;
pt.setX(20 * (printer.width()/printer.widthMM()));
pt.setY(20 * (printer.height()/printer.heightMM())) ;
painter.drawText ( pt, "prints at 20mm X 20mm");
----
Thanks all , for Replying .
Bookmarks