Replies: 7 comments
-
We've found some similar issues:
If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.
|
Beta Was this translation helpful? Give feedback.
-
Could you try the workaround : allow the WKWebView to have file access from file URLs, which is what you're giving it here. |
Beta Was this translation helpful? Give feedback.
-
I tried adding it with
But it doesn't seem to work. |
Beta Was this translation helpful? Give feedback.
-
Could you provide a sample project for us to investigate it further? |
Beta Was this translation helpful? Give feedback.
-
Heres a sample project: Im on holiday right now so im not fully able to test it on iOS, but the part of code that doesnt work should be there. |
Beta Was this translation helpful? Give feedback.
-
I've faced the same issue. Successfully loaded pdf file from Resources, but can not load file from app's sandbox folder. |
Beta Was this translation helpful? Give feedback.
-
In cases like these I recommend to connect to the WebView-instance via a Safari from a Mac.
I'm 90% sure though the Safari DevTools will show you something like "Access to resource denied". |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I'm having trouble opening a pdf document in a .net MAUI iOS app: the pdf files in question are downloaded and saved in the AppData Directory so i can't put them in the app bundle. I load the pdf files in a WebView and setting the source as the absolute path of the pdf works fine, but i need to view it with pdfjs to have the toolbar. My problem seems to be in the url i put as source of the webview/ the file path i give viewer.html in the pdfjs folder (which is in the app bundle).
The following code is the webview in the page.xaml
The following code is what i have in the page constructor:
With an asset file in Resources/Raw it works fine but with a file in the Appdata directory the pdf doesn't load and shows the pdfjs toolbar and an empty document. I tried changing the path around but nothing seems to load the document. In Android it works with no problem.
Steps to Reproduce
Create a .net MAUI app.
Add pdf.js in Resources/Raw.
Add in the code a way to get a pdf file in the AppData directory.
Create a WebView and set the source as path of pdfjs' viewer.html + the path of the pdf file placed in the Appdata Directory
Link to public reproduction project repository
https://github.com/user-attachments/files/18280687/PdfApp.zip
Version with bug
8.0.100 SR10
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
Beta Was this translation helpful? Give feedback.
All reactions