[Solved] Failed to load pdf in chrome when downloading with PHP

Sometimes you struggle with issues that seem to be small at first glance but still consume a lot of time to find out what the real problem is especially when the issue can only be reproduced when a specific browser or version is used. In my case I build a script to download a PDF file in PHP. It seemed to work in all browsers until a client uploaded a very specific PDF file that wouldn’t open in chrome’s buildin PDF viewer but worked in all other browsers and also offline. Ahhhrr is it a chrome bug, or did I do something wrong? Continue reading to find out what I did to solve it.

Continue reading