0

I am using mupdf library and I am deleting PDF Annotations and then saving the document using save method in PDFDocument.

Document doc = Document.openDocument(pdfFile.getAbsolutePath());
//I have code here to find the annotation at the touch location and delete it
((PDFDocument) doc).save(pdfFile.getAbsolutePath(), "");

Its working fine for the PDFs present in Phone Storage, but unfortunately Android doesn't support this method if pdfFile is in SD Card or in any removable storage. Hence I need to save it using storage access framework similar to here - https://stackoverflow.com/a/43317703

But PDFDocument doesn't have any method save the document to OutputStream or any method which returns PDFDocument as stream.

Is there any possibility to save PDFDocument to SAF?

RAMU
  • 176
  • 1
  • 8
  • Save the PDF content to a file first (e.g., in `getCacheDir()`), then copy it to the location that you get via SAF. – CommonsWare Sep 13 '20 at 11:15
  • Doing the same now. I am storing pdf to getFileDir() and copying it, but I am looking if there is any way to do it without copy as it will save the latency to copy file. – RAMU Sep 13 '20 at 13:55

0 Answers0