Cannot Load Local PDF Android

Welcome! Forums Unity Plugins In-App Web Browser Cannot Load Local PDF Android

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #11778
    mdyrho
    Participant

    Hi,
    I have been trying to open a local pdf stored in streaming assets. However when I try to open the file it just loads infinitely.

    here is my code:

      public void OpenLocalPdf(string path)
        {
    
            #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
            InAppBrowser.OpenLocalFile(path);
            Debug.Log("Opened!" + path);
            #else
            Debug.LogWarning($"Attempted to open '{path}' in InAppBrowser, but that " +
                             $"only works on iOS and Android, not in Editor or on desktop");
            #endif
        }

    Receiving the path from an on click event or writing it directly in the script produces the same result.

    #11779
    PiotrPiotr
    Keymaster

    This is expected, Android webviews do not support PDFs, you would have to use pdf.js or something similar.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.