开发者

How can I make two different PDF files appear in the same iframe?

I used the FPDF class to create a multi-page PDF document and then I used an iframe to display the multi-page document.

Here is an example of the result:

How can I make two different PDF files appear in the same iframe?

I want to do the same thing on anoth开发者_如何学Goer page, except a bit different. Instead of displaying one multi-page PDF document, I would like to let the user upload two separate PDF's and then I display the two PDF's within the same iframe.

How can I make two different PDF files appear in the same iframe


The PDF plugin will take full control over the iframe, and can not deal with multiple files.

What you could do to work around it:

Two IFRAMEs

One easy solution that comes to mind is having a HTML page in the iframe, that in turn contains two iframes or even frames.

You'd have to find out whether this works for you - the devil will be in the detail here, for example, it will not be possible to synchronize the scroll positions or zoom levels, which is probably what you want.

Merge PDFs

The only real way to do this that I can think of is to generate a PDF that merges the two PDFs next to each other. This is not entirely trivial. Check out the following questions for example:

  • PHP - How to combine / merge multiple pdf’s

  • Need to merge multiple pdf’s into a single PDF with Table Of Contents sections

there are more on SO when searching for "PHP PDF merge".


I don't think you can, the users PDF reader may (if it's set to do so) display the PDF inline, therefore you can only have one per iframe...

But! What about having two iframes? This way You can display two PDFs easily.


I would go with the merge, as suggested by Pekka. The plugin rendering the PDF is afaik only capable of having one PDF.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