1

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.

Gastón Saillén
  • 12,319
  • 5
  • 67
  • 77
user3792429
  • 203
  • 1
  • 16

1 Answers1

3

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;
user3792429
  • 203
  • 1
  • 16