Java PDF to Image Conversion using PDFBox

Here are few snippets of code that you can use to convert a PDF file to images eg: tiff, png, multi-page tiff. It uses a open source library PDFBox version 3

The Apache PDFBox® library is an open source Java tool for working with PDF documents. This project allows creation of new PDF documents, manipulation of existing documents and the ability to extract content from documents.

PDFBox comes with following features:

  • Extract Unicode text from PDF files.
  • Split a single PDF into many files or merge multiple PDF files.
  • Extract data from PDF forms or fill a PDF form.
  • Validate PDF files against the PDF/A-1b standard.
  • Print a PDF file using the standard Java printing API.
  • Save PDFs as image files, such as PNG or JPEG.
  • Create a PDF from scratch, with embedded fonts and images.

Convert PDF to PNG/JPG/BMP etc:

git reset/revert to previous commit

Sometimes we "accidentally" merge something that's not ready for release/qa  and need to rollback/reset/revert the commits to a cleaner state.

Here's how you can safely reset your git to previous commit:

1) find the older commit id to where you want to reset.

2) do git status to confirm there are no uncommitted changes on the current branch  

3) reset to a commit,

git reset --hard COMMIT_ID
git reset HEAD@{1}
git add .
git commit -m "reverting to commit COMMIT_ID"

4) cherry pick or patch any other commit that you like to add