Git Product home page Git Product logo

printinghtmldocuments's Introduction

PrintingHTMLDocuments

How to quickly build an HTML document containing text and graphics and use WebView to print it (Part of the series Mastering Android)

  • Dependencies and prerequisites : Android 4.4 (API Level 19) or higher
  • The Android framework provides a way to use HTML to compose a document and print it with a minimum of code.
  • In Android 4.4 (API level 19), the WebView class has been updated to enable printing HTML content. The class allows you to load a local HTML resource or download a page from the web, create a print job and hand it off to Android's print services.

When using WebView for creating print documents, you should be aware of the following limitations:

  • You cannot add headers or footers, including page numbers, to the document.
  • The printing options for the HTML document do not include the ability to print page ranges, for example: Printing page 2 to 4 of a 10 page HTML document is not supported.
  • An instance of WebView can only process one print job at a time.
  • An HTML document containing CSS print attributes, such as landscape properties, is not supported.
  • You cannot use JavaScript in a HTML document to trigger printing.

Possible Error

  • It is possible that when you click the print button you get "Unfortunately, Print Spooler has stopped". In such a case, the only solution I seem to have come accross is to clear the cache of Print Spooler in the device and then try again.

printinghtmldocuments's People

Contributors

sprihabiswas 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.