Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfContentByte.saveState()


            cb.setTextMatrix(document.right() - textSize - adjust, textBase);
            cb.showText(text);
            cb.endText();
            cb.addTemplate(tpl, document.right() - adjust, textBase);
        }
        cb.saveState();
        // draw a LwgRectangle around the page
        cb.setColorStroke(Color.orange);
        cb.setLineWidth(2);
        cb.rectangle(20, 20, document.getPageSize().getWidth() - 40, document.getPageSize().getHeight() - 40);
        cb.stroke();
View Full Code Here


      // step 4: we grab the ContentByte and do some stuff with it
      PdfContentByte cb = writer.getDirectContent();

      cb.circle(260.0f, 500.0f, 250.0f);
      cb.fill();
      cb.saveState();
      cb.setColorFill(Color.red);
      cb.circle(260.0f, 500.0f, 200.0f);
      cb.fill();
      cb.saveState();
      cb.setColorFill(Color.blue);
View Full Code Here

      cb.fill();
      cb.saveState();
      cb.setColorFill(Color.red);
      cb.circle(260.0f, 500.0f, 200.0f);
      cb.fill();
      cb.saveState();
      cb.setColorFill(Color.blue);
      cb.circle(260.0f, 500.0f, 150.0f);
      cb.fill();
      cb.restoreState();
      cb.circle(260.0f, 500.0f, 100.0f);
View Full Code Here

  }
 
  public void writeTextAt(float x, float y, String text, Font font) {
   
      PdfContentByte cb = pdfWriter.getDirectContent();
      cb.saveState();
      cb.setFontAndSize(font.getBaseFont(), font.getSize());
      cb.beginText();
      cb.setTextMatrix(x , y);
      cb.showText(text);
      cb.endText();
View Full Code Here

    String textPageOfPage = String.format(pageOfPage, writer.getPageNumber());   
    float textBase = 18;
    float textSize = helv.getWidthPoint(textPageOfPage, fontSize);
    float adjust = helv.getWidthPoint("0", fontSize);
    cb.addTemplate(total, document.right() - adjust, textBase);
    cb.saveState();
    cb.beginText();
    cb.setFontAndSize(helv, fontSize);

    cb.setTextMatrix(document.right() - textSize - adjust*2 , textBase);
    cb.showText(textPageOfPage);
View Full Code Here

            }
            catch (IOException e)
            {
            }
            PdfContentByte cb = writer.getDirectContent();
            cb.saveState();
            // write the headertable
            table.setTotalWidth(document.right() - document.left());
            table.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight() - 50, cb);
            // compose the footer
            String text = "Page " + writer.getPageNumber();
View Full Code Here

            float adjust = helv.getWidthPoint("0", 12);
            cb.setTextMatrix(document.right() - textSize - adjust, textBase);
            cb.showText(text);
            cb.endText();
            cb.addTemplate(tpl, document.right() - adjust, textBase);
            cb.saveState();
        }
    }
}
View Full Code Here

                              .sin(winkel)
                              * fontsize / 2);
        float yoff = (float) (Math.sin(winkel) * txtwidth / 2 - Math
                              .cos(winkel)
                              * fontsize / 2);
        seitex.saveState();
        seitex.setGState(gs1);
        seitex.beginText();
        seitex.setFontAndSize(bf, fontsize);
        seitex.setTextMatrix(m1, m2, m3, m4, xoff + recc.width() / 2,
                             yoff + recc.height() / 2);
View Full Code Here

            }
            catch (Exception e) {
                Log.error("error drawing PDF footer: " + e.getMessage());
            }
            cb.saveState();

        }
    }
}
View Full Code Here

     * @see com.lowagie.text.pdf.PdfPageEventHelper#onEndPage(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document)
     */
    @Override
    public void onEndPage(PdfWriter writer, Document document) {
        PdfContentByte cb = writer.getDirectContent();
        cb.saveState();
        // write the headertable
        if (writer.getPageNumber() != 2) {
            headerTable.setTotalWidth(document.getPageSize().width() - 60);
            headerTable.writeSelectedRows(0, -1, 30, document.getPageSize().top() - 30, cb);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.