How to Open a Pdf File in an ≪Iframe≫

opening PDF file in iframe on certain page

To open on specific page, add #page=[page number] to the end of src

<iframe width="700" height="1600" src="@Url.Action("OpenPDF", new { id = 8 })#page=4"></iframe>

if page number should be from the model, do

public ActionResult Index()
{
MyViewModel m = new MyViewModel() { FilePage = 4 };
return View(m);
}

...
@model MVC.MyViewModel

<iframe width="700" height="1600" src="@Url.Action("OpenPDF", new { id = 8 })#page=@Model.FilePage"></iframe>

how to embed PDF file into iframe using php

This should do the trick.

<body>
<iframe src="http://ipaddress/file.pdf" width="1000" height="1000"></iframe>
</body>

If the file is local you can put local file URL. But the file will not be accessible on internet.
For example:

 file:///D:/WebDesign/HTML/test/file.pdf


Related Topics



Leave a reply



Submit