/** * *Convierte a PDF el documento especificado, junto a su JSON de impresion del documento base. * * @param id_documento int ID del documento a imprimir. **/ public static function Imprimir($id_documento) { $documento = DocumentoDAO::getByPK($id_documento); $values = DocumentoDAO::getDocumentWithValues($id_documento); $pagina = new stdClass(); $pagina->elementos = array(); foreach ($values as $key => $value) { $elemento = new stdClass(); $elemento->tipo = 'marco'; $elemento->titulo = $value['caption']; $elemento->texto = $value['val']; $elemento->altura = 80; array_push($pagina->elementos, $elemento); } $impresion = new stdClass(); $impresion->paginas = array($pagina); $pdf = new JSON2PDF($impresion); }
<?php define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; if (isset($_GET["preview"]) && isset($_GET["d"])) { ImpresionesController::Documento($_GET["d"], true); exit; } $documento = DocumentoDAO::getByPK($_GET["d"]); $documentoBase = DocumentoBaseDAO::getByPK($documento->getIdDocumentoBase()); $values = DocumentoDAO::getDocumentWithValues($_GET["d"]); $page = new GerenciaTabPage(); $page->addComponent('<link rel="stylesheet" type="text/css" href="/pos/css/markdown.css" /> <script type="text/javascript" src="/pos/js/Markdown.Converter.js"></script> <script type="text/javascript" src="/pos/js/Markdown.Sanitizer.js"></script> <script type="text/javascript" src="/pos/js/Markdown.Editor.js"></script>'); $page->addComponent(new TitleComponent($documentoBase->getNombre(), 3)); $page->addComponent(new TitleComponent(R::NombreDocumentoFromId($_GET["d"]))); // // $page->addComponent( // "<div class='POS Boton' onClick='window.location=\"documentos.editar.php?d=". $_GET["d"] ."\"'>Editar</div> " ); // $page->addComponent( "<div class='POS Boton' onClick='window.location=\"documentos.ver.php?preview=1&d=". $_GET["d"] ."\"'>Vista previa</div> " ); // // /** * * **/ $page->nextTab("Doc"); $f = new FormComponent(); for ($i = 0; $i < sizeof($values); $i++) {