如何使PDF文件在網頁上正確顯示?
CryRep_AL_Balance tt= new CryRep_AL_Balance();tt.SetDataSource(custDS);
tt.SummaryInfo.ReportTitle="Year 2007"+ls_ShortHostName+" Annual Leave Balance Report";
CrystalDecisions.Shared.ExportOptions EO = new CrystalDecisions.Shared.ExportOptions();
CrystalDecisions.Shared.DiskFileDestinationOptions FD = new CrystalDecisions.Shared.DiskFileDestinationOptions();
//創建唯一臨時文件
string myReport ="c:\\mypdf.pdf";
//輸出到磁盤
FD.DiskFileName = myReport;
EO = tt.ExportOptions;
EO.DestinationOptions = FD;
EO.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
EO.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
tt.Export();
//讀磁盤上PDF文件并輸出到IE
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.WriteFile(myReport);
Response.Flush();
Response.Close();
custDS (dataset)有數據,直到tt.Export()還正常識,且輸出到磁盤的pdf文件可以用adobe reader打開(內容正確),
就是 讀磁盤上PDF并輸出到IE 部分不行(運行時頁面沒有打開pdf文件并顯示).
為什麼會這樣,是不是要配置哪里?少了那個引用?還是 //輸出到IE 這部分不應該這樣寫?
那應改怎樣寫? --------------------编程问答-------------------- 請問有什麼方法解決這個問題? --------------------编程问答-------------------- 上面 //讀磁盤上PDF文件并輸出到IE 是否正確? --------------------编程问答-------------------- Response.ClearContent();
Response.ClearHeaders();
Response.ContentType="application/pdf";
Response.WriteFile(df.DiskFileName);
Response.Flush();
Response.Close(); --------------------编程问答-------------------- pdf在线阅读控件 www.ycanpdf.cn qq543664698
补充:.NET技术 , ASP.NET