I have several PDF documents on my server, so I want to show them inside my html page, in one go, mixing these documents with html texts, images, generating only a page to be printed by the user. Is there a way to get it using PHP? Some documents have more than one page. So I think using the object element will not resolve the problem because it requires a prefixed height.
Asked
Active
Viewed 90 times
-1
-
not exactly a php solution, but maybe worth a try: https://github.com/mozilla/pdf.js – gherkins Dec 16 '13 at 20:40
3 Answers
1
I think that you need convert your PDF into HTML... see this library pdftohtml.

Ignacio Ocampo
- 2,693
- 1
- 20
- 31
0
A PDF files' source code is not HTML so a PDF file always needs to be opened using a plugin which can interpret the code. Plugins generally take over the entire page and don't mix with HTML. The only exception I know of is SWF files.
An <iframe>
solution would look like this:
<body>
<h1>First PDF</h1>
<iframe src="pdf1.pdf"></iframe>
<br>
<img src="image_1.png">
<br>
<br>
<h1>Second PDF</h1>
<iframe src="pdf2.pdf"></iframe>
<br>
<img src="image_2.png">
</body>
Please note that simply printing the page will have undesireable and unpredictable outcomes.
If you know that your user-base will be HTML5 compliant then you can look into embed
Other ideas:

Community
- 1
- 1

MonkeyZeus
- 20,375
- 4
- 36
- 77
0
I have a series of td's in a table that can be clicked and it shows the .pdf.
Here's the code
$("#patienttable").on("click", "td#clickforpdf", function(e){
var imagetr = $(this).html();
if (imagetr.length > 1)
{
window.open('imagingpdf/' + imagetr, 'Report', 'fullscreen=no'); return false;
} else {
return false;
}
});
Seems to work for me, using window.open - doesn't seem to need sizing.

TimSPQR
- 2,964
- 3
- 20
- 29