Foros del Web » Programando para Internet » Javascript »

quitar margenes al imprimir

Estas en el tema de quitar margenes al imprimir en el foro de Javascript en Foros del Web. Buenas Tardes, necesito ayuda, tengo un aplicativo que me imprime unas etiquetas, la idea es que en una hoja quepan 8 etiquetas, me alcanzan a ...
  #1 (permalink)  
Antiguo 17/07/2012, 15:46
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
quitar margenes al imprimir

Buenas Tardes, necesito ayuda, tengo un aplicativo que me imprime unas etiquetas, la idea es que en una hoja quepan 8 etiquetas, me alcanzan a caber solo 6 pero si se le quitan las margenes caben perfectamente las 8, pero no se como hacer, no se si este tema va en este foro. este es mi codigo



Código PHP:
Ver original
  1. <DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
  4.  
  5. <!-- Se llama el archivo  jquery.min.js -->
  6. <script type="text/javascript" src="js/jquery.min.js"></script>
  7.  
  8. <head>
  9.  
  10. <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
  11.  
  12. <title>ETIQUETA DE CUARENTENA</title>
  13.  
  14. <!-- Se llama el archivo  js/Ajax.js este archivo contiene las funciones de validaciones. -->
  15. <script language="JavaScript" type="text/javascript" src="Ajax.js"></script>
  16.  
  17. <!-- Se llama el archivo  js/Ajax.js este archivo contiene las funciones de validaciones -->
  18. <script language="JavaScript" type="text/javascript" src="js/funciones.js"></script>
  19.  
  20. <style media="print" type="text/css">
  21. #imprimir {
  22. visibility:hidden
  23. }
  24. #cambiar{
  25. visibility:hidden
  26. }
  27. </style>
  28.  
  29. <script>
  30. /*Imprime el formulario Previa.php y luego lo cierra*/
  31. function imprSelec()
  32. {
  33. window.print();
  34. window.close('Previa.php');
  35. window.open('Cuarentena.php');
  36. }
  37. </script>
  38.  
  39. </head>
  40.  
  41. <link href="csss.css" rel="stylesheet" type="text/css" media="print"/>
  42.  
  43. <script language="JavaScript" src="js/jquery-1.5.1.min.js"></script>
  44.  
  45. <script language="JavaScript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
  46.  
  47. <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.13.custom.css" rel="stylesheet"/>
  48.  
  49. <body>
  50.  
  51. <?php
  52.  
  53. for ($i=1; $i<=$Total ; $i++){
  54.  
  55. if($i % 2 == 0) {
  56.  
  57. echo '<div style="float:right;width:48%;margin-left:20px;height:100px">';
  58.  
  59. } else {
  60.  
  61. echo '<div style="clear:both;float:left;width:48%;margin-left:5px;height:100px">';
  62.  
  63. }
  64.  
  65. ?>
  66.  
  67. <!-- pdfCuarentena2.php -->
  68. <form id="form1" name="form1" method="POST" action="modificar.php?Lotes=<?php echo $Lote; ?>">
  69.  
  70.   <table width="100%" >
  71.         <tr>
  72.           <th height="47" scope="col"><center><H2><font face="Arial, Helvetica, sans-serif">
  73.               <img src="Cuarentena.png" />&nbsp;&nbsp;&nbsp;&nbsp;CUARENTENA</font></H2></center>
  74.           </th>
  75.         </tr>
  76.   </table>
  77.  
  78.   <table width="100%">
  79.       <tr>
  80.         <th colspan="2">Material: <input name="Producto" type="text" size="35" value="<?php echo $Producto ?>  "/></th>
  81.       </tr>
  82.  
  83.       <tr>
  84.         <th colspan="2">Lote: <input name="Nolote" type="text" size="6" value="<?php echo $Lote ?>"/>   Proveedor: <input name="proveedor" type="text" size="15" value="<?php echo $Proveedor ?>"/></th>
  85.       </tr>
  86.  
  87.       <tr>
  88.         <th colspan="2">Cliente: <input name="Cliente" type="text" size="37" value="<?php echo $Cliente ?> "/></th>
  89.       </tr>
  90.  
  91.       <tr>
  92.         <th colspan="2">No.Recip: <input name="Recipiente" type="text" size="1"  value="  <?php echo $i ?>"/> de <input name="de" type="text" size="1" value="  <?php echo $Total ?>"/> /Und.Emp: <input name="empaque" type="text" size="5" value=" <?php echo $Empaque ?>"/></th>
  93.       </tr>
  94.  
  95.       <tr>
  96.         <th colspan="2">Vencimiento: <input size="4" id="fc_1333032142" type="text" READONLY name="fecha" title="YYMMDD" onClick="displayCalendar(this);" value="<?php echo $Fecha ?>"> Cant.Total:  <input name="total" type="text" size="7" value="<?php echo $De ?>"/></th>
  97.       </tr>
  98.  
  99.       <tr>
  100.         <th colspan="2">Responsable: <input name="responsable" type="text" size="13" value="<?php echo $Responsable ?>"/> Fecha: <input name="fecha1" id="fc_1331842667" type="text" READONLY  title="YYMMDD" onClick="displayCalendar(this);" size="4" value="<?php echo $Fecha1 ?>"/></th>
  101.       </tr>
  102.  
  103.       <tr>
  104.         <th height="26" colspan="2">Observaciones: <input name="observaciones" type="text" size="27" value="   <?php echo $Observaciones ?>"/></th>
  105.       </tr>
  106.   </table>
  107.  
  108. </form>
  109.  
  110. </div>    
  111.  
  112. <form id="form1" name="form1" method="POST" action="modificar.php?Lotes=<?php echo $Lote; ?>">
  113.  
  114. <?php
  115.  
  116. }
  117.  
  118. ?>
  119.  
  120. <div id="noprint">
  121.  
  122. <input type="button" name="imprimir" id="imprimir" value="IMPRIMIR"  onClick="javascript:imprSelec();" />  <a href="modificar.php?Lotes=<?php echo $Lote; ?>" id="cambiar" name="cambiar">.:::Cambiar Datos:::.</a>
  123.  
  124. <!--<input type="submit" name="imprimir" id="imprimir" value="IMPRIMIR" />-->
  125.  
  126. </div>
  127.  
  128. </form>
  129.  
  130. </body>
  131.  
  132. </html>

este es el que me imprime, gracias por toda la ayuda que me puedan brindar
  #2 (permalink)  
Antiguo 17/07/2012, 17:59
Avatar de emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: quitar margenes al imprimir

Podés compactar lo más posible el contenido de la página usando
<link rel="stylesheet" type="text/css" href="imprimir.css" media="print" />
Es decir,crears un imprimir.css y ahi definis que estilos deben aplicarse a los elementos al imprimir, quitar márgenes, paddings, bordes, redimensionar medidas, etc, pero los márgenes de la página en si, dependerán de las opciones que aplique el cliente en "configurar página", desde su navegador

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.
  #3 (permalink)  
Antiguo 19/07/2012, 07:06
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: quitar margenes al imprimir

Hola listo si me quita espacio pero no todo, aun me deja el espacio como de un centimetro

Etiquetas: ajax, formulario, funcion, html, input, js, margenes, php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:09.