PDF not loading or Slow loading (no partial loading)
For better and fast experience – PDF is loaded on demand, If it is served as ‘gzip’ Whole PDF will be loaded – very bad user experience.
Also if the files are hosted in different domain name the you need to enable CORS:
For Apache Server, add following lines in .htaccess file
Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Headers "Range" Header set Access-Control-Expose-Headers: "Accept-Ranges, Content-Encoding, Content-Length, Content-Range"
For partial loading. disable gzip:
<IfModule mod_headers.c> <FilesMatch "\.pdf$"> RewriteRule ^(.*)$ $1 [NS,E=no-gzip:1,E=dont-vary:1] </FilesMatch> </IfModule>