Prev: How to send email with no outlook and SMTP server ?
Next: Help Sending eMail To receiving@internal.mycompany.com
From: Bwig Zomberi on 3 Jun 2010 01:54 Dan wrote: > > "Bwig Zomberi" <zomberiMAPSONNOSPAM(a)gmail.com> wrote in message > news:hu5ein$4qs$1(a)speranza.aioe.org... >> Dean g wrote: >>> Damn, 2 out of 3 problems solved is still good. >>> >>> Thanks for the help guys, i just wish i knew why half the pdf >>> files display garbage on the screen even though they are >>> genuine pdf's. i guess thats a question for another group >>> though. >>> >> >> I had this problem with Opera. In a newer version, it got solved. >> >> Just ensure that you set the content type properly on the server-side >> and you are not writing anything other than what is in the PDF to the >> browser. To be sure that the entire ASP code is between one set of <% >> and %>. Do not use nested code. Do not write any HTML or set any cookies. >> >> On the client side, ensure that Adobe Reader is installed properly and >> plugins are available for all browsers. >> >> If the problems persist, then it is problem with the PDFs. You could >> go to alt.txt.pdf. However, you will need to host the PDF and provide >> a link so they can check it out. >> >> > > The other thing you can do is use Response.Buffer = true, and then prior > to sending the headers clear the buffer first just in case there are any > CR/LF characters from inline ASP above that piece of code. Or just make > sure you always put inline ASP code fully inline, eg. > > <% > blah blah > %> > <% > more blah > write headers > write binary data > %> > > > will actually put a single CR/LF combination before the data, because > there is a CRLF outside of the ASP tags. The same can be written as > > > <% > blah blah > %><% > more blah > write headers > write binary data > %> > > and not insert the CR/LF. > > It's also worth checking this wherever you send out a DOCTYPE headers in > normal HTML, if the DOCTYPE isn't on the first line of the output then > some browsers will ignore it. > I think that if you use two sets of <% and %>, it adds a new line character, which will totally wreck the PDF. It should be like <% clear buffer content type header binary write flush %> No spaces before or after the delimiters. -- Bwig Zomberi
From: Evertjan. on 3 Jun 2010 03:59 Bwig Zomberi wrote on 03 jun 2010 in microsoft.public.inetserver.asp.general: > I think that if you use two sets of <% and %>, it adds a new line > character, which will totally wreck the PDF. It should be like > > <% > clear > buffer > content type > header > binary write > flush > %> > > No spaces before or after the delimiters. Use: Response.Clear .... Response.end For years now [last correction date of the inc file 21/5/2005] I have succesfully used this: function streamPdf(strFileName) Response.Clear strFilePath=server.mappath(strFilename) Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = 1 objStream.LoadFromFile strFilePath Response.ContentType = "application/pdf" Response.BinaryWrite objStream.Read objStream.Close Set objStream = Nothing Response.end end function -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
From: Dan on 3 Jun 2010 05:06 "Bwig Zomberi" <zomberiMAPSONNOSPAM(a)gmail.com> wrote in message news:hu7fv9$tov$1(a)speranza.aioe.org... > Dan wrote: >> >> "Bwig Zomberi" <zomberiMAPSONNOSPAM(a)gmail.com> wrote in message >> news:hu5ein$4qs$1(a)speranza.aioe.org... >>> Dean g wrote: >>>> Damn, 2 out of 3 problems solved is still good. >>>> >>>> Thanks for the help guys, i just wish i knew why half the pdf >>>> files display garbage on the screen even though they are >>>> genuine pdf's. i guess thats a question for another group >>>> though. >>>> >>> >>> I had this problem with Opera. In a newer version, it got solved. >>> >>> Just ensure that you set the content type properly on the server-side >>> and you are not writing anything other than what is in the PDF to the >>> browser. To be sure that the entire ASP code is between one set of <% >>> and %>. Do not use nested code. Do not write any HTML or set any >>> cookies. >>> >>> On the client side, ensure that Adobe Reader is installed properly and >>> plugins are available for all browsers. >>> >>> If the problems persist, then it is problem with the PDFs. You could >>> go to alt.txt.pdf. However, you will need to host the PDF and provide >>> a link so they can check it out. >>> >>> >> >> The other thing you can do is use Response.Buffer = true, and then prior >> to sending the headers clear the buffer first just in case there are any >> CR/LF characters from inline ASP above that piece of code. Or just make >> sure you always put inline ASP code fully inline, eg. >> >> <% >> blah blah >> %> >> <% >> more blah >> write headers >> write binary data >> %> >> >> >> will actually put a single CR/LF combination before the data, because >> there is a CRLF outside of the ASP tags. The same can be written as >> >> >> <% >> blah blah >> %><% >> more blah >> write headers >> write binary data >> %> >> >> and not insert the CR/LF. >> >> It's also worth checking this wherever you send out a DOCTYPE headers in >> normal HTML, if the DOCTYPE isn't on the first line of the output then >> some browsers will ignore it. >> > > > I think that if you use two sets of <% and %>, it adds a new line > character, which will totally wreck the PDF. It should be like Nope, only if you put a new line between the tags. Feel free to try it out - I've already done so on IIS6 and there is no implied newline at tag ends/starts. <% blah blah %><% blah blah %> does not add a newline. I often use includes too, so for instance will do things like <% blah blah %><!-- #include file="file.asp" --><% blah blah output binary data %> and again there will be no newlines before the binary data. -- Dan
From: Bwig Zomberi on 3 Jun 2010 06:50 Dan wrote: > Nope, only if you put a new line between the tags. Feel free to try it > out - I've already done so on IIS6 and there is no implied newline at > tag ends/starts. > > <% > blah > blah > %><% > blah blah > %> > > does not add a newline. Your code does not add a new line. I usually put separate the <% %> pairs for readability of the code. That adds a new line. The OP may be doing the same in his code. He may not immediately see that you have neatly avoided that pitfall by keeping it together;-) I have faced a similar problem with writing RSS feeds using ASP. The first line of XML files should start with <?xml .... or something. My regular code convention would break that. -- Bwig Zomberi
From: Dan on 3 Jun 2010 08:53
"Bwig Zomberi" <zomberiMAPSONNOSPAM(a)gmail.com> wrote in message news:hu81aq$mss$1(a)speranza.aioe.org... > Dan wrote: >> Nope, only if you put a new line between the tags. Feel free to try it >> out - I've already done so on IIS6 and there is no implied newline at >> tag ends/starts. >> >> <% >> blah >> blah >> %><% >> blah blah >> %> >> >> does not add a newline. > > > Your code does not add a new line. I usually put separate the <% %> pairs > for readability of the code. That adds a new line. The OP may be doing the > same in his code. He may not immediately see that you have neatly avoided > that pitfall by keeping it together;-) I thought I'd made it clear enough in my earlier reply, and that you were stating I was wrong, hence the above followup. If you look at my 2 examples you can see the difference, and that was my point. > I have faced a similar problem with writing RSS feeds using ASP. The first > line of XML files should start with <?xml .... or something. My regular > code convention would break that. Ah, yes, RSS, that's another place I learnt to not put newlines outside of code blocks ... :) -- Dan |