Example usage for com.lowagie.text Document Document

List of usage examples for com.lowagie.text Document Document

Introduction

In this page you can find the example usage for com.lowagie.text Document Document.

Prototype


public Document(Rectangle pageSize, float marginLeft, float marginRight, float marginTop, float marginBottom) 

Source Link

Document

Constructs a new Document -object.

Usage

From source file:com.nokia.s60tools.swmtanalyser.wizards.ReportCreationJob.java

License:Open Source License

protected IStatus run(IProgressMonitor monitor) {

    monitor.beginTask("Creating report...", 10);

    try {//  w  w w  .ja va  2 s.  com
        //Instantiation of document object
        Document document = new Document(PageSize.A4, 50, 50, 50, 50);
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(this.fileName));
        document.open();

        addGeneralDetails(document);

        if (!this.isOverviewReport) //If the report type is 1. i.e., report for selected issues only.
        {
            addSelectedIssuesReport(document);
        } else // If the report type is 2. i.e., Overview report
        {
            addOverviewReport(document);
        }

        addComments(document);

        //Close document
        document.close();
        //Close the writer
        writer.close();

    } catch (DocumentException e) {
        e.printStackTrace();
        SwmtAnalyserPlugin.getConsole().println("Unable to write document, error was: '" + e + "'",
                IConsolePrintUtility.MSG_ERROR);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
        SwmtAnalyserPlugin.getConsole().println("Unable to write document, error was: '" + e + "'",
                IConsolePrintUtility.MSG_ERROR);
    } catch (Exception e) {
        e.printStackTrace();
        AbstractProductSpecificConsole absConsole = (AbstractProductSpecificConsole) SwmtAnalyserPlugin
                .getConsole();
        absConsole.printStackTrace(e);
        SwmtAnalyserPlugin.getConsole().println("Unable to write document, error was: '" + e + "'",
                IConsolePrintUtility.MSG_ERROR);
    }
    return Status.OK_STATUS;
}

From source file:com.openkm.util.PDFUtils.java

License:Open Source License

/**
 * Generate sample PDF//  w ww . java  2  s .c  o m
 */
public static void generateSample(int paragraphs, OutputStream os) throws DocumentException {
    LoremIpsum li = new LoremIpsum();
    Document doc = new Document(PageSize.A4, 25, 25, 25, 25);
    PdfWriter.getInstance(doc, os);
    doc.open();

    for (int i = 0; i < paragraphs; i++) {
        doc.add(new Paragraph(li.getParagraphs()));
    }

    doc.close();
}

From source file:com.prime.location.billing.InvoicedBillingManager.java

/**
 * Print invoice//from   w  w  w. ja  v  a2 s  .  c  o  m
 */
public void printInvoice() {
    try { //catch better your exceptions, this is just an example
        FacesContext context = FacesContext.getCurrentInstance();

        Document pdf = new Document(PageSize.A4, 5f, 5f, 75f, 45f);

        String fileName = "PDFFile";

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PdfWriter writer = PdfWriter.getInstance(pdf, baos);
        TableHeader event = new TableHeader();
        event.setHeader("Header Here");
        writer.setPageEvent(event);

        if (!pdf.isOpen()) {
            pdf.open();
        }

        PdfPCell cell;

        PdfPTable header = new PdfPTable(new float[] { 1, 2, 1 });
        cell = new PdfPCell(new Paragraph("INVOICE",
                FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLDITALIC, Color.BLACK)));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setColspan(3);
        cell.setBorder(Rectangle.NO_BORDER);
        header.addCell(cell);
        header.setTotalWidth(527);
        header.setLockedWidth(true);

        cell = new PdfPCell(new Phrase("Agency: " + selectedAgency.getDescription()));
        cell.setColspan(2);
        cell.setBorder(Rectangle.NO_BORDER);
        header.addCell(cell);

        cell = new PdfPCell(new Phrase("Invoice#: " + selectedInvoice.getId()));
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        header.addCell(cell);

        cell = new PdfPCell(
                new Phrase("Date: " + DateUtility.dateTimeFormat(selectedInvoice.getInvoiceDate())));
        cell.setColspan(3);
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        header.addCell(cell);

        pdf.add(header);

        PdfPTable table = new PdfPTable(new float[] { 1, 3, 2, 1 });
        table.setSpacingBefore(15f);

        table.setTotalWidth(527);
        table.setLockedWidth(true);
        //table.setWidths(new int[]{3, 1, 1});

        table.getDefaultCell().setBackgroundColor(Color.LIGHT_GRAY);

        table.addCell("Date");
        table.addCell("Name");
        table.addCell("Service");
        table.addCell("Rate");

        table.getDefaultCell().setBackgroundColor(null);

        cell = new PdfPCell(new Phrase("Total(US$): "));
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setColspan(3);
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase(new DecimalFormat("###,###.###").format(selectedInvoice.getAmount())));
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        table.addCell(cell);

        // There are three special rows
        table.setHeaderRows(2);
        // One of them is a footer
        table.setFooterRows(1);
        Font f = FontFactory.getFont(FontFactory.HELVETICA, 10);
        //add remaining
        for (AgencyBilling billing : selectedInvoice.getBillings()) {
            table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
            table.getDefaultCell().setIndent(2);
            table.getDefaultCell().setFixedHeight(20);

            table.addCell(new Phrase(DateUtility.dateFormat(billing.getBillingDate()), f));
            table.addCell(new Phrase(billing.getPerson().getName(), f));
            table.addCell(new Phrase(billing.getTariff().getTariffType().getDescription(), f));
            cell = new PdfPCell(new Phrase(new DecimalFormat("###,###.###").format(billing.getRate()), f));
            cell.setHorizontalAlignment(Element.ALIGN_RIGHT);

            table.addCell(cell);

        }

        pdf.add(table);

        writer.getAcroForm().setNeedAppearances(true);

        //document.add(new Phrase(TEXT));
        //Keep modifying your pdf file (add pages and more)
        pdf.close();

        writePDFToResponse(context.getExternalContext(), baos, fileName);

        context.responseComplete();

    } catch (Exception e) {
        //e.printStackTrace();          
    }
}

From source file:com.pureinfo.srm.patent.action.PatentPrintPdfAction.java

License:Open Source License

/**
 * @see com.pureinfo.ark.interaction.ActionBase#executeAction()
 *//*from   w  ww .j  a v a 2  s.  co  m*/
