tags:

views:

15

answers:

1

I'm developing a page in asp.net/C# that displays files and HTML pages from a db. When viewing these files I want to have a header strip with a logo and a download file button, then the file itself below.

The VAST majority of these files will be HTML/text pages but some may be PDFs or .docx files. I just want a common header bar for all document types.

I don't really know how to add the header bar to a pdf. Here is my code to display a PDF:

Response.Clear();
Response.ContentType = "application/pdf";
Response.BinaryWrite(GetPdf());

How do I add HTML above the BinaryWrite() part? Do I need to use iframes; I know they're frowned upon, but I don't have any other ideas?

A: 

If you want the browser to combine HTML and PDF on the same page then yes, you would have to use iframes. (Actually, I can't even be sure that would work, since I've never tried it, but it's worth trying.)

Alternatively, there may be some converter available that displays a preview of the PDF in HTML (like Google does). It won't be perfect, but might be acceptable, since the viewer can download the original PDF if they want.

Evgeny