Поскольку у вас есть yourBase64String, вы можете преобразовать его в байтовый массив и затем сохранить в виде файла.
FileOutputStream fos = null;
try {
if (yourBase64String != null) {
fos = context.openFileOutput("myPdf.pdf", Context.MODE_PRIVATE);
byte[] decodedString = android.util.Base64.decode(yourBase64String , android.util.Base64.DEFAULT);
fos.write(decodedString);
fos.flush();
fos.close();
}
} catch (Exception e) {
} finally {
if (fos != null) {
fos = null;
}
}
Теперь после этого откройте этот файл PDF
Uri path = Uri.fromFile(new File(myPdf.pdf));
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
Toast.makeText(OpenPdf.this,
"No Application Available to View PDF",
Toast.LENGTH_SHORT).show();
}
Добавьте это разрешение в свой манифест
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>