예제 #1
0
  public void latex2pdf_oneData() {
    File Directory = new File(System.getProperty("user.dir").replace("\\", "/") + "/latexTemplate");
    File template = new File(Directory.getAbsolutePath() + File.separator + "oneDataSet.tex");
    File texfile = new File(Directory.getAbsolutePath() + File.separator + this.dataname + ".tex");

    try {

      HashMap<String, String> data = new HashMap<String, String>();
      data.put("oneDataSet", this.Latex);
      JLRConverter converter = new JLRConverter("::", ":::");
      if (!converter.parse(template, texfile, data)) {
        System.out.println(converter.getErrorMessage());
      }
      JLRGenerator pdfGen = new JLRGenerator();
      pdfGen.deleteTempTexFile(true);
      if (!pdfGen.generate(texfile, Directory, Directory)) {
        System.out.println(pdfGen.getErrorMessage());
      }
      copyFile(
          Directory + File.separator + this.dataname + ".pdf",
          this.savePath + this.dataname + ".pdf");
      new File(Directory + File.separator + this.dataname + ".pdf").delete();
      new File(Directory + File.separator + this.dataname + ".spl").delete();

    } catch (IOException ex) {
      System.err.println(ex.getMessage());
    }
  }
예제 #2
0
  public void latex2pdf_allindepData() {
    String filename1 = "AllResultsIndep-" + Utils.getCurrentData();
    String filename2 = "AllResultsAll-" + Utils.getCurrentData();
    File Directory = new File(System.getProperty("user.dir").replace("\\", "/") + "/latexTemplate");
    File template1 = new File(Directory.getAbsolutePath() + File.separator + "indepDataSet.tex");
    File texfile1 = new File(Directory.getAbsolutePath() + File.separator + filename1 + ".tex");
    File template2 = new File(Directory.getAbsolutePath() + File.separator + "allDataSet.tex");
    File texfile2 = new File(Directory.getAbsolutePath() + File.separator + filename2 + ".tex");

    try {

      HashMap<String, String> data1 = new HashMap<String, String>();
      data1.put("indepDataSet", this.Latex);
      HashMap<String, String> data2 = new HashMap<String, String>();
      data2.put("allDataSet", this.AllLatex);
      JLRConverter converter = new JLRConverter("::", ":::");
      if (!converter.parse(template1, texfile1, data1)) {
        System.out.println(converter.getErrorMessage());
      }
      JLRGenerator pdfGen1 = new JLRGenerator();
      pdfGen1.deleteTempTexFile(true);
      if (!pdfGen1.generate(texfile1, Directory, Directory)) {
        System.out.println(pdfGen1.getErrorMessage());
      }
      copyFile(Directory + File.separator + filename1 + ".pdf", this.savePath + filename1 + ".pdf");
      new File(Directory + File.separator + filename1 + ".pdf").delete();
      new File(Directory + File.separator + filename1 + ".spl").delete();

      if (!converter.parse(template2, texfile2, data2)) {
        System.out.println(converter.getErrorMessage());
      }
      JLRGenerator pdfGen2 = new JLRGenerator();
      pdfGen2.deleteTempTexFile(true);
      if (!pdfGen2.generate(texfile2, Directory, Directory)) {
        System.out.println(pdfGen2.getErrorMessage());
      }
      copyFile(Directory + File.separator + filename2 + ".pdf", this.savePath + filename2 + ".pdf");
      new File(Directory + File.separator + filename2 + ".pdf").delete();
      new File(Directory + File.separator + filename2 + ".spl").delete();

    } catch (IOException ex) {
      System.err.println(ex.getMessage());
    }
  }