Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Open decoded base64 pdf in browser

Reply
Thread Tools

Open decoded base64 pdf in browser

 
 
Mangler
Guest
Posts: n/a
 
      01-11-2010
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?
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      01-11-2010
Mangler wrote on 11 jan 2010 in microsoft.public.inetserver.asp.general:

> 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?
>


Will this help?

<http://geekswithblogs.net/Lance/arch...Shipping-APIs-
FedEx.aspx>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
Mangler
Guest
Posts: n/a
 
      01-11-2010
On Jan 11, 5:00*pm, "Evertjan." <(E-Mail Removed)> wrote:
> Mangler wrote on 11 jan 2010 in microsoft.public.inetserver.asp.general:
>
>
>
>
>
> > 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?

>
> Will this help?
>
> <http://geekswithblogs.net/Lance/arch...Shipping-APIs-
> FedEx.aspx>
>
> --
> Evertjan.
> The Netherlands.
> (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.
 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      01-11-2010
Mangler wrote:
> 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?


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


 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      01-12-2010
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/>



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
rob^_^
Guest
Posts: n/a
 
      01-16-2010
Your sample code has syntax errors.

Regards.

"Mangler" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?


 
Reply With Quote
 
Bwig Zomberi
Guest
Posts: n/a
 
      01-20-2010
rob^_^ wrote:
> Your sample code has syntax errors.


Probably...

>
> Regards.
>
> "Mangler" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
 
Reply With Quote
 
Bwig Zomberi
Guest
Posts: n/a
 
      01-20-2010
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wxPython: Icon aus base64 decoded Image Roland Rickborn Python 1 12-11-2006 04:39 PM
URL encoded text automatically decoded? Ben Amada ASP .Net 4 10-04-2005 09:31 AM
Problem with SP2, Can't save the combined & decoded files. ClivePettibone Computer Support 2 09-10-2004 05:23 AM
Error decoded 8 bit characters. T Conti ASP .Net 1 04-11-2004 09:19 AM



Advertisments