Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package probando;
  2.  
  3. import java.io.FileOutputStream;
  4. import java.io.IOException;
  5. import java.util.ArrayList;
  6.  
  7. import com.itextpdf.text.Document;
  8. import com.itextpdf.text.DocumentException;
  9. import com.itextpdf.text.Paragraph;
  10. import com.itextpdf.text.pdf.PdfWriter;
  11.  
  12. public class lista {
  13.  
  14. public static void main(String[] args) {
  15. // TODO Auto-generated method stub
  16. ArrayList<String> persona = new ArrayList();
  17. String[] gente = {"nombre", "apellido", "cedula"};
  18. persona.add("jose almanzar 123456");
  19. persona.add("maria");
  20. persona.add("andres");
  21. Document documento = new Document();
  22. try{
  23. PdfWriter.getInstance(documento, new FileOutputStream("archivo.pdf"));
  24. documento.open();
  25. for (int i = 0; i < persona.size(); i++) {
  26.  
  27. documento.add(new Paragraph(persona.get(i)));
  28. }
  29.  
  30. }
  31. catch (DocumentException de) {
  32. System.err.println(de.getMessage());
  33. } catch (IOException ioe) {
  34. System.err.println(ioe.getMessage());
  35. }
  36. documento.close();
  37.  
  38.  
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement