src/main/java/com/cellulant/services/PdfReportGenerationService.java
public void generatePdfFile(String dest) throws FileNotFoundException {
        //mileages = new MileageService().retrieveMockMileageData();  // From Mocked Data

        mileages = mileageService.findAll();   // From Database

        PdfDocument pdfDoc = new PdfDocument(new PdfWriter(dest));
        Document doc = new Document(pdfDoc);
        Throwable localThrowable3 = null;
        try {
            table.addCell((Cell) ((Cell) new Cell(1, 1).add("LengthId").setBold()).setFontSize(8.0F));
            table.addCell((Cell) ((Cell) new Cell(1, 1).add("Miles").setBold()).setFontSize(8.0F));
            table.addCell((Cell) ((Cell) new Cell(1, 1).add("Kilometers").setBold()).setFontSize(8.0F));
            table.addCell((Cell) ((Cell) new Cell(1, 1).add("DateModified").setBold()).setFontSize(8.0F));

            for (Mileage mileage : mileages) {
                if (mileage.getLength_id() == null) {
                    table.addCell("");
                } else {
                    table.addCell(new PdfUtil().getCell(String.valueOf(mileage.getLength_id()), TextAlignment.CENTER));
                }

                if (mileage.getMiles() == null) {
                    table.addCell("");
                } else {
                    table.addCell(new PdfUtil().getCell(String.valueOf(mileage.getMiles()), TextAlignment.CENTER));
                }
                if (mileage.getKilometers() == null) {
                    table.addCell("");
                } else {
                    table.addCell(new PdfUtil().getCell(String.valueOf(mileage.getKilometers()), TextAlignment.CENTER));
                }

                if (mileage.getDate_modified() == null) {
                    table.addCell("");
                } else {
                    table.addCell(new PdfUtil().getCell(String.valueOf(mileage.getDate_modified()), TextAlignment.CENTER));
                }
            }

            doc.add(table);
        } catch (Throwable localThrowable5) {
            localThrowable3 = localThrowable5;
            throw localThrowable5;

        } finally {

            if (doc != null) {
                if (localThrowable3 != null) {
                    try {
                        doc.close();
                    } catch (Throwable localThrowable2) {
                        localThrowable3.addSuppressed(localThrowable2);
                    }
                } else {
                    doc.close();
                }
            }
        }
    }
/**
     * This method generated Pdf File with data found in the database
     * @param dest
     * @throws FileNotFoundException 
     */
This method generated Pdf File with data found in the database
@param dest
@throws FileNotFoundException
This method generated Pdf File with data found in the database @param dest @throws FileNotFoundException
public void generatePdfFile(String dest) throws FileNotFoundException {
        mileages = mileageService.findAll();   
        PdfDocument pdfDoc = new PdfDocument(new PdfWriter(dest));
        Document doc = new Document(pdfDoc);
        Throwable localThrowable3 = null;
        try {
            table.addCell((Cell) ((Cell) new Cell(1, 1).add("LengthId").setBold()).setFontSize(8.0F));
            table.addCell((Cell) ((Cell) new Cell(1, 1).add("Miles").setBold()).setFontSize(8.0F));
            table.addCell((Cell) ((Cell) new Cell(1, 1).add("Kilometers").setBold()).setFontSize(8.0F));
            table.addCell((Cell) ((Cell) new Cell(1, 1).add("DateModified").setBold()).setFontSize(8.0F));
            for (Mileage mileage : mileages) {
                if (mileage.getLength_id() == null) {
                    table.addCell("");
                } else {
                    table.addCell(new PdfUtil().getCell(String.valueOf(mileage.getLength_id()), TextAlignment.CENTER));
                }
                if (mileage.getMiles() == null) {
                    table.addCell("");
                } else {
                    table.addCell(new PdfUtil().getCell(String.valueOf(mileage.getMiles()), TextAlignment.CENTER));
                }
                if (mileage.getKilometers() == null) {
                    table.addCell("");
                } else {
                    table.addCell(new PdfUtil().getCell(String.valueOf(mileage.getKilometers()), TextAlignment.CENTER));
                }
                if (mileage.getDate_modified() == null) {
                    table.addCell("");
                } else {
                    table.addCell(new PdfUtil().getCell(String.valueOf(mileage.getDate_modified()), TextAlignment.CENTER));
                }
            }
            doc.add(table);
        } catch (Throwable localThrowable5) {
            localThrowable3 = localThrowable5;
            throw localThrowable5;
        } finally {
            if (doc != null) {
                if (localThrowable3 != null) {
                    try {
                        doc.close();
                    } catch (Throwable localThrowable2) {
                        localThrowable3.addSuppressed(localThrowable2);
                    }
                } else {
                    doc.close();
                }
            }
        }
    }
public void generatePdfFile ( String dest ) throws FileNotFoundException { mileages = mileageService . findAll ( ) ; PdfDocument pdfDoc = new PdfDocument ( new PdfWriter ( dest ) ) ; Document doc = new Document ( pdfDoc ) ; Throwable localThrowable3 = null ; try { table . addCell ( ( Cell ) ( ( Cell ) new Cell ( 1 , 1 ) . add ( "LengthId" ) . setBold ( ) ) . setFontSize ( 8.0F ) ) ; table . addCell ( ( Cell ) ( ( Cell ) new Cell ( 1 , 1 ) . add ( "Miles" ) . setBold ( ) ) . setFontSize ( 8.0F ) ) ; table . addCell ( ( Cell ) ( ( Cell ) new Cell ( 1 , 1 ) . add ( "Kilometers" ) . setBold ( ) ) . setFontSize ( 8.0F ) ) ; table . addCell ( ( Cell ) ( ( Cell ) new Cell ( 1 , 1 ) . add ( "DateModified" ) . setBold ( ) ) . setFontSize ( 8.0F ) ) ; for ( Mileage mileage : mileages ) { if ( mileage . getLength_id ( ) == null ) { table . addCell ( "" ) ; } else { table . addCell ( new PdfUtil ( ) . getCell ( String . valueOf ( mileage . getLength_id ( ) ) , TextAlignment . CENTER ) ) ; } if ( mileage . getMiles ( ) == null ) { table . addCell ( "" ) ; } else { table . addCell ( new PdfUtil ( ) . getCell ( String . valueOf ( mileage . getMiles ( ) ) , TextAlignment . CENTER ) ) ; } if ( mileage . getKilometers ( ) == null ) { table . addCell ( "" ) ; } else { table . addCell ( new PdfUtil ( ) . getCell ( String . valueOf ( mileage . getKilometers ( ) ) , TextAlignment . CENTER ) ) ; } if ( mileage . getDate_modified ( ) == null ) { table . addCell ( "" ) ; } else { table . addCell ( new PdfUtil ( ) . getCell ( String . valueOf ( mileage . getDate_modified ( ) ) , TextAlignment . CENTER ) ) ; } } doc . add ( table ) ; } catch ( Throwable localThrowable5 ) { localThrowable3 = localThrowable5 ; throw localThrowable5 ; } finally { if ( doc != null ) { if ( localThrowable3 != null ) { try { doc . close ( ) ; } catch ( Throwable localThrowable2 ) { localThrowable3 . addSuppressed ( localThrowable2 ) ; } } else { doc . close ( ) ; } } } }
This method generated Pdf File with data found in the database
 @param dest
 @throws FileNotFoundException
This method generated Pdf File with data found in the database @param dest @throws FileNotFoundException
//mileages = new MileageService().retrieveMockMileageData();  // From Mocked Data // From Database