Package org.apache.pdfbox.preflight.parser

Examples of org.apache.pdfbox.preflight.parser.PreflightParser


        // Configure Log4J library, used by Preflight library.
        System.setProperty(
            "log4j.configuration", "net/sf/libpdfsign/Log4j.properties");

        // Parse the document.
        PreflightParser parser = new PreflightParser(documentFileName);
        parser.parse();
        PreflightDocument document = parser.getPreflightDocument();

        // Validate the document.
        ValidationResult result = null;
        try {
            document.validate();
View Full Code Here


        System.out.println("Version : " + version);
    }

    private static int runSimple (DataSource fd) throws Exception {
        ValidationResult result = null;
        PreflightParser parser = new PreflightParser(fd);
        try
        {
            parser.parse();
            PreflightDocument document = parser.getPreflightDocument();
            document.validate();
            result = document.getResult();
            document.close();
        }
        catch (SyntaxValidationException e)
View Full Code Here

        }
        PreflightDocument document = null;
        try
        {
            FileDataSource bds = new FileDataSource(path);
            PreflightParser parser = new PreflightParser(bds);
            parser.parse();
            document = parser.getPreflightDocument();
            document.validate();

            ValidationResult result = document.getResult();
            Assert.assertFalse(path + " : Isartor file should be invalid (" + path + ")", result.isValid());
            Assert.assertTrue(path + " : Should find at least one error", result.getErrorsList().size() > 0);
View Full Code Here

        {
            InputStream input = new FileInputStream(file);
            ValidationResult result;
            try
            {
                PreflightParser parser = new PreflightParser(new ByteArrayDataSource(input));
                parser.parse();
                document = (PreflightDocument) parser.getPDDocument();
                // to speeds up tests, skip validation of page count is over the limit
                if (document.getNumberOfPages() < 8191)
                {
                    document.validate();
                }
View Full Code Here

        System.out.println(target);
        ValidationResult result = null;
        try
        {
            PreflightParser parser = new PreflightParser(new FileDataSource(target));
            parser.parse();
            document = (PreflightDocument) parser.getPDDocument();
            document.validate();
            result = document.getResult();
        }
        catch (SyntaxValidationException e)
        {
View Full Code Here

        PreflightDocument document = null;
        System.out.println(target);
        ValidationResult result = null;
        try
        {
            PreflightParser parser = new PreflightParser(new FileDataSource(target));
            parser.parse();
            document = (PreflightDocument) parser.getPDDocument();
            document.validate();
            result = document.getResult();
        }
        catch (SyntaxValidationException e)
        {
View Full Code Here

        }
        PreflightDocument document = null;
        try
        {
            FileDataSource bds = new FileDataSource(path);
            PreflightParser parser = new PreflightParser(bds);
            parser.parse();
            document = parser.getPreflightDocument();
            document.validate();

            ValidationResult result = document.getResult();
            Assert.assertFalse(path + " : Isartor file should be invalid (" + path + ")", result.isValid());
            Assert.assertTrue(path + " : Should find at least one error", result.getErrorsList().size() > 0);
View Full Code Here

        System.out.println(target);
        ValidationResult result = null;
        try
        {
            PreflightParser parser = new PreflightParser(new FileDataSource(target));
            parser.parse();
            document = (PreflightDocument) parser.getPDDocument();
            document.validate();
            result = document.getResult();
        }
        catch (SyntaxValidationException e)
        {
View Full Code Here

        PreflightDocument document = null;
        System.out.println(target);
        ValidationResult result = null;
        try
        {
            PreflightParser parser = new PreflightParser(new FileDataSource(target));
            parser.parse();
            document = (PreflightDocument) parser.getPDDocument();
            document.validate();
            result = document.getResult();
        }
        catch (SyntaxValidationException e)
        {
View Full Code Here

        int size = lfd.size();
        for (int i = 0; i < loop; i++)
        {
            File file = lfd.get(i % size);
            long startLTime = System.currentTimeMillis();
            PreflightParser parser = new PreflightParser(new FileDataSource(file));
            parser.parse();
            PreflightDocument document = parser.getPreflightDocument();
            document.validate();
            ValidationResult result = document.getResult();
            if (!result.isValid())
            {
                resFile.write(file.getAbsolutePath() + " isn't PDF/A\n");
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.preflight.parser.PreflightParser

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.