I've been trying to create a script that will take defined pages of a PDF and display them to a webpage using PHP.

I've looked through the PHP Manual and only came up with ways to create a PDF, but no read options.

--Detailed Scenario--
My school wanted me to make a smartphone application for them using a free service called PhoneGap (allows you to write a smartphone application using HTML, CSS, and JS), they also wanted it so after I graduate they will have no issue in using it (automation). The application must have course descriptions as well as other stuff, the course descriptions are stored in PDF on their website. What I came up with for a solution (and I don't know if it is possible) is to "read" the PDF into a temporary file, and display those contents.

I would like to use a temporary file because the school won't update the PDF more than once a month (if that) and I don't want to kill the user's data plan.

To be exact of what the PDF contains:
- Flow charts
- Formatted text (bold, underline, etc)
- Tables
- Background Gradient (Which needs to be obliterated)

(I know this is a help forum so I am not asking for full code, I just want to get help in terms of what I need to look at so I can get this done)

Any and all help is appreciated.

Recommended Answers

All 2 Replies

There isn't an easy and obvious solution for this. You can generate a PDF with PHP but pulling it apart is a different matter. The easiest solution would be to generate a file at the source that has exactly what you want and then all you have to do is to display it. This could be a second version of the existing file. Trying to take an existing PDF file and then rework the content to give you what you need is certainly the hard way and may not be do-able.

A second best alternative, if you can find something to do it, would be a PDF reader which will take a parm for the pages that you want to display. I'm not aware of one, but you might find something if you do a search.

The least likely to succeed would be trying to read the content and manipulate it. The programs that can do this with some success are desktop applications. They often aren't 100% with graphics. I am not aware of any that have an API that lets you get detailed access to the content.

That's what I was afraid of...

Thank you for your help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.