Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Open decoded base64 pdf in browser

518 views
Skip to first unread message

Mangler

unread,
Jan 11, 2010, 4:34:14 PM1/11/10
to
I am using the USPS Electronic Return Merchandise API to print labels
on the web and am at the last point to get this to work, obviously Im
stuck now.

The response from the USPS server is an encoded base64 string that you
need to decode before being able to use things, I was able to decode
it no problems. Used a component from XStandard to do so.

I am unsure what to do from here to get the decoded string to open the
pdf file in the browser.

I have been able to get a csv file in the past to open like I want the
pdf but it is not working, the decoded string shows on the page and
not an actual pdf file.

Here is my code :

<%
Dim objBase64, strImage
Const otSafeArray = 0
Const otString = 2
strImage = "ENCODED_STRING"
Set objBase64 = Server.CreateObject("XStandard.Base64")
Response.ContentType = "application/pdf"
Response.AddHeader "content-disposition", "attachment;
filename=test.pdf"
Response.BinaryWrite objBase64.Decode(strImage, otSafeArray)
Set objBase64 = Nothing
%>


what am I doing wrong?

Evertjan.

unread,
Jan 11, 2010, 5:00:48 PM1/11/10
to

Will this help?

<http://geekswithblogs.net/Lance/archive/2007/07/18/Shipping-APIs-
FedEx.aspx>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Mangler

unread,
Jan 11, 2010, 5:09:31 PM1/11/10
to
> (Please change the x'es to dots in my emailaddress)- Hide quoted text -
>
> - Show quoted text -

I have seen that but it did not help much.

Bob Barrows

unread,
Jan 11, 2010, 5:27:18 PM1/11/10
to

I'm not entirely sure, but I believe you need a component from Adobe to
generate a pdf that can be streamed to a client.

--
HTH,
Bob Barrows


Evertjan.

unread,
Jan 12, 2010, 7:04:53 AM1/12/10
to
Bob Barrows wrote on 11 jan 2010 in
microsoft.public.inetserver.asp.general:

> I'm not entirely sure, but I believe you need a component from Adobe to


> generate a pdf that can be streamed to a client.

or Persits AspPdf:

<http://www.asppdf.com/>

rob^_^

unread,
Jan 16, 2010, 5:36:48 PM1/16/10
to
Your sample code has syntax errors.

Regards.

"Mangler" <webm...@repairresource.com> wrote in message
news:ece1c7a7-3ded-4121...@o28g2000yqh.googlegroups.com...

Bwig Zomberi

unread,
Jan 20, 2010, 9:01:29 AM1/20/10
to
rob^_^ wrote:
> Your sample code has syntax errors.

Probably...

>
> Regards.
>
> "Mangler" <webm...@repairresource.com> wrote in message
> news:ece1c7a7-3ded-4121...@o28g2000yqh.googlegroups.com...

>> I have been able to get a csv file in the past to open like I want the
>> pdf but it is not working, the decoded string shows on the page and
>> not an actual pdf file.
>>
>> Here is my code :
>>
>> <%
>> Dim objBase64, strImage
>> Const otSafeArray = 0
>> Const otString = 2
>> strImage = "ENCODED_STRING"
>> Set objBase64 = Server.CreateObject("XStandard.Base64")
>> Response.ContentType = "application/pdf"
>> Response.AddHeader "content-disposition", "attachment;
>> filename=test.pdf"
>> Response.BinaryWrite objBase64.Decode(strImage, otSafeArray)
>> Set objBase64 = Nothing
>> %>
>>
>>
>> what am I doing wrong?
>

Try clearing and buffering the response stream.

Response.Clear
Response.BufferOutput = true
Response.ContentType = "application/pdf"

--
Bwig Zomberi

Bwig Zomberi

unread,
Jan 20, 2010, 9:03:52 AM1/20/10
to
Bwig Zomberi wrote:
> Try clearing and buffering the response stream.
>
> Response.Clear
> Response.BufferOutput = true
> Response.ContentType = "application/pdf"
>

I copied it from ASP.net. Hence the correction:

Response.Buffer = True

0 new messages