Example usage for com.itextpdf.text Document addSubject

List of usage examples for com.itextpdf.text Document addSubject

Introduction

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

Prototype


public boolean addSubject(String subject) 

Source Link

Document

Adds the subject to a Document.

Usage

From source file:Modelo.RelatoriosBEAN.java

public static void relatorioMontanteVendedor() throws FileNotFoundException, DocumentException {
    String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf";
    Document document = new Document(PageSize.A4.rotate());
    PdfWriter.getInstance(document, new FileOutputStream(path));
    document.open();//from w w w.  j  a  v  a 2  s  .c o m
    document.addAuthor("TechSales");
    document.addCreator("TechSales");
    document.addSubject("TechSales - Sistema de gerenciamento de locadoras");
    document.addCreationDate();
    document.addTitle("TechSales");

    HTMLWorker htmlWorker = new HTMLWorker(document);

    String frase;
    try {
        frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<br/>"
                + "<h1 align=center>Relatrio de montante por vendedor</h1>" + "<br/><br/>"
                + "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<tr> "
                + "<th align=center><strong>Cdigo do funcionario</strong></th> "
                + "<th align=center><strong>Nome do funcionario</strong></th> "
                + "<th align=center><strong>Nmero de vendas</strong></th> "
                + "<th align=center><strong>Valor total das vendas</strong></th> "
                + "<th align=center><strong>Quantidade de alugueis</strong></th> "
                + "<th align=center><strong>Valor total de alugueis</strong></th> "
                + "<th align=center><strong>Montante Total</strong></th> " + "</tr> ";
        for (MontanteBEAN j : jDAO.montanteVendedor()) {
            frase += "<tr align=center><td>" + j.getFunCodigo() + "</td><td>" + j.getFunNome() + "</td><td>"
                    + j.getnVendas() + "</td><td>" + j.getValorVendas() + "</td><td>" + j.getnAluguel()
                    + "</td><td>" + j.getValorAluguel() + "</td><td>" + j.getValorTotal() + "</td></tr>";
        }
        frase += "</table>";
        frase += "</body></html>";
        htmlWorker.parse(new StringReader(frase));
        document.close();
        if (Desktop.isDesktopSupported()) {
            try {
                Desktop.getDesktop().open(new File(path));
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Modelo.RelatoriosBEAN.java

public static void relatorioVendaJogoPeriodo(String s, String dI, String dF)
        throws FileNotFoundException, DocumentException {
    String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf";
    Document document = new Document(PageSize.LETTER);
    PdfWriter.getInstance(document, new FileOutputStream(path));
    document.open();//  w w w.  j ava 2  s .co m
    document.addAuthor("TechSales");
    document.addCreator("TechSales");
    document.addSubject("TechSales - Sistema de gerenciamento de locadoras");
    document.addCreationDate();
    document.addTitle("TechSales");

    HTMLWorker htmlWorker = new HTMLWorker(document);

    String frase;
    try {
        frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>"
                + "<h1 align=center>Relatrio de Jogos vendidos</h1>" + "<br/>"
                + "<h3 align=center>Perodo de " + dI + " a " + dF + "</h3>" + "<br/><br/>"
                + "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<tr> "
                + "<th align=center><strong>Cdigo do jogo</strong></th> "
                + "<th align=center><strong>Nome do jogo</strong></th> "
                + "<th align=center><strong>Nmero de vendas</strong></th> "
                + "<th align=center><strong>Valor total das vendas</strong></th> " + "</tr> ";
        for (JogoBEAN j : jDAO.vendaPorPeriodo(s)) {
            frase += "<tr align=center><td>" + j.getJoCodigo() + "</td><td>" + j.getJoNome() + "</td><td>"
                    + j.getJoQtd() + "</td><td>" + j.getJoPrecoPadrao() + "</td></tr>";
        }
        frase += "</table>";
        frase += "</body></html>";
        htmlWorker.parse(new StringReader(frase));
        document.close();
        if (Desktop.isDesktopSupported()) {
            try {
                Desktop.getDesktop().open(new File(path));
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Modelo.RelatoriosBEAN.java

public static void relatorioAluguelJogoPeriodo(String s, String dI, String dF)
        throws FileNotFoundException, DocumentException {
    String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf";
    Document document = new Document(PageSize.LETTER);
    PdfWriter.getInstance(document, new FileOutputStream(path));
    document.open();/*w  w w . ja  v a2s  .  com*/
    document.addAuthor("TechSales");
    document.addCreator("TechSales");
    document.addSubject("TechSales - Sistema de gerenciamento de locadoras");
    document.addCreationDate();
    document.addTitle("TechSales");

    HTMLWorker htmlWorker = new HTMLWorker(document);

    String frase;
    try {
        frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<br/>"
                + "<h1 align=center>Relatrio de Jogos alugados</h1>" + "<h3 align=center>Perodo de " + dI
                + " a " + dF + "</h3>" + "<br/><br/>"
                + "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<tr> "
                + "<th align=center><strong>Cdigo do jogo</strong></th> "
                + "<th align=center><strong>Nome do jogo</strong></th> "
                + "<th align=center><strong>Nmero de alugueis</strong></th> "
                + "<th align=center><strong>Valor total dos alugueis</strong></th> " + "</tr> ";
        for (JogoBEAN j : jDAO.aluguelPorPeriodo(s)) {
            frase += "<tr align=center><td>" + j.getJoCodigo() + "</td><td>" + j.getJoNome() + "</td><td>"
                    + j.getJoQtd() + "</td><td>" + j.getJoPrecoPadrao() + "</td></tr>";
        }
        frase += "</table>";
        frase += "</body></html>";
        htmlWorker.parse(new StringReader(frase));
        document.close();
        if (Desktop.isDesktopSupported()) {
            try {
                Desktop.getDesktop().open(new File(path));
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Modelo.RelatoriosBEAN.java

public static void relatorioMontanteCliente() throws FileNotFoundException, DocumentException {
    String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf";
    Document document = new Document(PageSize.A4.rotate());
    PdfWriter.getInstance(document, new FileOutputStream(path));
    document.open();//from w w  w. j  av  a 2 s  .  co m
    document.addAuthor("TechSales");
    document.addCreator("TechSales");
    document.addSubject("TechSales - Sistema de gerenciamento de locadoras");
    document.addCreationDate();
    document.addTitle("TechSales");

    HTMLWorker htmlWorker = new HTMLWorker(document);

    String frase;
    try {
        frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<br/>"
                + "<h1 align=center>Relatrio de montante por cliente </h1>" + "<br/><br/>"
                + "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<tr> "
                + "<th align=center><strong>Cdigo do cliente</strong></th> "
                + "<th align=center><strong>Nome do cliente</strong></th> "
                + "<th align=center><strong>Nmero de compras</strong></th> "
                + "<th align=center><strong>Valor total das compras</strong></th> "
                + "<th align=center><strong>Quantidade de alugueis</strong></th> "
                + "<th align=center><strong>Valor total de alugueis</strong></th> "
                + "<th align=center><strong>Montante Total</strong></th> " + "</tr> ";
        for (MontanteBEAN j : jDAO.montanteCliente()) {
            frase += "<tr align=center><td>" + j.getFunCodigo() + "</td><td>" + j.getFunNome() + "</td><td>"
                    + j.getnVendas() + "</td><td>" + j.getValorVendas() + "</td><td>" + j.getnAluguel()
                    + "</td><td>" + j.getValorAluguel() + "</td><td>" + j.getValorTotal() + "</td></tr>";
        }
        frase += "</table>";
        frase += "</body></html>";
        htmlWorker.parse(new StringReader(frase));
        document.close();
        if (Desktop.isDesktopSupported()) {
            try {
                Desktop.getDesktop().open(new File(path));
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Modelo.RelatoriosBEAN.java

public static void notaDaVenda(VendaBEAN v) throws FileNotFoundException, DocumentException {
    String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf";
    Document document = new Document(PageSize.LETTER);
    PdfWriter.getInstance(document, new FileOutputStream(path));
    document.open();/*from  ww w .ja  va 2  s  . c  om*/
    document.addAuthor("TechSales");
    document.addCreator("TechSales");
    document.addSubject("TechSales - Sistema de gerenciamento de locadoras");
    document.addCreationDate();
    document.addTitle("TechSales");

    HTMLWorker htmlWorker = new HTMLWorker(document);

    String frase;
    try {
        frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>"
                + "<h1 align=center>Nota de Compra</h1>" + "<br/><br/>"
                + "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<tr> "
                + "<th align=center><strong>Cdigo</strong></th> "
                + "<th align=center><strong>Cliente</strong></th> "
                + "<th align=center><strong>Data</strong></th> "
                + "<th align=center><strong>Total</strong></th> "
                + "<th align=center><strong>Entrada</strong></th> "
                + "<th align=center><strong>Parcelas</strong></th> "
                + "<th align=center><strong>Vendedor</strong></th> " + "</tr> ";

        frase += "<tr align=center><td>" + v.getVendaCodigo() + "</td><td>" + v.getCliente().getCliCodigo()
                + "</td><td>" + v.getVendaData() + "</td><td>" + "</td><td>" + v.getVendaValorTotal()
                + "</td><td>" + "</td><td>" + v.getVendaEntrada() + "</td><td>" + "</td><td>"
                + v.getVendaNparcelas() + "</td><td>" + "</td><td>" + v.getVendedor().getVendedorCodigo()
                + "</td></tr>" + "</table>";

        frase += "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<br/><br/>" + "<tr> "
                + "<th align=center><strong>Parcela</strong></th> "
                + "<th align=center><strong>Data</strong></th> "
                + "<th align=center><strong>Valor</strong></th> "
                + "<th align=center><strong>Situao</strong></th> " + "</tr> ";

        for (VendaAPrazoBEAN vap : cVap.listarALL()) {
            if (vap.getVenda().getVendaCodigo() == v.getVendaCodigo()) {
                frase += "<tr align=center><td>" + vap.getVapNumParcela() + "</td><td>" + vap.getVapData()
                        + "</td><td>" + vap.getVapValorParcela() + "</td><td>" + vap.getVapSituacao()
                        + "</td></tr>";
            }
        }
        frase += "</table>";
        frase += "</body></html>";
        htmlWorker.parse(new StringReader(frase));
        document.close();
        if (Desktop.isDesktopSupported()) {
            try {
                Desktop.getDesktop().open(new File(path));
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Modelo.RelatoriosBEAN.java

public static void notaDaDev(DevolucaoBEAN l) throws FileNotFoundException, DocumentException {
    String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf";
    Document document = new Document(PageSize.A4.rotate());
    PdfWriter.getInstance(document, new FileOutputStream(path));
    document.open();/*from w ww.  j  a  va 2  s .  c  om*/
    document.addAuthor("TechSales");
    document.addCreator("TechSales");
    document.addSubject("TechSales - Sistema de gerenciamento de locadoras");
    document.addCreationDate();
    document.addTitle("TechSales");

    HTMLWorker htmlWorker = new HTMLWorker(document);

    String frase;
    try {
        frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>"
                + "<h1 align=center>Nota de devoluo</h1>" + "<br/><br/>"
                + "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<tr> "
                + "<th align=center><strong>Cdigo</strong></th> "
                + "<th align=center><strong>Cliente</strong></th> "
                + "<th align=center><strong>Data Devoluo</strong></th> "
                + "<th align=center><strong>Multa</strong></th> "
                + "<th align=center><strong>Valor Total</strong></th> "
                + "<th align=center><strong>Vendedor</strong></th> " + "</tr> ";

        frase += "<tr align=center><td>" + l.getDevCodigo() + "</td><td>"
                + l.getLocacao().getCliente().getCliNome() + "</td><td>" + l.getDevData() + "</td><td>"
                + l.getDevMulta() + "</td><td>" + l.getDevValor() + "</td><td>"
                + l.getLocacao().getVendedor().getFuncionario().getFunNome() + "</td></tr>" + "</table>";

        frase += "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<br/><br/>" + "<tr> "
                + "<th align=center><strong>Cdigo do Jogo</strong></th> "
                + "<th align=center><strong>Nome</strong></th> "
                + "<th align=center><strong>Quantidade Locao</strong></th> " + "</tr> ";
        for (JogoLocacaoBEAN jl : cJl.listarALL()) {
            if (jl.getChaveComposta().getLocacao().getLocCodigo() == l.getLocacao().getLocCodigo()) {
                frase += "<tr align=center><td>" + jl.getChaveComposta().getJogo().getJoCodigo() + "</td><td>"
                        + jl.getChaveComposta().getJogo().getJoNome() + "</td><td>" + jl.getJlQtd()
                        + "</td></tr>";
            }
        }
        frase += "</table>";
        frase += "</body></html>";
        htmlWorker.parse(new StringReader(frase));
        document.close();
        if (Desktop.isDesktopSupported()) {
            try {
                Desktop.getDesktop().open(new File(path));
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Modelo.RelatoriosBEAN.java

public static void notaDeConta(ContaBEAN v) throws FileNotFoundException, DocumentException {
    String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf";
    Document document = new Document(PageSize.LETTER);
    PdfWriter.getInstance(document, new FileOutputStream(path));
    document.open();//  w w w . j  ava2  s.c o  m
    document.addAuthor("TechSales");
    document.addCreator("TechSales");
    document.addSubject("TechSales - Sistema de gerenciamento de locadoras");
    document.addCreationDate();
    document.addTitle("TechSales");

    HTMLWorker htmlWorker = new HTMLWorker(document);

    String frase;
    try {
        frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>"
                + "<h1 align=center>Nota de Conta</h1>" + "<br/><br/>"
                + "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<tr> "
                + "<th align=center><strong>Cdigo</strong></th> "
                + "<th align=center><strong>Fornecedor</strong></th> "
                + "<th align=center><strong>Data</strong></th> "
                + "<th align=center><strong>Total</strong></th> "
                + "<th align=center><strong>Entrada</strong></th> "
                + "<th align=center><strong>Parcelas</strong></th> " + "</tr> ";

        frase += "<tr align=center><td>" + v.getConCodigo() + "</td><td>"
                + v.getFornecedor().getForNomeEmpresa() + "</td><td>" + v.getConData() + "</td><td>"
                + v.getConValorTotal() + "</td><td>" + v.getConEntrada() + "</td><td>" + v.getConNparcelas()
                + "</td></tr>" + "</table>";

        frase += "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<br/><br/>" + "<tr> "
                + "<th align=center><strong>Parcela</strong></th> "
                + "<th align=center><strong>Data</strong></th> "
                + "<th align=center><strong>Valor</strong></th> "
                + "<th align=center><strong>Situao</strong></th> " + "</tr> ";

        for (ContaAPrazoBEAN vap : cCap.listarALL()) {
            if (vap.getConta().getConCodigo() == v.getConCodigo()) {
                frase += "<tr align=center><td>" + vap.getCapNumParcela() + "</td><td>" + vap.getCapData()
                        + "</td><td>" + vap.getCapValorParcela() + "</td><td>" + vap.getCapSituacao()
                        + "</td></tr>";
            }
        }
        frase += "</table>";
        frase += "</body></html>";
        htmlWorker.parse(new StringReader(frase));
        document.close();
        if (Desktop.isDesktopSupported()) {
            try {
                Desktop.getDesktop().open(new File(path));
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Modelo.RelatoriosBEAN.java

public static void notaDeCompra(NotaDecompraBEAN n) throws FileNotFoundException, DocumentException {
    String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf";
    Document document = new Document(PageSize.A4.rotate());
    PdfWriter.getInstance(document, new FileOutputStream(path));
    document.open();/*from  w ww  .  j a  v a2 s.c o m*/
    document.addAuthor("TechSales");
    document.addCreator("TechSales");
    document.addSubject("TechSales - Sistema de gerenciamento de locadoras");
    document.addCreationDate();
    document.addTitle("TechSales");

    HTMLWorker htmlWorker = new HTMLWorker(document);

    String frase;
    try {
        frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<br/>"
                + "<h1 align=center>Relatrio de Jogos Comprados </h1>" + "<br/><br/>"
                + "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<tr> "
                + "<th align=center><strong>Cdigo</strong></th> "
                + "<th align=center><strong>Custo Unitrio</strong></th> "
                + "<th align=center><strong>Data</strong></th> "
                + "<th align=center><strong>Valor da Entrada</strong></th> "
                + "<th align=center><strong>Nmero de parcelas</strong></th> "
                + "<th align=center><strong>Preo Total</strong></th> "
                + "<th align=center><strong>Quantidade Compradra</strong></th> "
                + "<th align=center><strong>Caixa</strong></th> "
                + "<th align=center><strong>Jogo</strong></th> " + "</tr> ";

        frase += "<tr align=center><td>" + n.getNdcCodigo() + "</td><td>" + n.getNdcCustoUnitario()
                + "</td><td>" + n.getNdcData() + "</td><td>" + n.getNdcEntrada() + "</td><td>"
                + n.getNdcParcelas() + "</td><td>" + n.getNdcPrecoTotal() + "</td><td>" + n.getNdcQtdComprada()
                + "</td><td>" + n.getCaixa().getCaixaCodigo() + "</td><td>" + n.getJogo().getJoNome()
                + "</td></tr>" + "</table>";
        ;

        frase += "<table BORDER RULES=rows border=0 style=\"  width:100%; \">\n" + "<br/><br/>" + "<tr> "
                + "<th align=center><strong>Parcela</strong></th> "
                + "<th align=center><strong>Data</strong></th> "
                + "<th align=center><strong>Valor</strong></th> "
                + "<th align=center><strong>Situao</strong></th> " + "</tr> ";

        for (NotaDeCompraPrazoBEAN nap : cNdcap.listarALL()) {
            if (nap.getNota().getNdcCodigo() == n.getNdcCodigo()) {
                frase += "<tr align=center><td>" + nap.getNapNumParcela() + "</td><td>" + nap.getNapData()
                        + "</td><td>" + nap.getNapValor() + "</td><td>" + nap.getNapSituacao() + "</td></tr>";
            }
        }

        frase += "</table>";
        frase += "</body></html>";
        htmlWorker.parse(new StringReader(frase));
        document.close();
        if (Desktop.isDesktopSupported()) {
            try {
                Desktop.getDesktop().open(new File(path));
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:negotiation.Contract.FormContractPdf.java

public static void addMetaData(Document document) {
    document.addTitle("FitSM Module");
    document.addSubject("Using iText");
    document.addKeywords("Java, PDF, iText, FitSM");
    document.addAuthor("Zeqian Meng");
    document.addCreator("Zeqian Meng");
}

From source file:net.FilterLogic.imaging.ToPDF.java

License:Apache License

/**
 * Iterate through properties and set each value for PDF document.
 *//*  w  ww. j  a v  a2 s  .  c o  m*/
private void setDocumentProperties(Document pdf) {

    for (Enumeration e = this.documentProperties.keys(); e.hasMoreElements();) {
        String name = e.nextElement().toString().toUpperCase();
        String value = this.documentProperties.getProperty(name);

        if (name.equals("TITLE"))
            pdf.addTitle(value);

        if (name.equals("AUTHOR"))
            pdf.addAuthor(value);

        //            if(name.equals("CREATOR"))
        //                pdf.addCreator(value);

        if (name.equals("CREATIONDATE"))
            pdf.addCreationDate();

        if (name.equals("SUBJECT"))
            pdf.addSubject(value);

        if (name.equals("KEYWORDS"))
            pdf.addKeywords(value);
    }

}