Am 25.02.2015 um 00:04 schrieb Steve Antoch:
We are planning on running a large breadth test on approximately 108,000 pdfs
starting tonight. I will let you know how this test goes. It will take about
4 days to complete.
If possible, it would be nice to test preflight as well. Just use the
code below, plus the preflight-app jar, and the levigo and jai plugins.
It will produce one .txt file in the current directory for every
exception that isn't a ValidationException. Most problems that occur
with rendering will happen with preflight as well, and the test is
faster. 100000 files might be done in 24 hours.
If any exceptions occur, please post them here.
Tilman
package com.mycompany.preflightmasstest;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
import java.io.PrintWriter;
import org.apache.pdfbox.preflight.PreflightDocument;
import org.apache.pdfbox.preflight.exception.ValidationException;
import org.apache.pdfbox.preflight.parser.PreflightParser;
/**
*
* @author Tilman Hausherr
*/
public class PreflightMassTest
{
public static void main(String[] args) throws FileNotFoundException
{
File dir = new File(args[0]);
int total = 0;
int failed = 0;
File[] dirList = dir.listFiles(new FilenameFilter()
{
@Override
public boolean accept(File dir, String name)
{
return name.toLowerCase().endsWith(".pdf");
}
});
for (File pdf : dirList)
{
++total;
System.out.println(pdf.getName());
// just test that it doesn't crash
try
{
new File(pdf.getName() + "-exception.txt").delete();
PreflightParser parser = new PreflightParser(pdf);
parser.parse();
try (PreflightDocument preflightDocument =
parser.getPreflightDocument())
{
preflightDocument.validate();
preflightDocument.getResult();
}
parser.close();
}
catch (ValidationException e)
{
}
catch (Throwable e)
{
++failed;
try (PrintWriter pw = new PrintWriter(new
File(pdf.getName() + "-exception.txt")))
{
e.printStackTrace(pw);
}
System.out.flush();
System.err.flush();
System.err.print(pdf.getName() + " preflight fail: ");
e.printStackTrace();
System.out.flush();
System.err.flush();
}
System.out.println("total: " + total + ", failed: " +
failed + ", percentage failed: " + (((float) failed) / total * 100.0) +
"%");
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]