Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Storing pdf files

5 posts in General Discussion Last posting was on 2008-12-18 01:12:00.0Z
gchq Posted on 2008-12-16 00:56:39.0Z
Sender: 4295.4946f9e7.846930886@sybase.com
From: gchq
Newsgroups: ianywhere.public.general
Subject: Storing pdf files
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4946fcc7.42ce.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 15 Dec 2008 16:56:39 -0800
X-Trace: forums-1-dub 1229388999 10.22.241.41 (15 Dec 2008 16:56:39 -0800)
X-Original-Trace: 15 Dec 2008 16:56:39 -0800, 10.22.241.41
Lines: 74
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7258
Article PK: 5474

Hi

I have an issue retrieving pdf documents from the DB (both
v8 on Netware and v9 on Win32. It works fine on the
development machine but from a W2K .NET (Framework 2.0) web
server nothing is displayed and the iFrame (or seperate
window) it should display in is unresponsive. Any ideas on
where I should look?

Here is the aspx.vb page that is the 'document server'

=============================================================

Imports System.Data
Partial Class Document_Viewer
Inherits System.Web.UI.Page
Private strSQL As String
Private vData As DataConn
Protected Sub Page_Load(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Me.Load


Dim vID As String =
Request.QueryString("Document_ID")
If Not IsNumeric(vID) Then
Exit Sub
End If

strSQL = "SELECT Document_PDF FROM Documents WHERE
Document_ID = " & vID
vData = New DataConn
Dim vDocument As Byte()
Try
vDocument =
vData.ExecuteScalar(CommandType.Text, strSQL)
Catch ex As Exception
EmailError(ex.Message, "23")
Exit Sub
End Try
Response.ClearHeaders()
Response.AddHeader("content-disposition", "inline="
& vDocument.ToString())
Response.AddHeader("content-length",
vDocument.ToString())
Response.ContentType = ("application/pdf")
Response.BinaryWrite(vDocument)

End Sub

Private Sub EmailError(ByVal ErrorString As String,
ByVal CodeLine As String)
Dim vHostName As String =
System.Net.Dns.GetHostName()
Dim vUserIP As String =
System.Net.Dns.GetHostAddresses(vHostName).GetValue(0).ToString()
Dim ctx As HttpContext = HttpContext.Current
Dim vErrorString As String = "URL = " &
ctx.Request.Url.ToString() & vbCr & vbCr
vErrorString += "Message = " & ErrorString & vbCr &
vbCr
vErrorString += "User = " & User.Identity.Name
Dim vMailError As New MailError
vMailError.MailDeveloper(vUserIP, vErrorString,
CodeLine, "Document_Viewer")

End Sub
End Class

========================================================

I realize that this is not technically a Sybase issue and is
clearly something different on the server, but....

Thanks


David Fishburn Posted on 2008-12-17 15:54:50.0Z
Newsgroups: ianywhere.public.general
Subject: Re: Storing pdf files
From: David Fishburn <fishburn_spam_off@ianywhere.com>
References: <4946fcc7.42ce.1681692777@sybase.com>
Organization: iAnywhere Solutions
Message-ID: <Xns9B776F05F4421fishburnsybasecom@10.22.241.106>
User-Agent: Xnews/2005.10.18
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 17 Dec 2008 07:54:50 -0800
X-Trace: forums-1-dub 1229529290 10.22.241.152 (17 Dec 2008 07:54:50 -0800)
X-Original-Trace: 17 Dec 2008 07:54:50 -0800, vip152.sybase.com
Lines: 51
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7262
Article PK: 5480

gchq wrote in news:4946fcc7.42ce.1681692777@sybase.com
of ianywhere.public.general:

g> I have an issue retrieving pdf documents from the DB (both
g> v8 on Netware and v9 on Win32. It works fine on the
g> development machine but from a W2K .NET (Framework 2.0) web
g> server nothing is displayed and the iFrame (or seperate
g> window) it should display in is unresponsive. Any ideas on
g> where I should look?

Without looking at the code and going on the "it works on one machine"
and "not on the other" I would assume this might be a charset
conversion issue.

This might convert the BLOB ( I am assuming you have saved the PDF
into a LONG BINARY column ) into a different character set and
therefore bung it up.

Couple of things:

1. Show the size of the object retrieved from the database.
- If it is different on the two machines, good, it will help
explain thing.

2. If it is a charset thing, maybe have a look at the output from:
SELECT connection_property ( 'CharSet' )
on both machines.
--
David Fishburn
Certified ASA Developer Version 8
iAnywhere Solutions - Sybase
Professional Services
Please only post to the newsgroup
Please ALWAYS include version and MORE importantly BUILD number with
EACH post (dbeng11 -v).

EBFs and Maintenance Releases
http://downloads.sybase.com/

Developer Community / Whitepapers
http://www.ianywhere.com/developer

Case-Express - to report bugs
http://case-express.sybase.com

CodeXchange - Free samples
http://ianywhere.codexchange.sybase.com/servlets/ProjectDocumentList

Documentation
http://dcx.sybase.com/


gchq Posted on 2008-12-17 16:38:29.0Z
Sender: 756a.494928e7.1804289383@sybase.com
From: gchq
Newsgroups: ianywhere.public.general
Subject: Re: Storing pdf files
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <49492b05.75b5.1681692777@sybase.com>
References: <Xns9B776F05F4421fishburnsybasecom@10.22.241.106>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 17 Dec 2008 08:38:29 -0800
X-Trace: forums-1-dub 1229531909 10.22.241.41 (17 Dec 2008 08:38:29 -0800)
X-Original-Trace: 17 Dec 2008 08:38:29 -0800, 10.22.241.41
Lines: 70
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7266
Article PK: 5483


> gchq wrote in news:4946fcc7.42ce.1681692777@sybase.com
> of ianywhere.public.general:
>
> g> I have an issue retrieving pdf documents from the DB
> (both g> v8 on Netware and v9 on Win32. It works fine on
> the g> development machine but from a W2K .NET (Framework
> 2.0) web g> server nothing is displayed and the iFrame (or
> seperate g> window) it should display in is unresponsive.
> Any ideas on g> where I should look?
>
> Without looking at the code and going on the "it works on
> one machine" and "not on the other" I would assume this
> might be a charset conversion issue.
>
> This might convert the BLOB ( I am assuming you have saved
> the PDF into a LONG BINARY column ) into a different
> character set and therefore bung it up.
>
> Couple of things:
>
> 1. Show the size of the object retrieved from the
> database.
> - If it is different on the two machines, good, it
> will help
> explain thing.
>
> 2. If it is a charset thing, maybe have a look at the
> output from:
> SELECT connection_property ( 'CharSet' )
> on both machines.

David

Thanks for your reply:-

"Show the size of the object retrieved from the database."
Not really sure how you achieve this

Yes - PDF is saved as a long binary! Char set for
development machine is cp1252 - will check the server a bit
later

Thanks for your response

> --
> David Fishburn
> Certified ASA Developer Version 8
> iAnywhere Solutions - Sybase
> Professional Services
> Please only post to the newsgroup
> Please ALWAYS include version and MORE importantly BUILD
> number with EACH post (dbeng11 -v).
>
> EBFs and Maintenance Releases
> http://downloads.sybase.com/
>
> Developer Community / Whitepapers
> http://www.ianywhere.com/developer
>
> Case-Express - to report bugs
> http://case-express.sybase.com
>
> CodeXchange - Free samples
>
http://ianywhere.codexchange.sybase.com/servlets/ProjectDocumentList
>
> Documentation
> http://dcx.sybase.com/
>


gchq Posted on 2008-12-18 00:30:09.0Z
Sender: 160.49498f16.1804289383@sybase.com
From: gchq
Newsgroups: ianywhere.public.general
Subject: Re: Storing pdf files
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <49499991.218.1681692777@sybase.com>
References: <Xns9B776F05F4421fishburnsybasecom@10.22.241.106>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 17 Dec 2008 16:30:09 -0800
X-Trace: forums-1-dub 1229560209 10.22.241.41 (17 Dec 2008 16:30:09 -0800)
X-Original-Trace: 17 Dec 2008 16:30:09 -0800, 10.22.241.41
Lines: 65
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7272
Article PK: 5489


> gchq wrote in news:4946fcc7.42ce.1681692777@sybase.com
> of ianywhere.public.general:
>
> g> I have an issue retrieving pdf documents from the DB
> (both g> v8 on Netware and v9 on Win32. It works fine on
> the g> development machine but from a W2K .NET (Framework
> 2.0) web g> server nothing is displayed and the iFrame (or
> seperate g> window) it should display in is unresponsive.
> Any ideas on g> where I should look?
>
> Without looking at the code and going on the "it works on
> one machine" and "not on the other" I would assume this
> might be a charset conversion issue.
>
> This might convert the BLOB ( I am assuming you have saved
> the PDF into a LONG BINARY column ) into a different
> character set and therefore bung it up.
>
> Couple of things:
>
> 1. Show the size of the object retrieved from the
> database.
> - If it is different on the two machines, good, it
> will help
> explain thing.
>
> 2. If it is a charset thing, maybe have a look at the
> output from:
> SELECT connection_property ( 'CharSet' )
> on both machines.
> --

ok - have run that query from both boxes, and it's returning
cp1252 from both of them. I have narrowed it down a bit
though - I built a testbed and from the .NET development
server in VS it runs fine - but even on the local machine as
soon as the project is published to IIS the same problem -
so the issue must be some setting within IIS - I've googled
this until my face turned a very fetching colour of blue -
but no joy! Big sigh!

> David Fishburn
> Certified ASA Developer Version 8
> iAnywhere Solutions - Sybase
> Professional Services
> Please only post to the newsgroup
> Please ALWAYS include version and MORE importantly BUILD
> number with EACH post (dbeng11 -v).
>
> EBFs and Maintenance Releases
> http://downloads.sybase.com/
>
> Developer Community / Whitepapers
> http://www.ianywhere.com/developer
>
> Case-Express - to report bugs
> http://case-express.sybase.com
>
> CodeXchange - Free samples
>
http://ianywhere.codexchange.sybase.com/servlets/ProjectDocumentList
>
> Documentation
> http://dcx.sybase.com/
>


gchq Posted on 2008-12-18 01:12:00.0Z
Sender: 160.49498f16.1804289383@sybase.com
From: gchq
Newsgroups: ianywhere.public.general
Subject: Re: Storing pdf files
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4949a360.303.1681692777@sybase.com>
References: <49499991.218.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 17 Dec 2008 17:12:00 -0800
X-Trace: forums-1-dub 1229562720 10.22.241.41 (17 Dec 2008 17:12:00 -0800)
X-Original-Trace: 17 Dec 2008 17:12:00 -0800, 10.22.241.41
Lines: 80
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7273
Article PK: 5491


> > gchq wrote in news:4946fcc7.42ce.1681692777@sybase.com
> > of ianywhere.public.general:
> >
> > g> I have an issue retrieving pdf documents from the DB
> > (both g> v8 on Netware and v9 on Win32. It works fine on
> > the g> development machine but from a W2K .NET
> > (Framework 2.0) web g> server nothing is displayed and
> > the iFrame (or seperate g> window) it should display in
> > is unresponsive. Any ideas on g> where I should look?
> >
> > Without looking at the code and going on the "it works
> > on one machine" and "not on the other" I would assume
> > this might be a charset conversion issue.
> >
> > This might convert the BLOB ( I am assuming you have
> > saved the PDF into a LONG BINARY column ) into a
> > different character set and therefore bung it up.
> >
> > Couple of things:
> >
> > 1. Show the size of the object retrieved from the
> > database.
> > - If it is different on the two machines, good,
> > it will help
> > explain thing.
> >
> > 2. If it is a charset thing, maybe have a look at the
> > output from:
> > SELECT connection_property ( 'CharSet' )
> > on both machines.
> > --
>
> ok - have run that query from both boxes, and it's
> returning cp1252 from both of them. I have narrowed it
> down a bit though - I built a testbed and from the .NET
> development server in VS it runs fine - but even on the
> local machine as soon as the project is published to IIS
> the same problem - so the issue must be some setting
> within IIS - I've googled this until my face turned a very
> fetching colour of blue - but no joy! Big sigh!

OK I think I ahve sussed it - this gave me a clue

http://it.toolbox.com/blogs/paytonbyrd/successfully-stream-a-pdf-through-https-1554

By deleting content length and replacing it with

Response.AddHeader("Accept-Header",
vDocument.Length.ToString())

Seems to have done the trick!

Happy Christmas to you all

>
> > David Fishburn
> > Certified ASA Developer Version 8
> > iAnywhere Solutions - Sybase
> > Professional Services
> > Please only post to the newsgroup
> > Please ALWAYS include version and MORE importantly BUILD
> > number with EACH post (dbeng11 -v).
> >
> > EBFs and Maintenance Releases
> > http://downloads.sybase.com/
> >
> > Developer Community / Whitepapers
> > http://www.ianywhere.com/developer
> >
> > Case-Express - to report bugs
> > http://case-express.sybase.com
> >
> > CodeXchange - Free samples
> >
>
http://ianywhere.codexchange.sybase.com/servlets/ProjectDocumentList
> >
> > Documentation
> > http://dcx.sybase.com/
> >