DEV Community

Jack Huynh
Jack Huynh

Posted on

Zooming PDF iframe on Iphone

Have you ever embedded a PDF file using iframe in your website?

Yes??

Great! Did you manage to get the PDF file shows up?

Desktop

Image description

Android

Image description

Duh, anyone can do that

Okay, then did you test it on Iphone devices?

Why it's works fine on Android?

Oh my, you should come here and take a look

Image description

Can't scroll or zoom out, this is broken

Why??????

Solution

Okay there is no time to panic, we need to fix this before the boss see it.

But how???

We'll using the Google Docs Viewer it's merely a URL which allows you to preview a document while passing the link of a file to it.

<iframe src="https://docs.google.com/viewer?url=[FILE_URL]&embedded=true"></iframe>

Enter fullscreen mode Exit fullscreen mode

And boom everything works again

Image description

Top comments (0)