public ActionForward executeAction() throws PureException {
    int nYear = request.getRequiredInt("year", "");

    Rectangle rectPageSize = new Rectangle(PageSize.A4);
    rectPageSize.setBackgroundColor(Color.WHITE);
    rectPageSize.setBorderColor(Color.BLACK);
    rectPageSize = rectPageSize.rotate();
    Document doc = new Document(rectPageSize, 10, 10, 10, 10);
    doc.addTitle(nYear + "");
    doc.addAuthor("PureInfo");
    try {
        BaseFont bfontTitle = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        Font fontTitle = new Font(bfontTitle, 18, Font.NORMAL);
        Paragraph paraTitle = new Paragraph(nYear + "",
                fontTitle);
        paraTitle.setAlignment(ElementTags.ALIGN_CENTER);

        BaseFont bfontContent = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        Font fontContent = new Font(bfontContent, 10, Font.NORMAL);

        FileFactory fileFactory = FileFactory.getInstance();
        String sPath = fileFactory.lookupPathConfigByFlag(FileFactory.FLAG_DOWNLOADTEMP, true).getLocalPath();

        FileUtil.insurePathExists(sPath);
        PdfWriter.getInstance(doc, new FileOutputStream(new File(sPath, "patent.pdf")));

        doc.open();
        doc.add(paraTitle);
        doc.add(new Paragraph("   "));

        String[] arrTitles = new String[] { "", "", "", "", "", "",
                "", "", "" };
        PdfPTable pTable = new PdfPTable(arrTitles.length);
        pTable.setWidths(new int[] { 5, 10, 9, 9, 20, 15, 12, 10, 10 });

        for (int i = 0; i < arrTitles.length; i++) {
            PdfPCell pCell = new PdfPCell();
            Paragraph para = new Paragraph(arrTitles[i], fontContent);
            para.setAlignment(ElementTags.ALIGN_CENTER);

            pCell.addElement(para);
            pTable.addCell(pCell);
        }

        /**
         * 
         */
        IPatentMgr mgr = (IPatentMgr) ArkContentHelper.getContentMgrOf(Patent.class);
        List patents = mgr.findAllAuthorizedOf(nYear);
        int i = 0;
        for (Iterator iter = patents.iterator(); iter.hasNext(); i++) {
            Patent patent = (Patent) iter.next();
            this.addPatentCell(pTable, String.valueOf(i + 1), fontContent);
            this.addPatentCell(pTable, patent.getPatentSid(), fontContent);
            this.addPatentCell(pTable, ForceConstants.DATE_FORMAT.format(patent.getApplyDate()), fontContent);
            this.addPatentCell(pTable, patent.getWarrantDate() == null ? ""
                    : ForceConstants.DATE_FORMAT.format(patent.getWarrantDate()), fontContent);
            this.addPatentCell(pTable, patent.getName(), fontContent);
            this.addPatentCell(pTable, patent.getAllAuthosName(), fontContent);
            this.addPatentCell(pTable, patent.getRightPerson(), fontContent);
            this.addPatentCell(pTable, getCollegeName(patent), fontContent);
            this.addPatentCell(pTable, patent.getPatentTypeName(), fontContent);
        }

        doc.add(pTable);
        doc.close();

    } catch (DocumentException ex) {
        // TODO Auto-generated catch block
        ex.printStackTrace(System.err);
    } catch (IOException ex) {
        // TODO Auto-generated catch block
        ex.printStackTrace(System.err);
    }

    List list = new ArrayList();
    list.add(new Pair("/download/patent.pdf", ""));
    request.setAttribute("forward", list);
    return mapping.findForward("success");
}

From source file:com.servoy.extensions.plugins.pdf_output.PDFPrinterJob.java

License:Open Source License

@Override
public synchronized void print() throws PrinterException {
    //do work/*w w w. j a v a2s  .  co m*/
    if (printableDocument != null) {
        try {
            if (document == null) {
                Printable printable = printableDocument.getPrintable(0);
                PageFormat pf = printableDocument.getPageFormat(0);
                document = new Document(pageSize(pf), pageMargin("L", pf), //$NON-NLS-1$
                        pageMargin("R", pf), pageMargin("T", pf), //$NON-NLS-1$//$NON-NLS-2$
                        pageMargin("B", pf)); //$NON-NLS-1$
                // we create a writer that listens to the document and
                // directs a PDF-stream to a file
                writer = PdfWriter.getInstance(document, os);
                document.open();
                // we create a template and a Graphics2D object that
                // corresponds with it
                cb = writer.getDirectContent();
            }
            int numPages = printableDocument.getNumberOfPages();
            if (numPages == 0)
                document.add(new Paragraph(" "));
            pagesPrinted = 0;
            for (int i = 0; i < numPages; i++) {
                pagesPrinted++;
                Printable printable = printableDocument.getPrintable(i);
                PageFormat pf = printableDocument.getPageFormat(i);
                document.setPageSize(pageSize(pf));
                document.setMargins(pageMargin("L", pf), //$NON-NLS-1$
                        pageMargin("R", pf), pageMargin("T", pf), //$NON-NLS-1$//$NON-NLS-2$
                        pageMargin("B", pf)); //$NON-NLS-1$
                cb.saveState();
                Graphics2D g2d = cb.createGraphics((int) pf.getWidth(), (int) pf.getHeight(), mapper);
                printable.print(g2d, pf, i);
                g2d.dispose();
                cb.restoreState();
                document.newPage();
            }
            totalPagesPrinted += pagesPrinted;
            if (!isMetaPrintJob) {
                close();
            }
        } catch (Exception e) {
            Debug.error(e);
        }
    }
}

From source file:com.stratelia.webactiv.almanach.control.AlmanachPdfGenerator.java

License:Open Source License

