Advertisement
JRFWEB

PDF View - Sample - Example

Oct 25th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.22 KB | None | 0 0
  1. <?php
  2. /*
  3. Alterar em seu php.ini
  4. ; Maximum allowed size for uploaded files.
  5. ; http://php.net/upload-max-filesize
  6. upload_max_filesize = 10M
  7. */
  8.  
  9.     $dataPDF = filter_input_array(INPUT_POST, FILTER_DEFAULT);
  10.         if(isset($dataPDF) && $dataPDF['enviar']){
  11.             unset($dataPDF['enviar']);
  12.             if($_FILES['pdffile']['error'] == 0){
  13.                 $uploaddir = __DIR__.DIRECTORY_SEPARATOR.'foto'.DIRECTORY_SEPARATOR.'os.pdf';
  14.                 if(move_uploaded_file($_FILES['pdffile']['tmp_name'], $uploaddir)){
  15.                     //Enviado
  16.                 }else{
  17.                     header('Location: index.php');
  18.                 };
  19.             }else{
  20.                 header('Location: index.php');
  21.             };
  22.            
  23.         ?>
  24.     <!DOCTYPE html>
  25.     <html>
  26.     <head>
  27.         <meta charset="utf-8">
  28.         <meta http-equiv="X-UA-Compatible" content="IE=edge">
  29.         <title>Exibindo - Ordem De Servi&ccecil;o</title>
  30.         <style>
  31.             body {
  32.                 text-align: center;
  33.                 margin: 0;
  34.                 font-size: 30pt;
  35.                 width: 1240px;
  36.                 height: 1700px;
  37.                 overflow: none;
  38.                 display: block;
  39.             }
  40.             #header {
  41.                 width: 100%;
  42.                 height: 7%;
  43.                 padding: 3%;
  44.                 display: block;
  45.                 margin: 0 auto;
  46.             }
  47.             #imagem {
  48.                 width: 100%;
  49.                 height: 70%;
  50.                 padding: 3%;
  51.                 display: block;
  52.             }
  53.             object{
  54.                 width:100%;
  55.                 height:100%;
  56.             }
  57.             #rodape {
  58.                 width: 100%;
  59.                 height: 10%;
  60.                 padding: 3%;
  61.                 display: block;
  62.                 margin: 0 auto;
  63.             }
  64.         </style>
  65.     </head>
  66.     <body>
  67.     <div id="header">
  68.         <?php echo $dataPDF["material"]; ?><br />
  69.         Pe&ccedil;a <?php echo $dataPDF["tamanho"]; ?>mm<br />
  70.         <?php echo $dataPDF["op"]; ?><br />
  71.         <?php echo $dataPDF["quantfolha"]; ?> X <?php echo $dataPDF["tamfolha"]; ?> mm<br />
  72.     </div>
  73.     <div id="imagem">
  74.     <object data="foto/os.pdf" type="application/pdf" heigth="100%">
  75.         <a href="foto/os.pdf">PDF</a>
  76.     </object>
  77.     </div>
  78.     <div id="rodape">
  79.     <?php echo $dataPDF["unifolha"]; ?> Unidades por P&aacute;gina<br />
  80.     Total <?php echo $dataPDF["unifolha"] * $dataPDF["quantfolha"]; ?><br />
  81.     </div>
  82.     <div><a href="index.php">Voltar</a></div>
  83.     </body>
  84.     </html>
  85.     <?php }else{ ?>
  86. <!DOCTYPE html>
  87. <html>
  88. <head>
  89.     <meta charset="utf-8">
  90.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  91.     <title>Ordem De Servi&ccedil;o</title>
  92.     <style type="text/css" media="screen">
  93.         form{width:500px; margin:10px auto;}
  94.         label, input{display:block;width:90%;padding:5px;}
  95.         label{margin-top:10px;}
  96.         #enviar{width:auto; padding:10px;margin-top:10px;}
  97.     </style>
  98. </head>
  99. <body>
  100.     <form action="" method="post" enctype="multipart/form-data" name="file-form">
  101.         <label for="material">Material:</label>
  102.         <input type="text" name="material" id="material" />
  103.         <label for="tamanho">Tamanho:</label>
  104.         <input type="text" name="tamanho" id="tamanho" />
  105.         <label for="op">R, 2R, E, D:</label>
  106.         <input type="text" name="op" id="op" />
  107.         <label for="quantfolha">Quantas Folhas:</label>
  108.         <input type="text" name="quantfolha" />
  109.         <label for="tamfolha">Tamanho da folha:</label>
  110.         <input type="text" name="tamfolha" />
  111.         <label for="arquivo">Arquivo:</label>
  112.         <input type="file" name="pdffile" id="arquivo" />
  113.         <label for="unifolha">Quantas unidades por folha:</label>
  114.         <input type="text" name="unifolha" id="unifolha" />
  115.         <input type="submit" name="enviar" id="enviar" value="Enviar" />
  116.     </form>
  117. </body>
  118. </html>
  119. <?php }; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement