All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.openhtmltopdf.util.GenerateBigFile Maven / Gradle / Ivy

package com.openhtmltopdf.util;

import java.io.FileOutputStream;
import java.io.PrintWriter;

/**
 * Created by IntelliJ IDEA.
 * User: tobe
 * Date: 2005-jan-05
 * Time: 09:21:10
 * To change this template use File | Settings | File Templates.
 */
public class GenerateBigFile {
    public static void main(String[] args) {
        if (args.length < 1) {
            System.out.println("Usage:");
            System.out.println("GenerateBigFile output-file");
            System.exit(1);
        }
        PrintWriter out = null;
        try {
            out = new PrintWriter(new FileOutputStream(args[0]));
            out.println("Big test file");
            for (int i = 0; i < 10000; i++) {
                //style: 10pt Times #000000;
                String[] styles = {"10pt", "12pt", "14pt", "18pt", "24pt"};
                String[] fonts = {"Times", "Helvetica", "Courier"};
                String style = styles[(int) Math.floor(Math.random() * styles.length)];
                String font = fonts[(int) Math.floor(Math.random() * fonts.length)];
                String colour = Integer.toHexString((int) Math.floor(Math.random() * 256)) + Integer.toHexString((int) Math.floor(Math.random() * 256)) + Integer.toHexString((int) Math.floor(Math.random() * 256));
                out.println("

Some Styled text to see how we can handle it

"); } out.println(""); } catch (Exception e) {//I know, never do this :-) e.printStackTrace(); } finally { out.close(); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy