Tema: Pdf Con Asp
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 24/11/2004, 13:48
Avatar de Fabu_dina
Fabu_dina
 
Fecha de Ingreso: enero-2004
Mensajes: 425
Antigüedad: 20 años, 3 meses
Puntos: 1
Codigo

Codigo que llama a la funcion FDPF


pdf.CreatePDF();
pdf.SetPath("fpdf/");
pdf.Open();
pdf.AddPage();
pdf.SetFont('Times','B',10);
pdf.Cell(20);
for(i=1;i<=40;i++)
{
pdf.Cell(0,4,'Printing line number '+i,14,100,2,3);
pdf.Cell(1);
}
pdf.Output();



Codigo FPDF


this.Output=function Output(xfile , xdownload , Overwrite)
{
if (arguments.length<3) {
Overwrite=true;
if (arguments.length<2) {
xdownload=true;
if (arguments.length<1){xfile=""};
}
}
;
if(this.state<3)this.Close();
if(xfile==""){
if(xdownload){
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-disposition", "attachment; filename=" + xfile);
}
else
{
Response.ContentType = "application/pdf"
Response.AddHeader("Content-Disposition","inline");
}
if (!this.hasBinary){
Response.Write(this.buffer)}
else{
xfile=Server.MapPath(lib.fso.GetTempName())
// xfile="contrato.asp"
xf=lib.fopen(xfile,"wb");
if(xf.number)this.Error("Unable to create output file: " + xfile);
lib.fwrite(xf,this.buffer);
lib.fclose(xf);
outB = Server.CreateObject("ADODB.Stream")
outB.Type = 1
outB.Open()
outB.LoadFromFile (xfile)
Response.BinaryWrite(outB.Read())
outB.Close()
lib.fso.DeleteFile(xfile);
}
}
else

{
xf=lib.fopen(xfile,"wb");
if(xf.number)this.Error("Unable to create output file: " + xfile);
lib.fwrite(xf,this.buffer);
lib.fclose(xf);
}
}