0
Hello. I have an HTML page on a server with several links to pdf files in windows and I’m bringing this same page and the code along with the pdfs for an App for Android. I’m using Android Studio and putting the files directly in the Assets directory, incorporating them into the App. Unfortunately the links now do not open the pdfs files. The html links have been modified to the new Asset directory as: href = "file://android_assest/name_do_arq.pdf". It’s like there is no PDF reader (Pdf view). When I open an index.html file by the App, in the same path as the Asset or open a pdf file by my "file explorer" embedded in the App the file opens normally. I just can’t open it by the html page link as shown earlier. I would appreciate if you had any tips to open this link since I would like to take advantage of the already built page. [! [insert image description here][1][1]
The href s in blue are the calls within the html page. The test.html call opens normally but the other pdfs links do not.
When I try to open the PDF file by the link on the html page it does not open. It seems that the link is not interpreted although the.pdf test file is in the same directory as the test.html file. I am using the https://github.com/barteksc/AndroidPdfViewer linked in my app in my app on Android 8.0
The basic example html file to link to the pdf file is as follows: "the test.html file and the test.pdf file are in the same android App directory (android_asset directory).
href="test.pdf""tb does not open pdf"
href="http://www.google.com"> Google "opens google"
iframe src="test.pdf""iframe "tb does not open pdf"
I have tried using the link formats in href as p.example:
"href="android_asset/test.pdf"
"href="file://android_asset/test.pdf"
"href="file://android_asset/test.pdf"
in JS also: "embed src="test.pdf" type="application/pdf" witdh="100%" height="100%"
"Page not found or URL" error appears or else the background is white as if it was going to render the pdf and nothing happens.
Does anyone have any tips that can tell us why this might be happening? Thank you all
I am using Kotlin. I have already tested the examples. Permissions are active. Access to pdf through html does not work. It seems that the lib pdf view I compiled in the application does not render the pdf files or the files are not found in the Asset directory. It seems that the files in the "Assets" directory are combined in the "release" and the external html call does not find the files.I will try: <tags> in Html5: <Object data="test.pdf#page=1" type="application/pdf" width="100%" height="100%"> <p><b>Examplo</b>: The browser does not support Pdfs. download to see it: <a href="test.pdf">Download</a>. </p> </Object>
– Uchoa