static public void buildPdf(String name, AlmanachSessionController almanach, String mode)
        throws AlmanachRuntimeException {
    try {//w w  w.j  a v  a2  s .  c  o m
        SilverTrace.info("almanach", "AlmanachPdfGenerator.buildPdf()", "root.MSG_GEN_ENTER_METHOD");

        String fileName = FileRepositoryManager.getTemporaryPath(almanach.getSpaceId(),
                almanach.getComponentId()) + name;
        Document document = new Document(PageSize.A4, 50, 50, 50, 50);

        // we add some meta information to the document
        document.addAuthor(almanach.getSettings().getString("author", ""));
        document.addSubject(almanach.getSettings().getString("subject", ""));
        document.addCreationDate();

        PdfWriter.getInstance(document, new FileOutputStream(fileName));
        document.open();

        try {
            Calendar currentDay = Calendar.getInstance();
            currentDay.setTime(almanach.getCurrentDay());
            String sHeader = almanach.getString("events");
            if (mode.equals(PDF_MONTH_ALLDAYS) || mode.equals(PDF_MONTH_EVENTSONLY)) {
                sHeader += " " + almanach.getString("GML.mois" + currentDay.get(Calendar.MONTH));
            }
            sHeader += " " + currentDay.get(Calendar.YEAR);
            HeaderFooter header = new HeaderFooter(new Phrase(sHeader), false);
            HeaderFooter footer = new HeaderFooter(new Phrase("Page "), true);
            footer.setAlignment(Element.ALIGN_CENTER);

            document.setHeader(header);
            document.setFooter(footer);

            createFirstPage(almanach, document);
            document.newPage();

            Font titleFont = new Font(Font.HELVETICA, 24, Font.NORMAL, new Color(255, 255, 255));
            Paragraph cTitle = new Paragraph(almanach.getString("Almanach") + " "
                    + almanach.getString("GML.mois" + currentDay.get(Calendar.MONTH)) + " "
                    + currentDay.get(Calendar.YEAR), titleFont);
            Chapter chapter = new Chapter(cTitle, 1);

            // Collection<EventDetail> events =
            // almanach.getListRecurrentEvent(mode.equals(PDF_YEAR_EVENTSONLY));
            AlmanachCalendarView almanachView;
            if (PDF_YEAR_EVENTSONLY.equals(mode)) {
                almanachView = almanach.getYearlyAlmanachCalendarView();
            } else {
                almanachView = almanach.getMonthlyAlmanachCalendarView();
            }

            List<DisplayableEventOccurrence> occurrences = almanachView.getEvents();
            generateAlmanach(chapter, almanach, occurrences, mode);

            document.add(chapter);
        } catch (Exception ex) {
            throw new AlmanachRuntimeException("PdfGenerator.generate", AlmanachRuntimeException.WARNING,
                    "AlmanachRuntimeException.EX_PROBLEM_TO_GENERATE_PDF", ex);
        }

        document.close();
        SilverTrace.info("almanach", "AlmanachPdfGenerator.buildPdf()", "root.MSG_GEN_EXIT_METHOD");

    } catch (Exception e) {
        throw new AlmanachRuntimeException("PdfGenerator.generate", AlmanachRuntimeException.WARNING,
                "AlmanachRuntimeException.EX_PROBLEM_TO_GENERATE_PDF", e);
    }

}

From source file:com.stratelia.webactiv.newsEdito.control.PdfGenerator.java

License:Open Source License

/**
 * Method declaration/*w w w .  j  av a2s .  c om*/
 * @param name
 * @param completePubList
 * @param langue
 * @throws NewsEditoException
 * @see
 */
public static void generatePubList(String name, Collection<CompletePublication> completePubList, String langue)
        throws NewsEditoException {
    SilverTrace.info("NewsEdito", "PdfGenerator.generatePubList", "NewsEdito.MSG_ENTRY_METHOD",
            "Pdf name = " + name);
    try {
        CompletePublication first = completePubList.iterator().next();
        String fileName = FileRepositoryManager.getTemporaryPath(
                first.getPublicationDetail().getPK().getSpace(),
                first.getPublicationDetail().getPK().getComponentName()) + name;
        ResourceLocator message = new ResourceLocator(
                "com.stratelia.webactiv.newsEdito.multilang.newsEditoBundle", langue);
        // creation of the document with a certain size and certain margins
        Document document = new Document(PageSize.A4, 50, 50, 50, 50);

        // we add some meta information to the document
        document.addAuthor("Generateur de PDF Silverpeas");
        document.addSubject("Compilation de publications Silverpeas");
        document.addCreationDate();

        PdfWriter.getInstance(document, new FileOutputStream(fileName));
        document.open();

        createFirstPage(document, langue);

        HeaderFooter header = new HeaderFooter(new Phrase(message.getString("publicationCompilation")), false);
        HeaderFooter footer = new HeaderFooter(new Phrase("Page "), new Phrase("."));

        footer.setAlignment(Element.ALIGN_CENTER);

        document.setHeader(header);
        document.setFooter(footer);

        document.newPage();

        Font titleFont = new Font(Font.HELVETICA, 24, Font.NORMAL, new Color(255, 255, 255));
        Paragraph cTitle = new Paragraph(message.getString("listPublication"), titleFont);
        Chapter chapter = new Chapter(cTitle, 1);

        Iterator<CompletePublication> i = completePubList.iterator();
        CompletePublication complete = null;
        while (i.hasNext()) {
            complete = i.next();

            addPublication(chapter, complete);
        }

        document.add(chapter);

        document.close();
    } catch (Exception e) {
        throw new NewsEditoException("PdfGenerator.generatePubList", NewsEditoException.WARNING,
                "NewsEdito.EX_PROBLEM_TO_GENERATE_PUBLI_LIST", e);
    }
}

From source file:com.stratelia.webactiv.newsEdito.control.PdfGenerator.java

License:Open Source License

/**
 * Method declaration/*from ww  w . ja  v  a  2  s . c o m*/
 * @param name
 * @param archiveDetail
 * @param publicationBm
 * @param langue
 * @throws NewsEditoException
 * @see
 */
public static void generateArchive(String name, NodeDetail archiveDetail, PublicationBm publicationBm,
        String langue) throws NewsEditoException {
    SilverTrace.info("NewsEdito", "PdfGenerator.generateArchive", "NewsEdito.MSG_ENTRY_METHOD",
            "Pdf name = " + name);
    try {
        String fileName = FileRepositoryManager.getTemporaryPath(archiveDetail.getNodePK().getSpace(),
                archiveDetail.getNodePK().getComponentName()) + name;
        // creation of the document with a certain size and certain margins
        Document document = new Document(PageSize.A4, 50, 50, 50, 50);

        // we add some meta information to the document
        document.addAuthor("Generateur de PDF Silverpeas");
        document.addSubject("Journal Silverpeas : " + archiveDetail.getName());
        document.addCreationDate();

        PdfWriter.getInstance(document, new FileOutputStream(fileName));
        document.open();

        createFirstPage(document, langue);

        // we define a header and a footer
        String descriptionArchive = archiveDetail.getDescription();
        if (descriptionArchive == null)
            descriptionArchive = " ";

        HeaderFooter header = new HeaderFooter(new Phrase(archiveDetail.getName() + " : " + descriptionArchive),
                false);
        HeaderFooter footer = new HeaderFooter(new Phrase("Page "), new Phrase("."));

        footer.setAlignment(Element.ALIGN_CENTER);

        document.setHeader(header);
        document.setFooter(footer);

        document.newPage();

        PdfGenerator.addEditorial(document, archiveDetail, publicationBm, langue);
        PdfGenerator.addMasterTable(document, archiveDetail, publicationBm);

        document.close();
    } catch (Exception e) {
        throw new NewsEditoException("PdfGenerator.generateArchive", NewsEditoException.WARNING,
                "NewsEdito.EX_PROBLEM_TO_GENERATE_ARCHIVE", e);
    }

}

