<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package generadorPDF;

import Datos.Resolucion;
import Datos.Socio;
import java.io.FileOutputStream;
import java.util.Date;


import com.itextpdf.text.Anchor;
import com.itextpdf.text.BadElementException;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Chapter;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.List;
import com.itextpdf.text.ListItem;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Section;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;

/**
 *
 * @author Gonzalo
 */
public class generarPDF {
    
  private static String FILE;
  private static Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 18,
      Font.BOLD);
  private static Font redFont = new Font(Font.FontFamily.TIMES_ROMAN, 12,
      Font.NORMAL, BaseColor.RED);
  private static Font subFont = new Font(Font.FontFamily.TIMES_ROMAN, 16,
      Font.BOLD);
  private static Font smallBold = new Font(Font.FontFamily.TIMES_ROMAN, 12,
      Font.BOLD);

    /**
     * @return the FILE
     */
    public static String getFILE() {
        return FILE;
    }

    /**
     * @param aFILE the FILE to set
     */
    public static void setFILE(String aFILE) {
        FILE = aFILE;
    }
  

 public void generarPDF_Resolucion(Socio sociox, Resolucion res,int tipo_resolucion){
      try {
          //generar nombre
          FILE = "C:\\CPI\\Resoluciones\\";
          switch(tipo_resolucion){
                case 1:
                    FILE=FILE.concat("Aceptacion\\filename.pdf");
                break;
                case 2:
                    FILE=FILE.concat("Expulsion\\filename.pdf");
                break;
                case 3:
                    FILE=FILE.concat("Renuncia\\filename.pdf");
                break;
                case 4:
                    FILE=FILE.concat("Suspension\\filename.pdf");
                break;    
                
        }
          
      Document document = new Document();
      PdfWriter.getInstance(document, new FileOutputStream(getFILE()));
      document.open();
        addMetaData(document);
        addTitlePage(document);
        addContent(document,sociox,res);
      document.close();
        //Leer un Archivo
        ProcessBuilder p = new ProcessBuilder();
        p.command("cmd.exe","/c",FILE);
        p.start();
    } catch (Exception e) {
      e.printStackTrace();
    }
 }
  
  // iText allows to add metadata to the PDF which can be viewed in your Adobe
  // Reader
  // under File -> Properties
  private static void addMetaData(Document document) {
    document.addTitle("My first PDF");
    document.addSubject("Using iText");
    document.addKeywords("Java, PDF, iText");<commit_msg>agregar numero de resolucion al nombre del pdf<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package generadorPDF;

import Datos.Resolucion;
import Datos.Socio;
import java.io.FileOutputStream;
import java.util.Date;


import com.itextpdf.text.Anchor;
import com.itextpdf.text.BadElementException;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Chapter;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.List;
import com.itextpdf.text.ListItem;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Section;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;

/**
 *
 * @author Gonzalo
 */
public class generarPDF {
    
  private static String FILE;
  private static Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 18,
      Font.BOLD);
  private static Font redFont = new Font(Font.FontFamily.TIMES_ROMAN, 12,
      Font.NORMAL, BaseColor.RED);
  private static Font subFont = new Font(Font.FontFamily.TIMES_ROMAN, 16,
      Font.BOLD);
  private static Font smallBold = new Font(Font.FontFamily.TIMES_ROMAN, 12,
      Font.BOLD);

    /**
     * @return the FILE
     */
    public static String getFILE() {
        return FILE;
    }

    /**
     * @param aFILE the FILE to set
     */
    public static void setFILE(String aFILE) {
        FILE = aFILE;
    }
  

 public void generarPDF_Resolucion(Socio sociox, Resolucion res,int tipo_resolucion){
      try {
          //generar nombre
          FILE = "C:\\CPI\\Resoluciones\\";
          switch(tipo_resolucion){
                case 1:
                    FILE=FILE.concat("Aceptacion\\"+res.getNumero_resolucion()+".pdf");
                break;
                case 2:
                    FILE=FILE.concat("Expulsion\\"+res.getNumero_resolucion()+".pdf");
                break;
                case 3:
                    FILE=FILE.concat("Renuncia\\"+res.getNumero_resolucion()+".pdf");
                break;
                case 4:
                    FILE=FILE.concat("Suspension\\"+res.getNumero_resolucion()+".pdf");
                break;    
                
        }
          
      Document document = new Document();
      PdfWriter.getInstance(document, new FileOutputStream(getFILE()));
      document.open();
        addMetaData(document);
        addTitlePage(document);
        addContent(document,sociox,res);
      document.close();
        //Leer un Archivo
        ProcessBuilder p = new ProcessBuilder();
        p.command("cmd.exe","/c",FILE);
        p.start();
    } catch (Exception e) {
      e.printStackTrace();
    }
 }
  
  // iText allows to add metadata to the PDF which can be viewed in your Adobe
  // Reader
  // under File -> Properties
  private static void addMetaData(Document document) {
    document.addTitle("My first PDF");
    document.addSubject("Using iText");
    document.addKeywords("Java, PDF, iText");
{'fraction_non_alphanumeric': 0.10961507999366386, 'fraction_numerical': 0.0038016790749247583, 'mean_word_length': 2.4845474613686536, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4874318', 'n_tokens_mistral': 1975, 'n_tokens_neox': 1900, 'n_words': 444}