Ask a Question related to ASP Database, Design and Development.
-
Marcel LeBlanc #1
I need to display a PDF from SQL Binary Field
I am trying to display a PDF from SQL. All I am getting
is garbage that looks like this:
%PDF-1.3 %âãÏÓ 37 0 obj << /Linearized 1 /O 39 /H [ 1000
378 ] /L 168312 /E 75831 /N 4 /T 167454 >> endobj xref 37
28 0000000016 00000 n 0000000907 00000 n 000000
My code is as follows, please help:
<%@ LANGUAGE="VBSCRIPT" %>
<% Set connAdvancial=Server.CreateObjec
("ADODB.connection") %>
<% Set cmdDV=Server.CreateObject("ADODB.Command") %>
<% cmdDV.ActiveConnection = connAdvancial %>
<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<% cmdDV.CommandText = "sp_get_pdf" %>
<% cmdDV.CommandType = 4 %>
<% cmdDV.Parameters.Refresh %>
<% cmdDV("@id") = "1" %>
<% set rsGetPdf = cmdDV.Execute %>
<% IF rsGetPdf.EOF AND rsGetPdf.BOF THEN %>
<% ELSE %>
<% Response.Expires = 0 %>
<% Response.Buffer = TRUE %>
<% Response.Clear %>
<% Response.ContentType
= "application/pdf" %>
<% datasize = rsGetPdf.Fields
("image").ActualSize %>
<% Response.BinaryWrite rsGetPdf.Fields
("image").GetChunk(datasize) %>
<% Response.End %>
<% END IF %>
<% rsGetPdf.close: Set rsGetPdf = Nothing %>
</BODY>
</HTML>
Marcel LeBlanc Guest
-
Display Image Binary data in Web Browser
I'm returning the binary data from my webservice and it works but I'm having problems rendering the image in an <img> tag in my web browser. The... -
Inserting binary field into SQL 2000 database
Hi, I have been trying to upload a .pdf file to a SQL Server 2000 database. I used the dreamweaver MX auto generated code. However, I have the... -
Display BInary TIF file from database?
Is there a way to pull a TIFF binary field from a database and display it in a cold fusion page? I have it working part time with an ASP page and a... -
Display SQL rows by certain field?
I have a SQL database that contains the fields "author," "title," and "category." I want to create a web page that sorts the entries by... -
How to get binary file from SQL field?
I want to display binary data from SQL server 2000 in an asp page. The data comes from a Windows Sharepoint Services document library. The raw... -
Boris Nikolaevich #2
Re: I need to display a PDF from SQL Binary Field
First, ditch the HTML tags. They are a big part of what's confusing the
browser.
"Marcel LeBlanc" <mleblanc@eulogix.com> wrote in message
news:06f001c38a0b$6e2ef3b0$a301280a@phx.gbl...
I am trying to display a PDF from SQL. All I am getting
is garbage that looks like this:
%PDF-1.3 %âãÏÓ 37 0 obj << /Linearized 1 /O 39 /H [ 1000
378 ] /L 168312 /E 75831 /N 4 /T 167454 >> endobj xref 37
28 0000000016 00000 n 0000000907 00000 n 000000
My code is as follows, please help:
<%@ LANGUAGE="VBSCRIPT" %>
<% Set connAdvancial=Server.CreateObjec
("ADODB.connection") %>
<% Set cmdDV=Server.CreateObject("ADODB.Command") %>
<% cmdDV.ActiveConnection = connAdvancial %>
<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<% cmdDV.CommandText = "sp_get_pdf" %>
<% cmdDV.CommandType = 4 %>
<% cmdDV.Parameters.Refresh %>
<% cmdDV("@id") = "1" %>
<% set rsGetPdf = cmdDV.Execute %>
<% IF rsGetPdf.EOF AND rsGetPdf.BOF THEN %>
<% ELSE %>
<% Response.Expires = 0 %>
<% Response.Buffer = TRUE %>
<% Response.Clear %>
<% Response.ContentType
= "application/pdf" %>
<% datasize = rsGetPdf.Fields
("image").ActualSize %>
<% Response.BinaryWrite rsGetPdf.Fields
("image").GetChunk(datasize) %>
<% Response.End %>
<% END IF %>
<% rsGetPdf.close: Set rsGetPdf = Nothing %>
</BODY>
</HTML>
Boris Nikolaevich Guest
-
Hannibal #3
Re: I need to display a PDF from SQL Binary Field
I agree.
Streaming binary data from the db has nothing to do with html... or an html
page for that matter, you have to remember that you are outputting a PDF
document, not an html file containing a pdf document(would be kewl though)
"Boris Nikolaevich" <boris@nikolaevich.com> wrote in message
news:O0YA5gkiDHA.2824@tk2msftngp13.phx.gbl...> First, ditch the HTML tags. They are a big part of what's confusing the
> browser.
>
>
> "Marcel LeBlanc" <mleblanc@eulogix.com> wrote in message
> news:06f001c38a0b$6e2ef3b0$a301280a@phx.gbl...
> I am trying to display a PDF from SQL. All I am getting
> is garbage that looks like this:
> %PDF-1.3 %âãÏÓ 37 0 obj << /Linearized 1 /O 39 /H [ 1000
> 378 ] /L 168312 /E 75831 /N 4 /T 167454 >> endobj xref 37
> 28 0000000016 00000 n 0000000907 00000 n 000000
>
> My code is as follows, please help:
> <%@ LANGUAGE="VBSCRIPT" %>
> <% Set connAdvancial=Server.CreateObjec
> ("ADODB.connection") %>
> <% Set cmdDV=Server.CreateObject("ADODB.Command") %>
> <% cmdDV.ActiveConnection = connAdvancial %>
> <HTML>
> <HEAD>
> <TITLE>Document Title</TITLE>
> </HEAD>
> <BODY>
>
> <% cmdDV.CommandText = "sp_get_pdf" %>
> <% cmdDV.CommandType = 4 %>
> <% cmdDV.Parameters.Refresh %>
> <% cmdDV("@id") = "1" %>
> <% set rsGetPdf = cmdDV.Execute %>
> <% IF rsGetPdf.EOF AND rsGetPdf.BOF THEN %>
> <% ELSE %>
> <% Response.Expires = 0 %>
> <% Response.Buffer = TRUE %>
> <% Response.Clear %>
> <% Response.ContentType
> = "application/pdf" %>
> <% datasize = rsGetPdf.Fields
> ("image").ActualSize %>
> <% Response.BinaryWrite rsGetPdf.Fields
> ("image").GetChunk(datasize) %>
> <% Response.End %>
> <% END IF %>
> <% rsGetPdf.close: Set rsGetPdf = Nothing %>
> </BODY>
> </HTML>
>
>
Hannibal Guest



Reply With Quote

