Android print content from your mobile application.


In this blog we will learn on how to print content from your application by connecting with your wifi printer.

Android community provides some APIs that helps us in printing content from our application.They have classified the printing into three categories :

  1. Printing a Photo
  2. Printing HTML Content
  3. Printing Custom Document

You can find more details regarding these categories over here :

Here, we will discuss about how to print the html content as i needed to print only that.

You can try the other two yourself.


  1. Create a new WebView dynamically.
  2. Create an instance of PrintManager.
  3. Create an instance of PrintDocumentAdapter
  4. Create the data in the HTML format.
  5. Now execute the print command of the Print manager.

Implementing this is not at all difficault if you follow the steps in the same manner.

Now lets have a look at the code to have a clear idea of how to print the html content.

This is the main piece of code . Now lets have a look at the function createWebPrintJob(view)

And finally lets have a look at the function getHtmlContent() :

You can change the content of the  getHtmlContent as per your need.

And it is done.

But keep in mind that your Printer and mobile should be on the same wifi network.


. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


  • santosh dahal
    How should I check the name of printer and print through that printer only. Suppose many printer are attached
    • anchit (Moderator)
      If there are multiple printers that can be connected throught his code, the first window that will appear should automatically ask for the printer selection and then you can select the printer from the list of printers.

      If due to any reason this is not working please share a snippet of what exactly are you trying and I will try to help you.

  • Mike Heming
    is there any similar option for ios as well?
    • anchit (Moderator)
      Hi, I have not actually used anything like that in iOS as I never felt the need too.
      But As far as I know, you can try putting your content in a file and then from UIActivityViewController you can easily print the same.
      iOS already allows you to print the PDF files saved over your phone.
      So, you can easily take help from that too.
  • css.php

    We've bought a Shopware Extension which is a hybrid App, which we can now offer in the Google Play Store and the IOS App Store. I'am still impressed how fast and how sharp the support team leads us through every process of the App-Store clarification. Very fast and useful response.

    Markus Walter

    Markus Walter

    Founder, Das Apartment Living

    Talk to Sales


    Live Chat
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home