Web Form and PDF

C

Cheryl

I'd like to display a web form at the top of an ASP.NET page and a PDF from
a SQL Server database directly below the web form.

Currently, I'm getting a PDF stored in the database and using BinaryWrite
to display just the PDF.

I'm using ASP 1.1 and VB.NET.

- Cheryl
 
C

Cheryl

I think opening the PDF in another window is the way PDF is intended to
function. I think this will be OK for what I need. I'll use an iFrame.

Thank you for responding to my question!!

- Cheryl
 
C

Cheryl

Hi John,

Using an iFrame still opens the PDF in another window. What am I missing?

Thank you.

- Cheryl
 
J

John Timney \( MVP \)

Technically an iframe is another window, only one that can be embedded into
a web page, hence your form can be at the top of the page with your PDF
displayed below it. Your iframe should be requesting the PDF (asp.net page)
and it should load in the iframe. Probably worth your while pasting a code
sample here.
 
C

Cheryl

Hi John,

Here's the code:

HTML:

<div id="divPDF" style="VISIBILITY: hidden" runat="server">
<!--Note that without a relative src attribute, iframe will cause a
nonsecure item warning!-->
<iframe id="ifPDF" src="test.htm" width="100%" style="HEIGHT:50em"
runat="server">[Your
browser does <em>not</em> support <code>iframe</code>, or has been
configured
not to display inline frames.] </iframe>
</div>
VB:

Dim inData() As Byte = System.Text.Encoding.ASCII.GetBytes("SMIflood-" &
Loanid)Dim outData() As Byte = New
System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(inData)
Dim sb As New System.Text.StringBuilder(32)
Dim b As Byte
For Each b In outData
sb.Append(b.ToString("X2"))
Next

Dim pdfTempPath As String = Server.MapPath("./TempFiles/" & sb.ToString &
".pdf")
Dim ios As IO.FileStream = IO.File.Create(pdfTempPath)
Dim pdfBytes() As Byte = GetRawImage(LoanID)
ios.Write(pdfBytes, 0, pdfBytes.Length)
ios.Close()
divPDF.Style("VISIBILITY") = "Visible"
ifPDF.Attributes("SRC") = "TempFiles/" & sb.ToString & ".pdf"
 
C

Cheryl

Hi John

I think I solved the mystery. I took a look at my Adobe Reader preferences,
and I saw that "Display in Browser" wasn't checked. I checked the checkbox,
and now my PDF displays in the iFrame!

Thanks for your help, John.

- Cheryl

Cheryl said:
Hi John,

Here's the code:

HTML:

<div id="divPDF" style="VISIBILITY: hidden" runat="server">
<!--Note that without a relative src attribute, iframe will cause a
nonsecure item warning!-->
<iframe id="ifPDF" src="test.htm" width="100%" style="HEIGHT:50em"
runat="server">[Your
browser does <em>not</em> support <code>iframe</code>, or has been
configured
not to display inline frames.] </iframe>
</div>
VB:

Dim inData() As Byte = System.Text.Encoding.ASCII.GetBytes("SMIflood-" &
Loanid)Dim outData() As Byte = New
System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(inData)
Dim sb As New System.Text.StringBuilder(32)
Dim b As Byte
For Each b In outData
sb.Append(b.ToString("X2"))
Next

Dim pdfTempPath As String = Server.MapPath("./TempFiles/" & sb.ToString &
".pdf")
Dim ios As IO.FileStream = IO.File.Create(pdfTempPath)
Dim pdfBytes() As Byte = GetRawImage(LoanID)
ios.Write(pdfBytes, 0, pdfBytes.Length)
ios.Close()
divPDF.Style("VISIBILITY") = "Visible"
ifPDF.Attributes("SRC") = "TempFiles/" & sb.ToString & ".pdf"



John Timney ( MVP ) said:
Technically an iframe is another window, only one that can be embedded into
a web page, hence your form can be at the top of the page with your PDF
displayed below it. Your iframe should be requesting the PDF (asp.net page)
and it should load in the iframe. Probably worth your while pasting a code
sample here.

--
Regards

John Timney
Microsoft MVP
 
J

John Timney \( MVP \)

glad you have cracked it : )

--
Regards

John Timney
Microsoft MVP

Cheryl said:
Hi John

I think I solved the mystery. I took a look at my Adobe Reader
preferences,
and I saw that "Display in Browser" wasn't checked. I checked the
checkbox,
and now my PDF displays in the iFrame!

Thanks for your help, John.

- Cheryl

Cheryl said:
Hi John,

Here's the code:

HTML:

<div id="divPDF" style="VISIBILITY: hidden" runat="server">
<!--Note that without a relative src attribute, iframe will cause a
nonsecure item warning!-->
<iframe id="ifPDF" src="test.htm" width="100%" style="HEIGHT:50em"
runat="server">[Your
browser does <em>not</em> support <code>iframe</code>, or has been
configured
not to display inline frames.] </iframe>
</div>
VB:

Dim inData() As Byte = System.Text.Encoding.ASCII.GetBytes("SMIflood-" &
Loanid)Dim outData() As Byte = New
System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(inData)
Dim sb As New System.Text.StringBuilder(32)
Dim b As Byte
For Each b In outData
sb.Append(b.ToString("X2"))
Next

Dim pdfTempPath As String = Server.MapPath("./TempFiles/" & sb.ToString &
".pdf")
Dim ios As IO.FileStream = IO.File.Create(pdfTempPath)
Dim pdfBytes() As Byte = GetRawImage(LoanID)
ios.Write(pdfBytes, 0, pdfBytes.Length)
ios.Close()
divPDF.Style("VISIBILITY") = "Visible"
ifPDF.Attributes("SRC") = "TempFiles/" & sb.ToString & ".pdf"



John Timney ( MVP ) said:
Technically an iframe is another window, only one that can be embedded into
a web page, hence your form can be at the top of the page with your PDF
displayed below it. Your iframe should be requesting the PDF (asp.net page)
and it should load in the iframe. Probably worth your while pasting a code
sample here.

--
Regards

John Timney
Microsoft MVP

Hi John,

Using an iFrame still opens the PDF in another window. What am I missing?

Thank you.

- Cheryl

Your only choice is to use an iframe to hold the PDF
--
Regards

John Timney
Microsoft MVP

I'd like to display a web form at the top of an ASP.NET page and a PDF
from
a SQL Server database directly below the web form.

Currently, I'm getting a PDF stored in the database and using
BinaryWrite
to display just the PDF.

I'm using ASP 1.1 and VB.NET.

- Cheryl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top