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

org.xhtmlrenderer.util.GenerateBigFile Maven / Gradle / Ivy

Go to download

Flying Saucer is a CSS 2.1 renderer written in Java. This artifact contains the core rendering and layout code as well as Java2D output.

There is a newer version: 9.11.0
Show newest version
package org.xhtmlrenderer.util;

import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Paths;

import static java.nio.file.Files.newOutputStream;

/**
 * User: tobe
 * Date: 2005-jan-05
 */
public class GenerateBigFile {
    public static void main(String[] args) throws IOException {
        if (args.length < 1) {
            System.out.println("Usage:");
            System.out.println("GenerateBigFile output-file");
            System.exit(1);
        }
        try (PrintWriter out = new PrintWriter(newOutputStream(Paths.get(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(""); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy