• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 364
  • Last Modified:

Handling PDF files using ASP

Hi all,
Is there a way (using a component) in ASP or ASP.NET that you can show a PDF file off the server and show it in the browser (i.e on a webpage) WITHOUT the user having to download it?

Alternatively is there a component available that can convert PDF files into good quality JPG or HTM/ASP pages on the fly? i.e. when the user requests the file?

I need to be able to deal with 15-20 page PDFs, but as some users are on a dial up connection it would take too long to download the entire file and I don't want to have to go down the road of splitting the file into sections!  Any other suggestions or thoughts are welcome!

1 Solution
Hi rtuplin,

Before trying whatever, just remember that the browser MUST download the full file before showing it. I mean, suppose you find a way to show a PDF file on the browser. The user opens a page, and it shows the PDF file. When this is done, the full page is downloaded! If your problem is the slow connection, the result is EXACTLY the same as if the file was downloaded by a button or a hyperlink, or whatever.
If you convert it to JPG, it's even worst, because a PDF file converted to JPG is bigger then the original.

rtuplinAuthor Commented:
Hi diasf,
Yes appreciate that.  I was hoping there might be a component available that could pass PDF pages to a browser a page at a time, there by resolving the speed issue!

The idea behind converting the PDF to JPG files is that each JPG would be a single page of the PDF, there by reducing the download time that the user has to wait before he see's the page he's waiting for. i.e. it would only download a page at a time, not the full file.

Does it have to be on the fly?  Have you got that many PDFs flying in and out of your data store?  Or could you do some sort of late-night batch convert and turn the PDFs into HTML files, so the user can choose which they prefer -- a download or a web page?

Google does something very similar (though the formatting requires some attention!) and from looking that the "view as html" links they have, they're searching a cache so I reckon they might to something very similar: a batch convert on spidered PDF files.

Googling for "convert pdf to html" has come up with a number of solutions, some more expensive than others...

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

rtuplinAuthor Commented:
Hi Cirieno,
On average its 1, possibly 2 PDF files a week, but because they will arrive from different users, it needs to be some kind of server component to deal with it rather than a set of user procedures!

A late-nite batch job would be ideal and my perfect scenario is to convert the files into a HTML format with low res images.  The PDFs themselves are created using Adobe Insign CS2 and contain both text and images, but would I suspect convert with no major issues into HTML tables.

At present our site is ASP, but we do have full access to Visual Studio.NET so the section of the site which displays the PDF/HTML/ASP/JPG (delete as appropriate!!!) files could be .NET coded if the technology is better.

I'll have a look at google!


Yes, you could convert PDF to JPG, thus dowloading a page at a time. But still, the PDF-page is much shorter in file size as the same JPG-page. Maybe you could separate PDF files page-by-page. Can you?

Also, look at Cirieno hint, to convert to HTML. That's the shortest kind of file.

There is a feature in Adobe Acrobat that allows you to set a document as "Fast Web View".  Here is what it says in the Help File:

Allow Fast Web view displays PDFs from the Web one page at a time. If this option is not selected, the entire PDF will download before it is displayed.

It looks like Adobe Acrobat has the capability to run batch processes as well.  There is probably some way you could set it up to go through a directory and enable each document for fast web view.  As far as other formats, the only one that makes ANY improvement on size is .png  I just converted a 98K pdf to a .png file and it is now 94K   All other formats, at least doubled the size of the file.  So if there is no significant gain and you can get the pdf to download one page at a time, that would be the way to go.


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now