I have to send a check with printed information, I currently generate the check in a PDF with DomPdf, the paper size I configure with this library and the text positions I do with CSS / HTML, but I must configure each printer with a Custom paper size, how to make it independent of the printer, just click on print and the printer of your choice will recognize the size of the paper and the positions of the text.
As I currently do:
/**
** Funcion Imprimir Cheque
** @param id_cheque Identificador del cheque
** @return Void - Genera Pdf
**/
public function imprimirCheque($id){
$Cheque = Cheque::find($id_cheque);
// Traigo los datos de configuración del papel
$ConfigIC = ConfigImpresionCheque::find(1);
$p1 = $ConfigIC->paper_p1;
$p2 = $ConfigIC->paper_p2;
$p3 = $ConfigIC->paper_p3;
$p4 = $ConfigIC->paper_p4;
$orientation = $ConfigIC->orientation;
$dompdf = new Dompdf();
// Funcion Crear_banco_a Genera un HTML
// con la información del Cheque y
// posiciona los datos con CSS.
$html = $this->crear_banco_A(
$Cheque->numero_cheque,
$Cheque->fecha_giro,
$Cheque->valor_cheque,
$Cheque->beneficiario,
$Cheque->nit_beneficiario
);
$dompdf->loadHtml($html);
// Configuro DomPdf con los datos de configuración del papel
$chequePaper = array($p1, $p2, $p3, $p4);
$dompdf->setPaper($chequePaper, $orientation);
$dompdf->render();
$dompdf->stream("dompdf_out.pdf", array("Attachment" => false));
}