List of usage examples for com.itextpdf.layout Document Document
public Document(PdfDocument pdfDoc)
From source file:controller.PasesDeCortesiaController.java
public void exportPDF() throws RemoteException, NotBoundException, FileNotFoundException, IOException { Registry reg = LocateRegistry.getRegistry(host, 27019); oasiscrud.oasisrimbd inter = (oasiscrud.oasisrimbd) reg.lookup("OasisSev"); FileChooser file = new FileChooser(); file.getExtensionFilters().add(new FileChooser.ExtensionFilter("Documento PDF", " *.pdf")); File f = file.showSaveDialog(null); PdfWriter writer = new PdfWriter(f.getAbsolutePath()); PdfDocument pdf = new PdfDocument(writer); pdf.setDefaultPageSize(PageSize.LETTER); Document document = new Document(pdf); com.itextpdf.layout.element.Image img = new com.itextpdf.layout.element.Image( ImageDataFactory.create(getClass().getResource("/images/pdf-logo.png"))); img.setHorizontalAlignment(HorizontalAlignment.CENTER); document.add(img);/*from w w w . j a v a2s . c o m*/ generaTitulo(document, "Lista de Pases de Cortesia"); document.add(new Paragraph("\n")); Table t = generaCabezera(Arrays.asList("Nombre", "Cedula", "Telefono", "Codigo", "Invitados", "Fecha")); document.add(t); for (int i = 0; i < tabla.getItems().size(); i++) { generaPaseCortesia(document, tabla.getItems().get(i)); white *= -1; } document.close(); }
From source file:controller.ReporteDiarioController.java
public void generaPDF(ActionEvent evt) throws FileNotFoundException, MalformedURLException, IOException, RemoteException, NotBoundException { Registry reg = LocateRegistry.getRegistry(host, 27019); oasiscrud.oasisrimbd inter = (oasiscrud.oasisrimbd) reg.lookup("OasisSev"); FileChooser file = new FileChooser(); file.getExtensionFilters().add(new FileChooser.ExtensionFilter("Documento PDF", " *.PDF")); File f = file.showSaveDialog(null); PdfWriter writer = new PdfWriter(f.getAbsolutePath()); PdfDocument pdf = new PdfDocument(writer); pdf.setDefaultPageSize(PageSize.LETTER.rotate()); Document document = new Document(pdf); Cell c;/*from w w w .ja va 2 s . c o m*/ Table tc; Paragraph p = new Paragraph(); Image img = new Image(ImageDataFactory.create(getClass().getResource("/images/pdf-logo.png"))); img.setHorizontalAlignment(HorizontalAlignment.CENTER); document.add(img); document.add(new Paragraph("\n")); tc = new Table(1); tc.addCell(generaCabezera("Reporte del dia " + date.getValue().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault()) + " " + date.getValue().format(DateTimeFormatter.ISO_LOCAL_DATE))); document.add(tc); generaTitulo(document, "Detalles de asistencias General"); generaTablaAsistencia(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de Aperturas de mesas"); generaTablaAperturaMesas(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de Pases generados"); generaTablaPases(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de Autorizaciones"); generaTablaAutorizaciones(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de accesos al sistema"); generaTablaAcceso(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de busquedas en el sistema"); generaTablaBusqueda(document); document.close(); System.out.println(f.getAbsolutePath()); close(evt); }
From source file:controller.ReporteFechaController.java
public void generaPDF(ActionEvent evt) throws FileNotFoundException, MalformedURLException, IOException, RemoteException, NotBoundException { Registry reg = LocateRegistry.getRegistry(host, 27019); oasiscrud.oasisrimbd inter = (oasiscrud.oasisrimbd) reg.lookup("OasisSev"); FileChooser file = new FileChooser(); file.getExtensionFilters().add(new FileChooser.ExtensionFilter("Documento PDF", " *.PDF")); File f = file.showSaveDialog(null); PdfWriter writer = new PdfWriter(f.getAbsolutePath()); PdfDocument pdf = new PdfDocument(writer); pdf.setDefaultPageSize(PageSize.LETTER.rotate()); Document document = new Document(pdf); Cell c;//from ww w.java 2 s .c om Table tc; Paragraph p = new Paragraph(); Image img = new Image(ImageDataFactory.create(getClass().getResource("/images/pdf-logo.png"))); img.setHorizontalAlignment(HorizontalAlignment.CENTER); document.add(img); document.add(new Paragraph("\n")); tc = new Table(1); tc.addCell(generaCabezera("Reporte desde el dia " + from.getValue().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault()) + " " + from.getValue().format(DateTimeFormatter.ISO_LOCAL_DATE) + " hasta el dia " + to.getValue().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault()) + " " + to.getValue().format(DateTimeFormatter.ISO_LOCAL_DATE))); document.add(tc); generaTitulo(document, "Detalles de asistencias General"); generaTablaAsistencia(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de Aperturas de mesas"); generaTablaAperturaMesas(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de Pases generados"); generaTablaPases(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de Autorizaciones"); generaTablaAutorizaciones(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de accesos al sistema"); generaTablaAcceso(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de busquedas en el sistema"); generaTablaBusqueda(document); document.close(); System.out.println(f.getAbsolutePath()); close(evt); }
From source file:controller.ReporteMesController.java
public void generaPDF(ActionEvent evt) throws FileNotFoundException, MalformedURLException, IOException, RemoteException, NotBoundException { Registry reg = LocateRegistry.getRegistry(host, 27019); oasiscrud.oasisrimbd inter = (oasiscrud.oasisrimbd) reg.lookup("OasisSev"); FileChooser file = new FileChooser(); file.getExtensionFilters().add(new FileChooser.ExtensionFilter("Documento PDF", " *.PDF")); File f = file.showSaveDialog(null); PdfWriter writer = new PdfWriter(f.getAbsolutePath()); PdfDocument pdf = new PdfDocument(writer); pdf.setDefaultPageSize(PageSize.LETTER.rotate()); Document document = new Document(pdf); Cell c;/*from w ww . jav a2s . c o m*/ Table tc; Paragraph p = new Paragraph(); Image img = new Image(ImageDataFactory.create(getClass().getResource("/images/pdf-logo.png"))); img.setHorizontalAlignment(HorizontalAlignment.CENTER); document.add(img); document.add(new Paragraph("\n")); tc = new Table(1); tc.addCell(generaCabezera("Reporte del mes " + cbmes.getSelectionModel().getSelectedItem() + " del ao " + cbano.getSelectionModel().getSelectedItem())); document.add(tc); generaTitulo(document, "Detalles de asistencias General"); generaTablaAsistencia(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de Aperturas de mesas"); generaTablaAperturaMesas(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de Pases generados"); generaTablaPases(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de Autorizaciones"); generaTablaAutorizaciones(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de accesos al sistema"); generaTablaAcceso(document); pdf.addNewPage(); document.add(new AreaBreak()); generaTitulo(document, "Detalles de busquedas en el sistema"); generaTablaBusqueda(document); document.close(); System.out.println(f.getAbsolutePath()); close(evt); }
From source file:controller.ReservaController.java
public void exportPDF() throws RemoteException, NotBoundException, FileNotFoundException, IOException { Registry reg = LocateRegistry.getRegistry(host, 27019); oasiscrud.oasisrimbd inter = (oasiscrud.oasisrimbd) reg.lookup("OasisSev"); FileChooser file = new FileChooser(); file.getExtensionFilters().add(new FileChooser.ExtensionFilter("Documento PDF", " *.pdf")); File f = file.showSaveDialog(null); PdfWriter writer = new PdfWriter(f.getAbsolutePath()); PdfDocument pdf = new PdfDocument(writer); pdf.setDefaultPageSize(PageSize.LETTER); Document document = new Document(pdf); com.itextpdf.layout.element.Image img = new com.itextpdf.layout.element.Image( ImageDataFactory.create(getClass().getResource("/images/pdf-logo.png"))); img.setHorizontalAlignment(HorizontalAlignment.CENTER); document.add(img);//from w w w.j av a2s. c o m generaTitulo(document, "Lista de reservaciones"); document.add(new Paragraph("\n")); Table t = generaCabezera( Arrays.asList("Titular", "Cedula", "Telefono", "Plan", "Invitados", "Fecha", "Observaciones")); document.add(t); for (int i = 0; i < table.getItems().size(); i++) { generaReservas(document, (Reserva) table.getItems().get(i)); white *= -1; } document.close(); }
From source file:controller.VisitasController.java
public void generaPDF(ActionEvent evt) throws FileNotFoundException, MalformedURLException, IOException, RemoteException, NotBoundException { Registry reg = LocateRegistry.getRegistry(host, 27019); oasiscrud.oasisrimbd inter = (oasiscrud.oasisrimbd) reg.lookup("OasisSev"); FileChooser file = new FileChooser(); file.getExtensionFilters().add(new FileChooser.ExtensionFilter("Documento PDF", " *.PDF")); File f = file.showSaveDialog(null); PdfWriter writer = new PdfWriter(f.getAbsolutePath()); PdfDocument pdf = new PdfDocument(writer); pdf.setDefaultPageSize(PageSize.LETTER.rotate()); Document document = new Document(pdf); com.itextpdf.layout.element.Cell c;/* www . j a v a 2s . c o m*/ Table tc; Paragraph p = new Paragraph(); Image img = new Image(ImageDataFactory.create(getClass().getResource("/images/pdf-logo.png"))); img.setHorizontalAlignment(com.itextpdf.layout.property.HorizontalAlignment.CENTER); document.add(img); document.add(new Paragraph("\n")); generaTitulo(document, "Detalles de asistencias General"); generaTablaAsistencia(document); pdf.addNewPage(); document.add(new AreaBreak()); document.close(); System.out.println(f.getAbsolutePath()); }
From source file:dbchubreast_web.controller.download.DownloadFichesPatientsPdf.java
License:Open Source License
/** ====================================================================================== */ private void generatePdf(HttpServletResponse response, List<String> listIdPatients) throws IOException { String fileName = fileService.generateFileName("PROBREAST_fiches_patients", "pdf"); response.setHeader("Content-disposition", "attachment; filename=" + fileName); response.setContentType("application/pdf"); PdfWriter writer = new PdfWriter(response.getOutputStream()); PdfDocument pdfDoc = new PdfDocument(writer); Document document = new Document(pdfDoc); pdfService.createHeaderFooter(pdfDoc, document); pdfService.createPdf(listIdPatients, document, null, "confidentielle"); document.close();/* w ww .jav a 2 s. c o m*/ response.flushBuffer(); }
From source file:dbchubreast_web.controller.PdfController.java
License:Open Source License
/** ====================================================================================== */ @RequestMapping(value = "/pdf/patient/{idPatient}", method = RequestMethod.GET) public void downloadPdf(Model model, @PathVariable String idPatient, HttpServletRequest request, HttpServletResponse response) throws IOException { String fileName = "fiche_patient_" + idPatient + ".pdf"; response.setHeader("Content-disposition", "attachment; filename=" + fileName); response.setContentType("application/pdf"); PdfWriter writer = new PdfWriter(response.getOutputStream()); PdfDocument pdfDoc = new PdfDocument(writer); Document document = new Document(pdfDoc); pdfService.createHeaderFooter(pdfDoc, document); List<String> listIdPatients = new ArrayList<String>(); listIdPatients.add(idPatient);/* w w w . j av a2 s. c om*/ List<ChuPatient> listPatients = patientService.findAsList(idPatient); consistencyService.clearMessages(); consistencyService.checkConsistency(listPatients); pdfService.createPdf(listIdPatients, document, consistencyService.getMapMessages(), "confidentielle"); // pdfService.createPdf(listIdPatients, document, "publique"); document.close(); response.flushBuffer(); }
From source file:org.zafritech.zidingorms.io.pdf.TableHeader.java
public void TableHeaderEventHandler(Document doc) { this.doc = doc; this.table = new Table(1); table.setWidth(523);//w ww. jav a 2s . c o m table.addCell("Header Roow 1"); table.addCell("Header Roow 2"); table.addCell("Header Roow 3"); TableRenderer renderer = (TableRenderer) table.createRendererSubTree(); renderer.setParent(new Document(new PdfDocument(new PdfWriter(new ByteArrayOutputStream()))).getRenderer()); this.tableHeight = renderer.layout(new LayoutContext(new LayoutArea(0, PageSize.A4))).getOccupiedArea() .getBBox().getHeight(); }
From source file:output.InvoicePDF.java
/** * * @param dest//from ww w . j a va 2 s .c o m * @throws IOException */ public void generatePDF(String dest) throws FileNotFoundException, MalformedURLException, IOException { PdfWriter writer = new PdfWriter(dest); PdfDocument pdf = new PdfDocument(writer); Document document = new Document(pdf); Image image = new Image(ImageDataFactory.create(LOGO)); image.setWidthPercent(50); image.setHorizontalAlignment(HorizontalAlignment.CENTER); document.add(image); document.add(clientInformation()); document.add(quoteSection()); document.add(new Paragraph(terms())); document.close(); }