CarloM 3 Posted August 12, 2019 Hello, Â I need to show a PDF in app, on iOS works well with TWebBrowser, but no in android. Â Any workaround, component ? Â Thank you 1 Share this post Link to post
Dave Nottage 648 Posted August 12, 2019 This works for 10.3.x if you have some kind of PDF viewer installed on the device: uses Androidapi.JNI.GraphicsContentViewText, Androidapi.Helpers, Androidapi.JNI.Net; procedure OpenPDF(const AFileName: string); var LIntent: JIntent; LUri: Jnet_Uri; begin LUri := TAndroidHelper.JFileToJURI(TJFile.JavaClass.init(StringToJString(AFileName))); LIntent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW); LIntent.setDataAndType(LUri, StringToJString('application/pdf')); LIntent.setFlags(TJIntent.JavaClass.FLAG_GRANT_READ_URI_PERMISSION); TAndroidHelper.Activity.startActivity(LIntent); end; Â 1 2 Share this post Link to post
FreeDelphiPascal 21 Posted November 6, 2024 (edited) Most libraries are for Windows but you can find also some PDF libraries that are cross-platform. Edited November 6, 2024 by FreeDelphiPascal Share this post Link to post
Chester Wilson 5 Posted June 24 Thanks - it worked a treat, by putting the mime type in, it selected (or sometimes asked me to select) which application to use to view the file. Â Â FileUri := ListBoxItemTags[ListBox1.Selected.Index].uri; Â Â Mime := ListBoxItemTags[ListBox1.Selected.Index].mime; Â Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW); Â Intent.setDataAndType(FileUri, StringToJString(Mime)); Â Intent.setFlags(TJIntent.JavaClass.FLAG_GRANT_READ_URI_PERMISSION); Â TAndroidHelper.Activity.startActivity(Intent); Â Share this post Link to post