Member-only story

Create PDF and print PDF with WIFI printer in Android Java.

Harshita Bambure
4 min readJan 21, 2022

--

Today we will learn how to create a pdf file and after creating a pdf file we will be able to print this pdf using a wifi printer.

First of all, we need to add dependency in the build.Gradle(:app)file.

implementation 'com.itextpdf:itextg:5.5.10'
implementation 'com.karumi:dexter:6.2.3'

Now we need to add uses permission and the provider in the manifest file.

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidpdfprint">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AndroidPDFPrint">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<provider
android:authorities="com.example.androidpdfprint.fileprovider"
android:exported="false"…

--

--

Harshita Bambure
Harshita Bambure

Written by Harshita Bambure

Android Developer || WomenTech Global Ambassador at WomenTech Network. || Yoga Teacher || Member @WTM .

No responses yet