Package net.sf.latexdraw.util.LSystem

Examples of net.sf.latexdraw.util.LSystem.OperatingSystem


    File finalPS;
    final IPoint tr    = synchronizer.getTopRightDrawingPoint();
    final IPoint bl    = synchronizer.getBottomLeftDrawingPoint();
    final int ppc      = synchronizer.getPPCDrawing();
    final float dec    = 0.2f;
    final OperatingSystem os = LSystem.INSTANCE.getSystem();

    if(texFile==null || !texFile.exists())
      return null;

    final String[] paramsLatex = {os.getLatexBinPath(), "--interaction=nonstopmode", "--output-directory=" + tmpDir2.getAbsolutePath(),//$NON-NLS-1$//$NON-NLS-2$
        texFile.getAbsolutePath()};
    log    = LSystem.INSTANCE.execute(paramsLatex, tmpDir2);
    final File dviFile = new File(tmpDir2.getAbsolutePath() + LResources.FILE_SEP + name + ".dvi"); //$NON-NLS-1$
    final boolean dviRenamed = dviFile.renameTo(new File(tmpDir2.getAbsolutePath() + LResources.FILE_SEP + name));

    final String[] paramsDvi = {os.getDvipsBinPath(), "-Pdownload35", "-T", //$NON-NLS-1$ //$NON-NLS-2$
        (tr.getX()-bl.getX())/ppc*scale+dec+"cm,"+((bl.getY()-tr.getY())/ppc*scale+dec)+"cm", //$NON-NLS-1$ //$NON-NLS-2$
            name, "-o", pathExportPs}; //$NON-NLS-1$
    log   += LSystem.INSTANCE.execute(paramsDvi, tmpDir2);

    texFile.delete();
View Full Code Here


    final String name = pathExportPdf.substring(pathExportPdf.lastIndexOf(LResources.FILE_SEP)+1, pathExportPdf.lastIndexOf(PDFFilter.PDF_EXTENSION));
    final File psFile = createPSFile(drawing, tmpDir.getAbsolutePath() + LResources.FILE_SEP + name + ".ps", synchronizer, tmpDir, pstGen); //$NON-NLS-1$
    String log;
    File pdfFile;
    final OperatingSystem os = LSystem.INSTANCE.getSystem();

    if(psFile==null)
      return null;

    // On windows, an option must be defined using this format:
    // -optionName#valueOption Thus, the classical = character must be replaced by a # when latexdraw runs on Windows.
    final String optionEmbed = "-dEmbedAllFonts" + (LSystem.INSTANCE.isWindows() ? "#" : "=") + "true"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

    log = LSystem.INSTANCE.execute(new String[] {os.getPs2pdfBinPath(), optionEmbed, psFile.getAbsolutePath(),
              crop ? name + PDFFilter.PDF_EXTENSION : pathExportPdf}, tmpDir);

    if(crop) {
      pdfFile = new File(tmpDir.getAbsolutePath() + LResources.FILE_SEP + name + PDFFilter.PDF_EXTENSION);
      log   = LSystem.INSTANCE.execute(new String[] {os.getPdfcropBinPath(), pdfFile.getAbsolutePath(), pdfFile.getAbsolutePath()}, tmpDir);
      // JAVA7: test pdfFile.toPath().move(pathExportPdf)
      // the renameto method is weak and fails sometimes.
      if(!pdfFile.renameTo(new File(pathExportPdf)) && !LFileUtils.INSTANCE.copy(pdfFile, new File(pathExportPdf)))
        log += " The final pdf document cannot be moved to its final destination. If you use Windows, you must have a Perl interpretor installed, such as strawberryPerl (http://strawberryperl.com/)"; //$NON-NLS-1$
      pdfFile.delete();
View Full Code Here

TOP

Related Classes of net.sf.latexdraw.util.LSystem.OperatingSystem

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.