image
Inicio » Foros » PHP

Foro sobre PHP

IMPRESION con de un DOCUMENTO con PHP

Volver al foro | Responder | Añadir nuevo tema


De: M@rlen
Fecha: 20/01/2006
Mensaje:

Hola.. . Espero puedan ayudarme soy primerisa en esto de la programacion con PHP y nesesito imrimir un documento o archivo de texto desde PHP.

                                                       GRACIAS




Quizás le interese
De: Daniel Mendiola
Util para: 4 personas

Fecha: 20/01/2006
Mensaje:

Te paso un codigo de una clase que tengo para imprimir desde php.
Sacale el extends y todo lo de persistente... Espero que te sirva

///-----> llamada imprimir
<?php
class Imprimir extends Persistente
{
//atributos
var $impresora;
var $linea;
// var $handle;
var $font;
var $letra;
var $tamaño;
var $alto;
var $ancho;


/*//pasos,
setear impresora
setear letras
seterar font
imprimir
eli_font
end_page
end_close

*/
function Imprimir(){parent::Persistente();}
function constructor()
{

}
function setImpresora($impre)
{
$this->impresora=$impre;
}
function setLinea($valor)
{
$this->linea=$valor;
}
function setFont($valor)
{
$this->letra=$valor;
}
function setAlto($unval)
{
$this->alto = $unval;
}
function setAncho($unval)
{
$this->ancho=$unval;
}
function setTamaño($unval)
{
$this->tamaño=$unval;
}
function setSetearImp()
{
$handle = printer_open($this->impresora);//"EPSON Stylus C43 Series");
printer_start_doc($handle, "Mi Documento");
printer_start_page($handle);
return $handle;
}
function setNewDocumento($handle)
{
printer_start_doc($handle, "Mi Documento");
}
function setStarNewpage($handle)
{
printer_start_page($handle);
}
function setearFont($handle)
{
$font = printer_create_font($letra,$alto,$ancho,$tamaño,false,false,false,0);//"Arial", 48, 48, 100, false, false, false,0);
printer_select_font($handle, $font);
return $font;
}
function setImprimir($x,$y,$handle)
{

printer_draw_text($handle, $this->linea, $x, $y);//texto a imprimir x,y
}
function eliFont($font)
{
printer_delete_font($font);
}
function fin_pagina($handle)
{
printer_end_page($handle);
}
function setNuevoDoc($handle)
{
printer_end_doc($handle);
}
function cerrar_imp($handle)
{
printer_close($handle);
}
}


?>


////--ejemplo de invocación

include("../Clases/imprimir.php");

$imprimir->setImpresora("Canon PIXMA iP1000"); //EPSON Stylus C43 Series
$handle = $imprimir->setSetearImp();
$imprimir->setFont("Arial");
$imprimir->setTamaño("8");
$font = $imprimir->setearFont($handle);


$linea = "1";
$imprimir->setLinea($linea);
$imprimir->setImprimir(400,$coord_Y,$handle); //x,y,handle
$coord_Y = $coord_Y+100;
$imprimir->setImprimir(400,$coord_Y,$handle);
$imprimir->eliFont($font);
$imprimir->fin_pagina($handle);
$imprimir->setNuevoDoc($handle);
$imprimir->cerrar_imp($handle);






De: victor
Util para: 1 personas

Fecha: 11/07/2007
Mensaje:

Si no me equivoco .. estos metodos solo funcionan en Windows. Llevo mas de tres meses tratando de buscar algo similar para linux



De: Felix Gonzales
Util para: 0 personas

Fecha: 25/07/2007
Mensaje:

hola.. dos preguntas
1- donde puedo conseguir la clase Persistente,
2- que necesito configurar en mi php5

att.

Felix Gonzales




De: Felix Gonzales
Util para: 1 personas

Fecha: 25/07/2007
Mensaje:

hola.. dos preguntas
1- donde puedo conseguir la clase Persistente,
2- que necesito configurar en mi php5

att.

Felix Gonzales



De: H435zJBjN3
Util para: 0 personas

Fecha: 03/10/2015
Mensaje:

I must have purchased 10 books on how to delevope a website from the ground up. Within the first 5 chapters, without fail, something integral to the entire website that they take for granted working, wouldn't work for me, and after a week or two of trying to fix the issue, I would normally give up. I repeated this process for about the past 6 months.Some background on me, I'm 28, I have a BS in computer science, but generally learned nothing in college, of business value anyway. I am lightly familiar with coding/designing, if given enough time I could read the code and tell you about what most things do in C++ or VB, (And their .net equivalents), but ask me to program something, and I wouldn't even know where to start. This is why I am heavily dependant on any programing examples in a book working This book is definitely more a designers guide to building a website, but by that, I mean it shows you how to create a website from the ground up, and every short cut possible where you can have Visual Web Developer (VWD) button, or option do the work of coding. This is like a god send for people like me, that want to learn coding, but not as badly as we want to learn how to create .NET websites. I didn't get stuck for more than a few minutes anywhere.There are no stories from the trenches that many books put in just to fill in space and bore you inbetween what you actually want to know. This book is VERY concisely written telling you what you need to know. This book does not go into great depth in any great part, it briefly touches on just about everything you could need to run your own website though and makes recommendations for either websites or books to purchase to get additional information.In conclusion, this book is great for beginners, and I would, and have recommended it to everyone I know who, similar to me, wants to create a professional looking website, that doesn't have the programing skills to make it happen. I'd imagine though, if you are above beginner level, this book would not be for you.



Volver al foro | Responder | Añadir nuevo tema

Quizás le interese:

WebEstilo.com no se hace responsable de las opiniones que los usuarios puedan verter en cualquiera de los foros existentes.

Si te solucionó el problema pulsa en G+1


Gracias!






Comparte



Última modificación:31 de Agosto de 2017. Spain - Espa�a.
© 1998-2004 por . Todos los derechos reservados.