PDF does not load inside browser but works fine on iPhone

Looking at the online help, it said 99% of the time it related to CORS policy but I confirmed that is not the case here. I put the file on my own website and setup CORS policy but did not work. Then moved the file to local environment and tested it, pdf loads fine with localhost but it would still not load in the browser using flutter.


I could not find any help out there, i think this feature is buggy on the website and probably is not supported. Can someone verify it does work for them and if yes, what code are they using? 


Thanks


Image_7420_1696293379297


1 Reply

DR Deepika Ravi Syncfusion Team November 6, 2023 04:33 PM UTC

Hi Hammad Khan,

Could you please confirm if you have tried the steps below to resolve the issue on your end?

Due to CORS security restrictions in a web application, some PDFs obtained from URLs might not be loaded in the SfPdfViewer web platform. Kindly refer to the flutter forum reported on the same.

This issue can be resolved by configuring the CORS settings in the requested server or by disabling the security settings in chrome.dart as mentioned in the below steps:

  1. Go to flutter\bin\cache and remove a file named: flutter_tools.stamp
  2. Go to flutter\packages\flutter_tools\lib\src\web and open the file chrome.dart.
  3. Find ‘--disable-extensions’.
  4. Add ‘--disable-web-security’.

To know about this kindly refer this UG documentation link : https://help.syncfusion.com/flutter/pdf-viewer/getting-started#load-document-from-the-network

Regards,

Deepika R


Loader.
Up arrow icon