Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfWriter


    this.out = out;
    this.monitor = monitor;
    this.maxRecords = maxRecords;
    this.rpt = new Document();

    PdfWriter writer = PdfWriter.getInstance(rpt, out);
    rpt.setMargins(80, 30, 20, 45); // links, rechts, oben, unten

    if (this.monitor != null)
    {
      this.monitor.setStatusText(i18n.tr("Erzeuge Liste"));
      this.monitor.addPercentComplete(1);
    }

    Manifest mf = Application.getPluginLoader().getManifest(HBCI.class);
    rpt.addAuthor(i18n.tr("{0} - Version {1}", mf.getName(), mf.getVersion().toString()));
    rpt.addTitle(subtitle);

    HeaderFooter hf = new HeaderFooter();
    writer.setPageEvent(hf);
    hf.setFooter(i18n.tr("{0} | {1} | erstellt am {2}              Seite:  ", title, subtitle, HBCI.LONGDATEFORMAT.format(new Date())));

    rpt.open();
    try
    {
View Full Code Here


    protected String getFieldType() {
        return FIELD_TYPE;
    }

    public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) {
        PdfWriter writer = outputDevice.getWriter();
       
        String[][] options = getPDFOptions();
        int selectedIndex = getSelectedIndex();
       
        PdfFormField field;
       
        /*
         * Comment out for now.  We need to draw an appropriate appearance for
         * this to work correctly.
         */
        /*
        if (isMultiple(box.getElement())) {
            field = PdfFormField.createList(writer, options, selectedIndex); 
        } else {
            field = PdfFormField.createCombo(writer, false, options, selectedIndex);   
        }
        */
       
        field = PdfFormField.createCombo(writer, false, options, selectedIndex);   
       
        field.setWidget(outputDevice.createLocalTargetArea(c, box), PdfAnnotation.HIGHLIGHT_INVERT);
        field.setFieldName(getFieldName(outputDevice, box.getElement()));
        if (options.length > 0) {
            field.setValueAsString(options[selectedIndex][0]);
        }
       
        createAppearance(c, outputDevice, box, field);

        if (isReadOnly(box.getElement())) {
            field.setFieldFlags(PdfFormField.FF_READ_ONLY);
        }      
       
        /*
        if (isMultiple(box.getElement())) {
            field.setFieldFlags(PdfFormField.FF_MULTISELECT);
        }
        */
       
        writer.addAnnotation(field);
    }
View Full Code Here

    }
   
    private void createAppearance(
            RenderingContext c, ITextOutputDevice outputDevice,
            BlockBox box, PdfFormField field) {
        PdfWriter writer = outputDevice.getWriter();
        ITextFSFont font = (ITextFSFont)box.getStyle().getFSFont(c);
       
        PdfContentByte cb = writer.getDirectContent();
       
        float width = outputDevice.getDeviceLength(getWidth());
        float height = outputDevice.getDeviceLength(getHeight());
        float fontSize = outputDevice.getDeviceLength(font.getSize2D());
       
View Full Code Here

  public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box)
  {
    PdfContentByte cb = outputDevice.getCurrentPage();

    PdfWriter writer = outputDevice.getWriter();

    PdfAcroForm acroForm = writer.getAcroForm();
    Element elem = box.getElement();
    String name = getFieldName(outputDevice, elem);
    String value = getValue(elem);
    acroForm.addHiddenField(name, value);
View Full Code Here

            // Already added to document
            return;
        }
       
        PdfContentByte cb = outputDevice.getCurrentPage();
        PdfWriter writer = outputDevice.getWriter();
       
        PdfFormField group = PdfFormField.createRadioButton(writer, true);
        group.setFieldName(fieldName);
       
        RadioButtonFormField checked = getChecked(radioBoxes);
        if (checked != null) {
            group.setValueAsString(getValue(checked.getBox().getElement()));
        }
       
        for (Iterator i = radioBoxes.iterator(); i.hasNext(); ) {
            RadioButtonFormField fieldElem = (RadioButtonFormField)i.next();
           
            createField(c, outputDevice, cb, writer, group, fieldElem, checked);           
        }
       
        writer.addAnnotation(group);
       
        _factory.remove(fieldName);
    }
View Full Code Here

      // Convierte el c�digo XHTML a PDF
      Document document = new Document();
      InputStream stream = new ByteArrayInputStream(xhtml.getBytes());

      PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(fileNamePath));
      document.open();
      XMLWorkerHelper.getInstance().parseXHtml(writer, document, stream);
      document.close();

      // Construye la URL de acceso al informe PDF generado
View Full Code Here

   
    private static byte[] createPdfWithArrayText(String directContentTj) throws Exception{
        final ByteArrayOutputStream byteStream = new ByteArrayOutputStream();

        final Document document = new Document();
        PdfWriter writer = PdfWriter.getInstance(document, byteStream);
        document.setPageSize(PageSize.LETTER);

        document.open();

        PdfContentByte cb = writer.getDirectContent();

        BaseFont font = BaseFont.createFont();
       
        cb.transform(AffineTransform.getTranslateInstance(100, 500));
        cb.beginText();
View Full Code Here

   
    private static byte[] createPdfWithArrayText(String text1, String text2, int spaceInPoints) throws Exception{
        final ByteArrayOutputStream byteStream = new ByteArrayOutputStream();

        final Document document = new Document();
        PdfWriter writer = PdfWriter.getInstance(document, byteStream);
        document.setPageSize(PageSize.LETTER);

        document.open();

        PdfContentByte cb = writer.getDirectContent();

        BaseFont font = BaseFont.createFont();
       
       
        cb.beginText();
View Full Code Here

    private static byte[] createPdfWithRotatedText(String text1, String text2, float rotation, boolean moveTextToNextLine, float moveTextDelta) throws Exception {

        final ByteArrayOutputStream byteStream = new ByteArrayOutputStream();

        final Document document = new Document();
        PdfWriter writer = PdfWriter.getInstance(document, byteStream);
        document.setPageSize(PageSize.LETTER);

        document.open();

        PdfContentByte cb = writer.getDirectContent();

        BaseFont font = BaseFont.createFont();

        float x = document.getPageSize().getWidth()/2;
        float y = document.getPageSize().getHeight()/2;
View Full Code Here

      Charset cCharset = IText.getCharset(charset);

      Document document = new Document();
      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
      PdfWriter writer = PdfWriter.getInstance(document, outputStream);

      if (margin != null) {
        float f = this.getMargin(margin);
        writer.setMargins(f, f, f, f);
      } else {
        writer.setMargins(this.getMargin(marginLeft), this.getMargin(marginRight), this.getMargin(marginTop), this.getMargin(marginBottom));
      }

      document.open();

      XMLWorkerHelper workerHelper = XMLWorkerHelper.getInstance();
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.PdfWriter

Copyright © 2018 www.massapicom. 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.