Skip to content

Instantly share code, notes, and snippets.

@davertay
Created June 17, 2014 02:00
Show Gist options
  • Save davertay/dca6db7e2fb8b6392808 to your computer and use it in GitHub Desktop.
Save davertay/dca6db7e2fb8b6392808 to your computer and use it in GitHub Desktop.
import com.snowtide.pdf.OutputTarget;
import com.snowtide.pdf.PDFTextStream;
public class ExtractTextAllPages {
public static void main (String[] args)
{
String pdfFilePath = args[0];
PDFTextStream pdfts = new PDFTextStream(pdfFilePath);
StringBuilder text = new StringBuilder(1024);
pdfts.pipe(new OutputTarget(text));
pdfts.close();
System.out.printf("The text extracted from %s is:", pdfFilePath);
System.out.println(text);
}
}
// Need pdftextstream-2.7.0.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment