PDF in Web User Control

  • Thread starter Thread starter Nick K.
  • Start date Start date
N

Nick K.

I would like to display a PDF file in a Web User Control (.ascx). I know
that in a Web Form (.aspx), the ContentType can be set to "application/pdf".
How can I set the ContentType in a Web Users Control and display a PDF file?
If I can't use a Web User Control, I may have to redesign the entire
application.
 
A user control does not provide display - it provides the container for
display elements, so you have to think how would I display a PDF in a
browser and out put that as your user control output. Typcially, a user
control does not contain the page - which is what is required for a PDF -
the whole page. The easiest way I can think of is for your user control to
contain an iFrame and render the PDF into the iFrame as content. Should
work in theory.

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
 
Back
Top