Commit 7df92d25 authored by tanelipe's avatar tanelipe

Updated the README to include actual printing example

parent 3099dbf4
......@@ -25,3 +25,16 @@ QQuickItem *root = ...
QmlPrinter printer;
printer.printPDF("C:\\Users\\Public\\Documents\\Report.pdf", root, true);
```
Printing to actual printer
```
// Get the root view object
QQuickItem *root = ...
// Get list of available printer names for the computer
QStringList names = QPrinterInfo::availablePrinterNames();
// Let the user select one
QPrinterInfo info = QPrinterInfo::printerInfo(selectedPrinterName);
// Check that the printer is valid and usable (see QPrinterInfo documents for more information)
QmlPrinter printer;
printer.print(info, qobject_cast<QQuickItem*>(root));
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment