I have a button that opens a local pdf manual like this
File file = storeFile(is, "user_manual.pdf");
Uri uri = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
This opens the document in Adobe Acrobat Reader that is installed and our setup guarantees that Acrobat Reader is always installed.
The problem is that the manual has 50 pages. If the user were to scroll down and hit back and select the user manual button, it takes us back to middle of the pdf which would be normally good but I have a specific requirement that it has to open the first page that has an index.
How do I open the document such that it always shows the first page of the pdf?
I have tried
intent.putExtra("page", 1); // parameter used on desktop Acrobat reader
and
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
and
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
but it always opens the pdf the second time where the user left the first time.