Git Product home page Git Product logo

concept-qml-to-pdf's Introduction

concept-qml-to-pdf

A simple proof of concept for printing qml items to pdf.

If you want a quick and easy way of creating a pdf file for a page in your app(and without having to change the application) you can simply grab an image and add it to a pdf file. See a sample here of how that pdf could look like: sample_qml_image

However, there are some disadvantages. The disadvantage tackled for this proof of concept is that you aren't able to select the text in the pdf file. But the idea could be extended to other items that you don't want to be exported as an image but rather as a native pdf element.

The idea is really simple: gather all the text items visible on screen and render them over the image using QPainter::drawText(which will generate a selectable text in the resulting pdf).

It will be a challenge to make the text drawn with QPainter::drawText to look exactly like the one in the application but I think it's possible by just extracting the QTextOptions from the qml Text item.

This could be a good and easy solution to some specific usecase. Here is a resulting pdf file with the text added above the image: sample_qml_to_pdf.pdf

This is how the original qml application looks like: qml app image

concept-qml-to-pdf's People

Contributors

dumrelu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.