From source file:com.unicornlabs.kabouter.reporting.PowerReport.java

License:Apache License

public static void GeneratePowerReport(Date startDate, Date endDate) {
    try {//from w  w w  . j  a va2 s.c o m
        Historian theHistorian = (Historian) BusinessObjectManager.getBusinessObject(Historian.class.getName());
        ArrayList<String> powerLogDeviceIds = theHistorian.getPowerLogDeviceIds();

        Document document = new Document(PageSize.A4, 50, 50, 50, 50);

        File outputFile = new File("PowerReport.pdf");
        outputFile.createNewFile();

        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(outputFile));
        document.open();

        document.add(new Paragraph("Power Report for " + startDate.toString() + " to " + endDate.toString()));

        document.newPage();

        DecimalFormat df = new DecimalFormat("#.###");

        for (String deviceId : powerLogDeviceIds) {
            ArrayList<Powerlog> powerlogs = theHistorian.getPowerlogs(deviceId, startDate, endDate);
            double total = 0;
            double max = 0;
            Date maxTime = startDate;
            double average = 0;
            XYSeries series = new XYSeries(deviceId);
            XYDataset dataset = new XYSeriesCollection(series);

            for (Powerlog log : powerlogs) {
                total += log.getPower();
                if (log.getPower() > max) {
                    max = log.getPower();
                    maxTime = log.getId().getLogtime();
                }
                series.add(log.getId().getLogtime().getTime(), log.getPower());
            }

            average = total / powerlogs.size();

            document.add(new Paragraph("\nDevice: " + deviceId));
            document.add(new Paragraph("Average Power Usage: " + df.format(average)));
            document.add(new Paragraph("Maximum Power Usage: " + df.format(max) + " at " + maxTime.toString()));
            document.add(new Paragraph("Total Power Usage: " + df.format(total)));
            //Create a custom date axis to display dates on the X axis
            DateAxis dateAxis = new DateAxis("Date");
            //Make the labels vertical
            dateAxis.setVerticalTickLabels(true);

            //Create the power axis
            NumberAxis powerAxis = new NumberAxis("Power");

            //Set both axes to auto range for their values
            powerAxis.setAutoRange(true);
            dateAxis.setAutoRange(true);

            //Create the tooltip generator
            StandardXYToolTipGenerator ttg = new StandardXYToolTipGenerator("{0}: {2}",
                    new SimpleDateFormat("yyyy/MM/dd HH:mm"), NumberFormat.getInstance());

            //Set the renderer
            StandardXYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.LINES, ttg,
                    null);

            //Create the plot
            XYPlot plot = new XYPlot(dataset, dateAxis, powerAxis, renderer);

            //Create the chart
            JFreeChart myChart = new JFreeChart(deviceId, JFreeChart.DEFAULT_TITLE_FONT, plot, true);

            PdfContentByte pcb = writer.getDirectContent();
            PdfTemplate tp = pcb.createTemplate(480, 360);
            Graphics2D g2d = tp.createGraphics(480, 360, new DefaultFontMapper());
            Rectangle2D r2d = new Rectangle2D.Double(0, 0, 480, 360);
            myChart.draw(g2d, r2d);
            g2d.dispose();
            pcb.addTemplate(tp, 0, 0);

            document.newPage();
        }

        document.close();

        JOptionPane.showMessageDialog(null, "Report Generated.");

        Desktop.getDesktop().open(outputFile);
    } catch (FileNotFoundException fnfe) {
        JOptionPane.showMessageDialog(null,
                "Unable To Open File For Writing, Make Sure It Is Not Currently Open");
    } catch (IOException ex) {
        Logger.getLogger(PowerReport.class.getName()).log(Level.SEVERE, null, ex);
    } catch (DocumentException ex) {
        Logger.getLogger(PowerReport.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.util.load.RecordDocCreate.java

/**
 * /*from  w ww .  ja  v a2  s.  c  om*/
 * @param unitInfo ???
 * @param systemManager ?
 * @param rank 
 * @param countTol ?
 * @param countSec ?
 * @param countThr ?
 * @param countThir?
 * @param countMay ?
 * @param fileName ??
 * @return ?   1?
 */
public static int createRecordDoc(UnitInfo unitInfo, SystemManager systemManager, Rank rank, int countTol,
        int countSec, int countThr, int countThir, int countMay, File fileName) {

    Document document = new Document(PageSize.A4, 90.0F, 90.0F, 50.0F, 40.0F);
    try {
        RtfWriter2.getInstance(document, new FileOutputStream(fileName));
        document.open();

        String songPath = "";
        String blackFontPath = "";
        String fangsongPath = "";
        String wingdings2FontPath = "";
        if (System.getProperties().getProperty("os.name").toUpperCase().indexOf("WINDOWS") == 0) {
            songPath = "c:\\windows\\fonts\\msyh.ttf";
            blackFontPath = "c:\\windows\\fonts\\simhei.ttf";
            fangsongPath = "C:\\Windows\\Fonts\\simfang.ttf";
            wingdings2FontPath = "c:\\windows\\fonts\\WINGDNG2.TTF";
        } else {
            /*songPath="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf";
            blackFontPath="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf";
            fangsongPath="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf";
            wingdings2FontPath="/usr/share/fonts/truetype/unifont/unifont.ttf";*/
            songPath = "/usr/share/fonts/dejavu/DejaVuSansMono.ttf";
            blackFontPath = "/usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf";
            fangsongPath = "/usr/share/fonts/dejavu/DejaVuSerif.ttf";
            wingdings2FontPath = "/usr/share/fonts/dejavu/unifont.ttf";
        }

        BaseFont blackBaseFont = BaseFont.createFont(songPath, "Identity-H", false);
        BaseFont songFont = BaseFont.createFont(blackFontPath, "Identity-H", false);
        BaseFont fangsongFont = BaseFont.createFont(fangsongPath, "Identity-H", false);
        BaseFont wingdings2Font = BaseFont.createFont(wingdings2FontPath, "Identity-H", false);

        Font songfont_11 = new Font(songFont, 11.0F, 0);
        Font songfontUnderLine_11 = new Font(songFont, 11.0F, 4);

        Chunk rightSign = new Chunk("R", new Font(wingdings2Font, 16.0F, 0));
        Chunk blankSign = new Chunk("*", new Font(wingdings2Font, 20.0F, 0));

        Paragraph p = new Paragraph();
        //p.setFont(new Font(songFont, 14.0F, 0));
        p.add("  2");
        document.add(p);

        Paragraph p1 = new Paragraph();
        p1.add(new Chunk("?"));
        Table numTable = new Table(12, 1);
        numTable.setLeft(0);
        numTable.setWidth(50.0F);
        numTable.addCell("");
        p1.add(numTable);
        document.add(p1);
        /*String docName="";
        if("1".equals(rank.getRankOrganType())){
        docName="??";
        }
        if("2".equals(rank.getRankOrganType())){
        docName="??";
        }
        if("3".equals(rank.getRankOrganType())){
        docName="??";
        }
        if("4".equals(rank.getRankOrganType())){
        docName="???";
        }
        if("5".equals(rank.getRankOrganType())){
        docName="?";
        }
        if("6".equals(rank.getRankOrganType())){
        docName="?";
        }*/
        p = new Paragraph(rank.getSysInfoName() + "?");
        p.setFont(new Font(songFont, 36.0F, 1));
        p.setAlignment(1);
        document.add(p);

        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("  ? ?", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("()", new Font(fangsongFont, 16.0F, 4)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);

        document.add(Chunk.NEWLINE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("   ", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________________________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);

        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("   ", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("()", new Font(fangsongFont, 16.0F, 4)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);

        document.add(Chunk.NEWLINE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("   ", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________________________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);

        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("????", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("()", new Font(fangsongFont, 16.0F, 4)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);

        document.add(Chunk.NEWLINE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("? ?  ", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________________________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("?", new Font(songFont, 20.0F, 1)));
        document.add(p);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("", new Font(songFont, 16.0F, 1)));
        document.add(p);

        Chapter chapter = new Chapter(1);
        com.lowagie.text.List list = new com.lowagie.text.List(true, false, 20.0F);

        //1
        ListItem listItem = new ListItem();
        Chunk itemChunk = new Chunk("??", new Font(blackBaseFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "????[2007]43?");
        listItem.add(itemChunk);
        list.add(listItem);

        //2
        listItem = new ListItem();
        itemChunk = new Chunk("", new Font(blackBaseFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "???????????????????????????????????????????????");
        listItem.add(itemChunk);
        list.add(listItem);

        //3
        listItem = new ListItem();
        itemChunk = new Chunk("??", new Font(blackBaseFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "??????");
        listItem.add(itemChunk);
        list.add(listItem);

        //4
        listItem = new ListItem("",
                new Font(songFont, 11.0F, 0));
        listItem.add(blankSign);
        listItem.add(new Chunk("?", songfont_11));
        listItem.add(rightSign);
        listItem.add(new Chunk("???",
                songfont_11));
        list.add(listItem);

        //5
        listItem = new ListItem();
        itemChunk = new Chunk("???", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "??11?6????????GA380-20025???????");
        listItem.add(itemChunk);
        list.add(listItem);

        //6
        listItem = new ListItem();
        itemChunk = new Chunk("????", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("?????");
        listItem.add(itemChunk);
        list.add(listItem);

        //7
        listItem = new ListItem();
        itemChunk = new Chunk("??", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("??");
        listItem.add(itemChunk);
        list.add(listItem);
        //8
        listItem = new ListItem();
        itemChunk = new Chunk("??????", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "???????");
        listItem.add(itemChunk);
        list.add(listItem);

        //9
        listItem = new ListItem();
        itemChunk = new Chunk("04?", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("??(???)?");
        listItem.add(itemChunk);
        list.add(listItem);

        //10
        listItem = new ListItem();
        itemChunk = new Chunk("05??", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("???");
        listItem.add(itemChunk);
        list.add(listItem);

        //11
        listItem = new ListItem();
        itemChunk = new Chunk("06", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("???");
        listItem.add(itemChunk);
        list.add(listItem);

        //12
        listItem = new ListItem();
        itemChunk = new Chunk("08", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "????????GB/T124041997");
        listItem.add(itemChunk);
        list.add(listItem);

        //13
        listItem = new ListItem();
        itemChunk = new Chunk("02?", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("????????");
        listItem.add(itemChunk);
        list.add(listItem);

        //14
        listItem = new ListItem();
        itemChunk = new Chunk("05?", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("");
        listItem.add(itemChunk);
        list.add(listItem);

        //15
        listItem = new ListItem();
        itemChunk = new Chunk("07?", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "??????????");
        listItem.add(itemChunk);
        list.add(listItem);

        //16
        listItem = new ListItem();
        itemChunk = new Chunk("08?", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "?????????");
        listItem.add(itemChunk);
        list.add(listItem);

        //17
        listItem = new ListItem();
        itemChunk = new Chunk("", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "??????");
        listItem.add(itemChunk);
        list.add(listItem);
        document.add(list);

        document.add(Chunk.NEXTPAGE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("  ??", new Font(songFont, 16.0F, 0)));
        document.add(p);

        Table table1 = new Table(16);
        table1.setWidth(110.0F);
        table1.setWidths(new int[] { 20, 5, 5, 5, 5, 5, 5, 10, 25, 5, 5, 5, 5, 5, 5, 10 });
        Cell cell = new Cell(new Phrase(new Chunk("01????", songfont_11)));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell(unitInfo.getUnitName() == null ? " " : unitInfo.getUnitName());
        setLocal(cell);
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("02???", songfont_11)));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell();
        Font underLineFont = new Font(songFont, 11.0F, 4);
        cell.add(new Chunk(unitInfo.getProvince() == null ? "" : unitInfo.getProvince(), underLineFont));
        cell.add(new Chunk("?(?) ", songfont_11));
        cell.add(new Chunk(unitInfo.getCity() == null ? "" : unitInfo.getCity(), underLineFont));
        cell.add(new Chunk(" (???) ", songfont_11));
        cell.add(new Chunk(unitInfo.getCounty() == null ? "" : unitInfo.getCounty(), underLineFont));
        cell.add(new Chunk("(??)", songfont_11));
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("03?", songfont_11)));
        setLocal(cell);
        table1.addCell(cell);

        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(0) + "", songfont_11)));
        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(1) + "", songfont_11)));
        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(2) + "", songfont_11)));
        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(3) + "", songfont_11)));
        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(4) + "", songfont_11)));
        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(5) + "", songfont_11)));
        table1.addCell("");
        table1.addCell(new Phrase(new Chunk("04?", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(0) + "", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(1) + "", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(2) + "", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(3) + "", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(4) + "", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(5) + "", songfont_11)));
        table1.addCell("");

        cell = new Cell(new Chunk("05??", new Font(songFont, 11.0F, 0)));
        setLocal(cell);
        cell.setRowspan(2);
        table1.addCell(cell);

        cell = new Cell(new Chunk("   ??", new Font(songFont, 11.0F, 0)));
        cell.setColspan(3);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getUnitLeader() == null ? "" : unitInfo.getUnitLeader(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(4);
        table1.addCell(cell);

        table1.addCell(new Phrase(new Chunk("?/?", new Font(songFont, 11.0F, 0))));
        cell = new Cell(new Phrase(
                new Chunk(unitInfo.getDuty() == null ? "" : unitInfo.getDuty(), new Font(songFont, 11.0F, 0))));
        cell.setColspan(7);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", new Font(songFont, 11.0F, 0))));
        cell.setColspan(3);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getUnitTel() == null ? "" : unitInfo.getUnitTel(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(4);
        table1.addCell(cell);

        table1.addCell(new Phrase(new Chunk("?", new Font(songFont, 11.0F, 0))));
        cell = new Cell(new Phrase(new Chunk(unitInfo.getUnitEmail() == null ? "" : unitInfo.getUnitEmail(),
                new Font(songFont, 11.0F, 0))));
        cell.setColspan(7);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("06", new Font(songFont, 11.0F, 0))));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getUnitDep() == null ? "" : unitInfo.getUnitDep(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("07?", new Font(songFont, 11.0F, 0))));
        setLocal(cell);
        cell.setRowspan(3);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("   ??", new Font(songFont, 11.0F, 0))));
        cell.setColspan(3);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getDepContact() == null ? "" : unitInfo.getDepContact(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(4);
        table1.addCell(cell);

        table1.addCell(new Phrase(new Chunk("?/?", new Font(songFont, 11.0F, 0))));
        cell = new Cell(new Chunk(unitInfo.getDepDuty() == null ? "" : unitInfo.getDepDuty(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(7);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", new Font(songFont, 11.0F, 0))));
        cell.setColspan(3);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getDepTel() == null ? "" : unitInfo.getDepTel(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(4);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", new Font(songFont, 11.0F, 0))));
        cell.setRowspan(2);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getDepEmail() == null ? "" : unitInfo.getDepEmail(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(7);
        cell.setRowspan(2);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", new Font(songFont, 11.0F, 0))));
        cell.setColspan(3);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getDepMobile() == null ? "" : unitInfo.getDepMobile(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(4);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("08", new Font(songFont, 11.0F, 0))));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell("".equals(unitInfo.getSubordinate()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t", new Font(songFont, 11.0F, 0)));
        cell.add("?".equals(unitInfo.getSubordinate()) ? rightSign : blankSign);
        cell.add(new Chunk("2?(?)\t", new Font(songFont, 11.0F, 0)));
        cell.add("".equals(unitInfo.getSubordinate()) ? rightSign : blankSign);
        cell.add(new Chunk("3(???)\t", new Font(songFont, 11.0F, 0)));
        cell.add(Chunk.NEWLINE);
        cell.add("".equals(unitInfo.getSubordinate()) ? rightSign : blankSign);
        cell.add(new Chunk("4(??)\t", new Font(songFont, 11.0F, 0)));
        cell.add("".equals(unitInfo.getSubordinate()) ? rightSign : blankSign);
        cell.add(new Chunk("9", new Font(songFont, 11.0F, 0)));
        cell.add(new Chunk(unitInfo.getOtherSub() != null ? unitInfo.getOtherSub() : "________",
                new Font(songFont, 11.0F, 4)));
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("09??", new Font(songFont, 11.0F, 0))));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell("".equals(unitInfo.getUnitType()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t\t", songfont_11));
        cell.add("".equals(unitInfo.getUnitType()) ? rightSign : blankSign);
        cell.add(new Chunk("2\t\t", songfont_11));
        cell.add("??".equals(unitInfo.getUnitType()) ? rightSign : blankSign);
        cell.add(new Chunk("3??\t\t", songfont_11));
        cell.add("?".equals(unitInfo.getUnitType()) ? rightSign : blankSign);
        cell.add(new Chunk("4?", songfont_11));
        cell.add(Chunk.NEWLINE);
        cell.add("".equals(unitInfo.getUnitType()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(unitInfo.getOtherUnitType() != null ? unitInfo.getOtherUnitType() : "________",
                new Font(songFont, 11.0F, 4)));
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("10", songfont_11)));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("11\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("12\t", songfont_11));

        cell.add("???".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("13???", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("21?\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("22\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("23\t\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("24", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("25\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("26\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("27?\t\t\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("28?", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("31\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("32\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("33?\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("34", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("35\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("36\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("37?\t\t\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("38?", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("39\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("40\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("41?\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("42", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("43\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("44\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("45?\t\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("46", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("47\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("48\t", songfont_11));

        cell.add("??".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("49??\t\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("50", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("51\t\t", songfont_11));

        cell.add("??".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("52??\t", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getOtherEmp()) ? rightSign : blankSign);
        cell.add(new Chunk("99", songfont_11));
        cell.add(new Chunk("".equals(unitInfo.getOtherEmp()) ? unitInfo.getOtherEmp() : "________"));
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("11?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table1.addCell(cell);
        cell = new Cell(new Phrase(new Chunk(countTol + "", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        cell.setRowspan(2);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("12?", songfont_11)));
        cell.setColspan(5);
        table1.addCell(cell);
        cell = new Cell(new Phrase(new Chunk(countSec + "", songfont_11)));
        setLocal(cell);
        cell.setColspan(1);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("13?", songfont_11)));
        cell.setColspan(6);
        table1.addCell(cell);
        cell = new Cell(new Phrase(new Chunk(countThr + "", songfont_11)));
        cell.setColspan(1);
        setLocal(cell);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("14?", songfont_11)));
        cell.setColspan(5);
        table1.addCell(cell);
        cell = new Cell(new Phrase(new Chunk(countThir + "", songfont_11)));
        cell.setColspan(1);
        setLocal(cell);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("15?", songfont_11)));
        cell.setColspan(6);
        table1.addCell(cell);
        cell = new Cell(new Phrase(new Chunk("0", songfont_11)));
        cell.setColspan(1);
        setLocal(cell);
        table1.addCell(cell);

        document.add(table1);

        document.add(Chunk.NEXTPAGE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk(" (" + rank.getSysInfoName() + ")?",
                new Font(songFont, 16.0F, 0)));
        document.add(p);

        Table table2 = new Table(14);
        table2.setWidth(120.0F);
        table2.setWidths(new int[] { 8, 13, 5, 12, 3, 8, 5, 5, 5, 13, 5, 5, 5, 5 });

        cell = new Cell(new Phrase(new Chunk("01??", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell(new Chunk(rank.getSysInfoName() == null ? "" : rank.getSysInfoName(), songfont_11));
        cell.setColspan(7);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("02?", songfont_11)));
        cell = new Cell(new Chunk(rank.getSysInfoId() == null ? "" : rank.getSysInfoId(), songfont_11));
        cell.setColspan(4);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("03", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell("1".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t", songfont_11));
        cell.add("2".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("2\t", songfont_11));
        cell.add("3".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("3?\t", songfont_11));
        cell.add("4".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("4\t\n", songfont_11));
        cell.add("5".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("5?\t", songfont_11));
        cell.add("9".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(
                systemManager.getOtherBusType() != null ? systemManager.getOtherBusType() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("??", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell(new Chunk(systemManager.getBusDescription(), songfont_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("04?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell("10".equals(systemManager.getSerArea()) ? rightSign : blankSign);
        cell.add(new Chunk("10\t", songfont_11));

        cell.add(new Chunk("11".equals(systemManager.getSerArea()) ? rightSign : blankSign));
        cell.add(new Chunk("11??", songfont_11));
        cell.add(new Chunk(systemManager.getProTotal() != null ? systemManager.getProTotal() + "" : "________",
                songfontUnderLine_11));
        cell.add(new Chunk("\t", songfont_11));

        cell.add("20".equals(systemManager.getSerArea()) ? rightSign : blankSign);
        cell.add(new Chunk("20??\t\n", songfont_11));

        cell.add("21".equals(systemManager.getSerArea()) ? rightSign : blankSign);
        cell.add(new Chunk("21? ", songfont_11));
        cell.add(
                new Chunk(systemManager.getCityTotal() != null ? systemManager.getCityTotal() + "" : "________",
                        songfontUnderLine_11));
        cell.add(new Chunk("\t", songfont_11));

        cell.add("30".equals(systemManager.getSerArea()) ? rightSign : blankSign);
        cell.add(new Chunk("30?\t", songfont_11));

        cell.add(new Chunk("99".equals(systemManager.getSerArea()) ? rightSign : blankSign));
        cell.add(new Chunk("99", songfont_11));
        cell.add(new Chunk(systemManager.getOtherArea() != null ? systemManager.getOtherArea() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell("1".equals(systemManager.getSerObj()) ? rightSign : blankSign);
        cell.add(new Chunk("1??   ", songfont_11));
        cell.add("2".equals(systemManager.getSerObj()) ? rightSign : blankSign);
        cell.add(new Chunk("2   ", songfont_11));
        cell.add("3".equals(systemManager.getSerObj()) ? rightSign : blankSign);
        cell.add(new Chunk("3?   ", songfont_11));
        cell.add("9".equals(systemManager.getSerObj()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(systemManager.getOtherObj() != null ? systemManager.getOtherObj() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("05?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankCoveArea()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t", songfont_11));
        cell.add("2".equals(rank.getRankCoveArea()) ? rightSign : blankSign);
        cell.add(new Chunk("2\t", songfont_11));
        cell.add("3".equals(rank.getRankCoveArea()) ? rightSign : blankSign);
        cell.add(new Chunk("3\t", songfont_11));
        cell.add("4".equals(rank.getRankCoveArea()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(rank.getRankOthArea() != null ? rank.getRankOthArea() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankNetworkProp()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t", songfont_11));
        cell.add("2".equals(rank.getRankNetworkProp()) ? rightSign : blankSign);
        cell.add(new Chunk("2?\t", songfont_11));
        cell.add("3".equals(rank.getRankNetworkProp()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(rank.getRankOthNetworkProp() != null ? rank.getRankOthNetworkProp() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("06?", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell("1".equals(rank.getRankSysConn()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t", songfont_11));
        cell.add("2".equals(rank.getRankSysConn()) ? rightSign : blankSign);
        cell.add(new Chunk("2??\t\n", songfont_11));
        cell.add("3".equals(rank.getRankSysConn()) ? rightSign : blankSign);
        cell.add(new Chunk("3??\t", songfont_11));
        cell.add("4".equals(rank.getRankSysConn()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(rank.getRankOtherSysConn() != null ? rank.getRankOtherSysConn() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("07?", songfont_11)));
        cell.setColspan(2);
        cell.setRowspan(8);
        setLocal(cell);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("??", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setColspan(8);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk(" ", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk(" ", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?  ", songfont_11)));
        setLocal(cell);
        cell.setColspan(4);
        table2.addCell(cell);

        for (int i = 1; i <= 6; i++) {

            table2.addCell(new Phrase(new Chunk(i + "", songfont_11)));
            switch (i) {

            case 1:
                cell = new Cell(new Chunk("?", songfont_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankSecCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankSecUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankSecUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankSecUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankSecUse() != null ? rank.getPartRankSecUse() : "________") + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;

            case 2:
                cell = new Cell(new Chunk("?", songfont_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankNetCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankNetUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankNetUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankNetUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankNetUse() != null ? rank.getPartRankNetUse() : "________") + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;
            case 3:
                cell = new Cell(new Chunk("?", songfont_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankSysCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankSysUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankSysUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankSysUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankSysUse() != null ? rank.getPartRankSysUse() : "________") + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;
            case 4:
                cell = new Cell(new Chunk("?", songfont_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankSqlCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankSqlUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankSqlUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankSqlUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankSqlUse() != null ? rank.getPartRankSqlUse() : "________") + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;
            case 5:
                cell = new Cell(new Chunk("?", songfont_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankSerCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankSerUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankSerUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankSerUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankSerUse() != null ? rank.getPartRankSerUse() : "________") + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;
            case 6:
                cell = new Cell(new Chunk("", songfont_11));
                cell.add(new Chunk((rank.getRankOthProd() != null ? rank.getRankOthProd() : "________"),
                        songfontUnderLine_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankOthProdCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankOthProdUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankOthProdUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankOthProdUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankOthProdUse() != null ? rank.getPartRankOthProdUse() : "________")
                                + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;

            }

        }

        cell = new Cell(new Phrase(new Chunk("08?", songfont_11)));
        cell.setColspan(2);
        cell.setRowspan(10);
        setLocal(cell);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("??", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        cell.setColspan(3);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setColspan(8);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("??", songfont_11)));
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("? ", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("1", songfont_11)));
        table2.addCell(new Phrase(new Chunk("", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfGradeEval()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfGradeEval())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankSerGradeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankSerGradeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankSerGradeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("2", songfont_11)));
        table2.addCell(new Phrase(new Chunk("", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfRiskEval()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfRiskEval())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankSerRiskType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankSerRiskType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankSerRiskType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("3", songfont_11)));
        table2.addCell(new Phrase(new Chunk("???", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfSuffReco()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfSuffReco())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankIfSuffRecoType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankIfSuffRecoType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankIfSuffRecoType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("4", songfont_11)));
        table2.addCell(new Phrase(new Chunk("?", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfResponse()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfResponse())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankResponseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankResponseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankResponseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("5", songfont_11)));
        table2.addCell(new Phrase(new Chunk("?", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfSysInte()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfSysInte())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankSysInteType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankSysInteType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankSysInteType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("6", songfont_11)));
        table2.addCell(new Phrase(new Chunk("", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfSecCon()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfSecCon())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankSecConypeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankSecConypeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankSecConypeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("7", songfont_11)));
        table2.addCell(new Phrase(new Chunk("", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfSecTrain()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfSecTrain())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankSecTrainType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankSecTrainType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankSecTrainType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("8", songfont_11)));
        cell = new Cell(new Chunk("", songfont_11));
        cell.add(new Chunk((rank.getRankOthSerName() != null ? rank.getRankOthSerName() : "________"),
                songfontUnderLine_11));
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankIfOthSer()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfOthSer())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankOthUseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankOthUseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankOthUseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("09????", songfont_11)));
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk(rank.getRankEvalUnitName(), songfont_11)));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("10?", songfont_11)));
        cell.setColspan(2);
        table2.addCell(cell);

        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
        cell = new Cell(new Phrase(new Chunk(format.format(rank.getRankUseDate()), songfont_11)));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("11?", songfont_11)));
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell("1".equals(rank.getRankFlag()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("0".equals(rank.getRankFlag()) ? rightSign : blankSign);
        cell.add(new Chunk("?", songfont_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("12??", songfont_11)));
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk(rank.getRankParentSysName(), songfont_11)));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("13????", songfont_11)));
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk(rank.getRankParentUnitName(), songfont_11)));
        cell.setColspan(12);
        table2.addCell(cell);

        document.add(table2);
        document.add(Chunk.NEXTPAGE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("(" + systemManager.getSysName() + ")?",
                new Font(songFont, 16.0F, 0)));
        document.add(p);

        Table table3 = new Table(2);
        table3.setWidth(110.0F);
        table3.setWidths(new int[] { 40, 70 });

        cell = new Cell(new Phrase(new Chunk("01??", songfont_11)));
        table3.addCell(cell);

        cell = new Cell("".equals(rank.getRankGrade()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("".equals(rank.getRankGrade()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("".equals(rank.getRankGrade()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("".equals(rank.getRankGrade()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("".equals(rank.getRankGrade()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("02", songfont_11)));
        table3.addCell(cell);
        cell = new Cell(new Chunk(format.format(rank.getRankTime()), songfont_11));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("03", songfont_11)));
        table3.addCell(cell);
        cell = new Cell(new Phrase(
                new Chunk("1".equals(rank.getRankJudge()) ? "" : "", songfont_11)));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("04?", songfont_11)));
        table3.addCell(cell);
        cell = new Cell("1".equals(rank.getRankIsDep()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("0".equals(rank.getRankIsDep()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("05??", songfont_11)));
        table3.addCell(cell);
        cell = new Cell(
                new Phrase(new Chunk(rank.getRankDepName() == null ? "" : rank.getRankDepName(), songfont_11)));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("06", songfont_11)));
        table3.addCell(cell);
        cell = new Cell("1".equals(rank.getRankDepJudge()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("0".equals(rank.getRankDepJudge()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("07", songfont_11)));
        table3.addCell(cell);
        cell = new Cell(new Phrase(new Chunk("1".equals(rank.getRankDoc()) ? rightSign : blankSign)));
        cell.add(new Chunk("", songfont_11));
        cell.add("0".equals(rank.getRankDoc()) ? rightSign : blankSign);
        cell.add(new Chunk("\t", songfont_11));
        cell.add(new Chunk("??" + (rank.getRankAccess() == null ? "" : rank.getRankAccess()),
                songfont_11));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("", songfont_11)));
        cell.add(new Chunk(rank.getRankInformant()));
        table3.addCell(cell);
        cell = new Cell(new Phrase(new Chunk("", songfont_11)));
        cell.add(new Chunk(format.format(rank.getRankDate())));
        table3.addCell(cell);

        document.add(table3);
        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk(
                "                                           ",
                songfont_11));
        document.add(p);
        document.add(Chunk.NEXTPAGE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk(" " + systemManager.getSysName()
                + " ??????", songfont_11));
        document.add(p);
        if (null == null) {
            Table table4 = new Table(2);
            table4.setWidth(110.0F);
            table4.setWidths(new int[] { 40, 70 });

            table4.addCell(new Phrase(new Chunk("01?", songfont_11)));
            cell = new Cell("1".equals(rank.getRankTopStruct()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankTopStruct()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankTopRelAcc() != null ? rank.getRankTopRelAcc() : "________",
                    songfont_11));
            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk("02??", songfont_11)));

            cell = new Cell("1".equals(rank.getRankSysManage()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankSysManage()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankSysManRel() != null ? rank.getRankSysManRel() : "________",
                    songfont_11));
            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk(
                    "03?", songfont_11)));
            cell = new Cell("1".equals(rank.getRankSysPlan()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankSysPlan()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankSysPlanRel() != null ? rank.getRankSysPlanRel() : "________",
                    songfont_11));

            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk(
                    "04???????", songfont_11)));
            cell = new Cell("1".equals(rank.getRankSysLicense()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankSysLicense()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankSysLiceRel() != null ? rank.getRankSysLiceRel() : "________",
                    songfont_11));
            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk("05", songfont_11)));
            cell = new Cell("1".equals(rank.getRankSysReport()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankSysReport()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankSysReportRel() != null ? rank.getRankSysReportRel() : "________",
                    songfont_11));
            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk("06", songfont_11)));
            cell = new Cell("1".equals(rank.getRankPeerRev()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankPeerRev()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankPeerRevRel() != null ? rank.getRankPeerRevRel() : "________",
                    songfont_11));
            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk("07??", songfont_11)));
            cell = new Cell("1".equals(rank.getRankSuperOpin()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankSuperOpin()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankSuperOpinRel() != null ? rank.getRankSuperOpinRel() : "________",
                    songfont_11));
            table4.addCell(cell);

            document.add(table4);
            document.close();
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (DocumentException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    return 1;

}