I am using following gradle file for pdf generation:
compile 'com.itextpdf:itextg:5.5.10'
Since my app has chinese characters,I have added itext-asian.jar file in my classpath.Initially it was giving error 'More than one file was found with OS independent path 'com/itextpdf/text/pdf/fonts/cmap_info.txt'
So I added this in my gradle:
packagingOptions {
pickFirst 'com/itextpdf/text/pdf/fonts/cmap_info.txt'
}
Now gradle is successful,but nothing is displayed in my pdf.Its just a blank screen.
This worked for me,I forgot to add FLAG_GRANT_WRITE_URI_PERMISSION
Intent i = new Intent(Intent.ACTION_VIEW);
i.addCategory(Intent.CATEGORY_DEFAULT);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = FileProvider.getUriForFile(MyDealActivity.this, BuildConfig.APPLICATION_ID + ".provider",new File(path));
i.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
i.setDataAndType(uri, "application/pdf");
return i;