From: rob^_^ on 16 Jan 2010 17:36 Your sample code has syntax errors. Regards. "Mangler" <webmaster(a)repairresource.com> wrote in message news:ece1c7a7-3ded-4121-95a6-5f7460467427(a)o28g2000yqh.googlegroups.com... > 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?
From: Bwig Zomberi on 20 Jan 2010 09:01 rob^_^ wrote: > Your sample code has syntax errors. Probably... > > Regards. > > "Mangler" <webmaster(a)repairresource.com> wrote in message > news:ece1c7a7-3ded-4121-95a6-5f7460467427(a)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
From: Bwig Zomberi on 20 Jan 2010 09:03
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 |