PdfPCell cell = new PdfPCell(); cell.setCellEvent(new JFreeChartEvent(getChart()); cell.setFixedHeight(300.f); //height must be set if its row's height is not defined yet
private void addCell_WithPushButtonField( PdfPTable table, PdfWriter writer, PdfPCell cell, String strfldName, String jsAction ) { cell.setCellEvent( new PdfFieldCell( null, jsAction, "BTN_SAVEPDF", "Save PDF", PdfFieldCell.TYPE_BUTTON, writer ) ); table.addCell( cell ); }
public PdfPCell getCell(String content, String title) { PdfPCell cell = new PdfPCell(new Phrase(content)); cell.setCellEvent(new Title(title)); cell.setPadding(5); return cell; }
PdfPCellEvent press = new PressPreview(); PdfPCell cell = new PdfPCell(); cell.setCellEvent(press);
lImageBoucle = Image.getInstance(lFile.getCanonicalPath() + File.separator + lTabPhotos[i]); PdfPCell lCell = new PdfPCell(); lCell.setImage(lImageBoucle); lCell.setBorder(Rectangle.NO_BORDER); lCell.setPadding(8); PdfPCellEvent lShadowRectangle = new ShadowRectangle(); lCell.setCellEvent(lShadowRectangle); lImages.addCell(lCell);
@SuppressWarnings( "unused" ) private void addCell_WithRadioButton( PdfPTable table, PdfWriter writer, PdfPCell cell, String strfldName ) { PdfFormField radiogroupField = PdfFormField.createRadioButton( writer, true ); radiogroupField.setFieldName( strfldName ); cell.setCellEvent( new PdfFieldCell( radiogroupField, new String[]{ "Yes", "No", "null" }, new String[]{ "true", "false", "" }, "", 30.0f, PdfDataEntryFormUtil.UNITSIZE_DEFAULT, PdfFieldCell.TYPE_RADIOBUTTON, writer ) ); table.addCell( cell ); writer.addAnnotation( radiogroupField ); }
public void createPdf(String dest) throws IOException, DocumentException { Rectangle pagesize = PageSize.LETTER; Document document = new Document(pagesize); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest)); document.open(); PdfPTable table = new PdfPTable(2); PdfPCell cell; //Add rows with selectors PdfFormField selectGroup = PdfFormField.createEmpty(writer); selectGroup.setFieldName("myCombos"); String[] options = {"Choose first option", "Choose second option", "Choose third option"}; String[] exports = {"option1", "option2", "option3"}; table.addCell("Combobox:"); cell = new PdfPCell(); cell.setCellEvent(new SelectCellEvent(selectGroup, "combo1", exports, options)); cell.setMinimumHeight(20); table.addCell(cell); document.add(table); writer.addAnnotation(selectGroup); document.close(); }
tmp.cloneNonPositionParameters(rowAttributes); tmp.softCloneNonPositionParameters(this); cell.setCellEvent(tmp); cell.setHorizontalAlignment(rowAttributes.horizontalAlignment); cell.setVerticalAlignment(rowAttributes.verticalAlignment);
tmp.cloneNonPositionParameters(rowAttributes); tmp.softCloneNonPositionParameters(this); cell.setCellEvent(tmp); cell.setHorizontalAlignment(rowAttributes.horizontalAlignment); cell.setVerticalAlignment(rowAttributes.verticalAlignment);
tmp.cloneNonPositionParameters(rowAttributes); tmp.softCloneNonPositionParameters(this); cell.setCellEvent(tmp); cell.setHorizontalAlignment(rowAttributes.horizontalAlignment); cell.setVerticalAlignment(rowAttributes.verticalAlignment);
private void addCell_WithCheckBox( PdfPTable table, PdfWriter writer, PdfPCell cell, String strfldName ) throws IOException, DocumentException { float sizeDefault = PdfDataEntryFormUtil.UNITSIZE_DEFAULT; RadioCheckField checkbox = new RadioCheckField( writer, new Rectangle( sizeDefault, sizeDefault ), "Yes", "On" ); checkbox.setBorderWidth( 1 ); checkbox.setBorderColor( Color.BLACK ); PdfFormField checkboxfield = checkbox.getCheckField(); checkboxfield.setFieldName( strfldName + "_" + PdfFieldCell.TPYEDEFINE_NAME + PdfFieldCell.TYPE_CHECKBOX ); setCheckboxAppearance( checkboxfield, writer.getDirectContent(), sizeDefault ); cell.setCellEvent( new PdfFieldCell( checkboxfield, sizeDefault, sizeDefault, PdfFieldCell.TYPE_CHECKBOX, writer ) ); table.addCell( cell ); }
private void addCell_WithDropDownListField( PdfPTable table, Rectangle rect, PdfWriter writer, PdfPCell cell, String strfldName, String[] optionList, String[] valueList ) throws IOException, DocumentException { TextField textList = new TextField( writer, rect, strfldName ); textList.setChoices( optionList ); textList.setChoiceExports( valueList ); textList.setBorderWidth( 1 ); textList.setBorderColor( Color.BLACK ); textList.setBorderStyle( PdfBorderDictionary.STYLE_SOLID ); textList.setBackgroundColor( COLOR_BACKGROUDTEXTBOX ); PdfFormField dropDown = textList.getComboField(); cell.setCellEvent( new PdfFieldCell( dropDown, rect.getWidth(), rect.getHeight(), writer ) ); table.addCell( cell ); }
private void addCell_WithTextField( PdfPTable table, Rectangle rect, PdfWriter writer, PdfPCell cell, String strfldName, int fieldCellType, String value ) throws IOException, DocumentException { TextField nameField = new TextField( writer, rect, strfldName ); nameField.setBorderWidth( 1 ); nameField.setBorderColor( Color.BLACK ); nameField.setBorderStyle( PdfBorderDictionary.STYLE_SOLID ); nameField.setBackgroundColor( COLOR_BACKGROUDTEXTBOX ); nameField.setText( value ); nameField.setAlignment( Element.ALIGN_RIGHT ); nameField.setFont( pdfFormFontSettings.getFont( PdfFormFontSettings.FONTTYPE_BODY ).getBaseFont() ); cell.setCellEvent( new PdfFieldCell( nameField.getTextField(), rect.getWidth(), rect.getHeight(), fieldCellType, writer ) ); table.addCell( cell ); }
c_evt.cloneNonPositionParameters((Cell)cell); c_evt.setSpacing(cellspacing * 2f); pcell.setCellEvent(c_evt);
c_evt.cloneNonPositionParameters((Cell)cell); c_evt.setSpacing(cellspacing * 2f); pcell.setCellEvent(c_evt);
c_evt.cloneNonPositionParameters((Cell)cell); c_evt.setSpacing(cellspacing * 2f); pcell.setCellEvent(c_evt);