Sha256: d7bcccfbbfab0b978e1c66e6c8b14a50c78685db8cb232c9d2730adaf901a3ed

Contents?: true

Size: 1.39 KB

Versions: 22

Compression:

Stored size: 1.39 KB

Contents

// For compile javac -cp pd4ml.jar Pd4Ruby.java
import java.awt.Dimension;
import java.awt.Insets;
import java.lang.reflect.Field;
import java.net.URL;

import org.zefer.pd4ml.PD4Constants;
import org.zefer.pd4ml.PD4ML;

public class Pd4Ruby {

  public static void main(String[] args) throws Exception {

    if ( args.length < 2 ) {
      System.out.println( "Usage: java -Xmx512m Pd4Ruby <url> <htmlWidth> <pageFormat> <landescape> [TTFfontsDir]" );
    }

    Pd4Ruby converter = new Pd4Ruby();
    converter.generatePDF( args[0], args[1], args[2], args[3], args.length > 4 ? args[4] : null ); 
  }

  private void generatePDF(String inputUrl, String htmlWidth, String pageFormat, String landescape, String fontsDir)
  throws Exception {

    PD4ML pd4ml = new PD4ML();
    pd4ml.setPageInsets(new Insets(15, 20, 10, 20)); 

    if (htmlWidth != null) {
      pd4ml.setHtmlWidth(Integer.parseInt(htmlWidth));
    }

    Class c = PD4Constants.class;
    Field f = c.getField( pageFormat );
    Dimension d = (Dimension)f.get( pd4ml );

    if (landescape.equals("true")){
      d = pd4ml.changePageOrientation(d); 
    }

    pd4ml.setPageSize(d); 

    pd4ml.setAuthorName("LipsiaSoft s.r.l."); 

    if ( fontsDir != null && fontsDir.length() > 0 ) {
      pd4ml.useTTF( fontsDir, true );
    }     

    java.io.StringReader reader = new java.io.StringReader(inputUrl);

    pd4ml.render(reader, System.out);
  }
}

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
lipsiadmin-4.1.8 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-3.0 resources/Pd4Ruby.java
lipsiadmin-2.9 resources/Pd4Ruby.java
lipsiadmin-3.1 resources/Pd4Ruby.java
lipsiadmin-3.2 resources/Pd4Ruby.java
lipsiadmin-3.3.1 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-3.3.3 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-3.3.2 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-3.3 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-3.4.0 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-3.3.4 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-3.4.2 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-3.4.1 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-4.1.2 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-4.0.0 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-4.1.0 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-4.1.1 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-4.1.3 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-4.1.4 resources/pd4ml/ruby/Pd4Ruby.java
lipsiadmin-4.1.5 resources/pd4ml/ruby/Pd4Ruby.java