|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
PDF cache problemfor me but I have run into a problem. I have a page to create my pdf from a dynamic asp page. Each time the script runs it overwrites the previous pdf file. I then use response.redirect to load the pdf file in the browser. The problem is that the browser always displays the previous pdf file until you click the refresh button. I've check to make sure that the new pdf file is always created on the server - it is ! So I assume this must be a problem with browser cache retaining the previous file. I tried all sorts of ways to solve this but to no avail. Any ideas would be much appreciated :) This is the relevant code : --------------------------------------------------------------------- <!-- CREATE VARIABLE TO HOLD THE URL --> string1 = "http://www.thecareersroom.com/wx/admin/employ_letter.asp? Rec_ID=" & Recordset1.Fields.Item("Rec_ID").Value <!-- CREATE AND SAVE THE PDF FILE --> Set Pdf = Server.CreateObject("Persits.Pdf") Set Doc = Pdf.CreateDocument Doc.ImportFromUrl string1, "LeftMargin=50", "RightMargin=10", "PageWidth=650" Filename = Doc.Save( Server.MapPath("employ_letter.pdf"), True ) <!-- -LOAD TO THE BROWSER -> Response.CacheControl = "private; no-store" response.ContentType = "application/pdf" response.Redirect(Filename) ------------------------------------------------------------------------- Regards wrote on 05 nov 2007 in microsoft.public.inetserver.asp.general:
> <!-- -LOAD TO THE BROWSER -> These two have no influence on the header of the redirect target file.> Response.CacheControl = "private; no-store" > response.ContentType = "application/pdf" > response.Redirect(Filename) You could send the pdf as a bitstream with the above headersfunction pdf(file) Response.Clear strFileName = file strFilePath = server.mappath(strFilename) Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = 1 objStream.LoadFromFile strFilePath Response.ContentType = "application/pdf" Response.CacheControl = "private; no-store" 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)
Show quote
Hide quote
On 5 Nov, 10:21, "Evertjan." <exjxw.hannivo***@interxnl.net> wrote: Many thanks Evertjan.> wrote on 05 nov 2007 in microsoft.public.inetserver.asp.general: > > > <!-- -LOAD TO THE BROWSER -> > > Response.CacheControl = "private; no-store" > > response.ContentType = "application/pdf" > > These two have no influence on the header of the redirect target file. > > > response.Redirect(Filename) > > You could send the pdf as a bitstream with the above headers > > function pdf(file) > Response.Clear > > strFileName = file > strFilePath = server.mappath(strFilename) > > Set objStream = Server.CreateObject("ADODB.Stream") > objStream.Open > > objStream.Type = 1 > objStream.LoadFromFile strFilePath > Response.ContentType = "application/pdf" > Response.CacheControl = "private; no-store" > 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) Your solution works perfectly !
Classic ASP Question
asp newbie question Temporary Use of Session Object How much is Application Data Need basic help authenticating remote wmi call from an asp webpage how to find quoteint in asp print page script - login problems BLOB to MS Word via ASP/VBScript PSEUDO WEB SERVICES CALLING OTHER SERVICES Getting the value of a disabled <select> control |
|||||||||||||||||||||||