Skip to content

Commit

Permalink
#42 save and share pdf after creation in android 13
Browse files Browse the repository at this point in the history
  • Loading branch information
gkemon17 committed Oct 16, 2022
1 parent 200766f commit 4753729
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ public void onClick(View v) {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath()
+ "/" + getString(R.string.app_name))
.actionAfterPDFGeneration(PdfGenerator.ActionAfterPDFGeneration.OPEN)
.handleInFileStorage(true,true)
.build(new PdfGeneratorListener() {
@Override
public void onFailure(FailureResponse failureResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,11 @@ private void dealAfterGeneration(ActionAfterPDFGeneration actionAfterPDFGenerati
if (actionAfterPDFGeneration == ActionAfterPDFGeneration.OPEN)
intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
else intent = new Intent(Intent.ACTION_SEND);

intent.setType(context.getContentResolver().getType(path));
intent.putExtra(Intent.EXTRA_STREAM, path);
intent.putExtra(Intent.EXTRA_TITLE, fileName+".pdf");

intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Expand Down

0 comments on commit 4753729

Please sign in to comment.