Skip to content

Get PDF word count and estimated reading time required.

Notifications You must be signed in to change notification settings

ssimunic/pdf-text-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF Text Time

Get PDF word count and estimated reading time required. Assumed reading time is 275 WPM.

Project is using Apache PDFBox.

Example

Usage

Input args

/path/to/file.pdf

Input (compiled as JAR)

java -jar pdf-text-time.jar /path/to/file.pdf

Output

Given PDF has 403 words.
It will take about 0h 1m 27s to read it.

Code

...
    public static void main(String[] args) {
        if (args.length == 0) {
            System.out.println("No file name given.");
            return;
        }

        String fileName = args[0];

        try {
            String text = getText(new File(fileName));
            TextTime textTime = new TextTime(text);

            System.out.println("Given PDF has " + textTime.wordCount() + " words.");
            System.out.println("It will take about " + textTime.readTimeHuman(TimeType.FULL) + " to read it.");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
...

About

Get PDF word count and estimated reading time required.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published