Handling PDF files using ASP

Posted on 2006-04-06
Last Modified: 2010-05-18
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!

Question by:rtuplin
    LVL 4

    Expert Comment

    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.


    Author Comment

    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.

    LVL 3

    Expert Comment

    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...

    Author Comment

    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!

    LVL 4

    Expert Comment


    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.

    LVL 12

    Accepted Solution

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now