PDFファイルを右綴り(右開き)にする

PdfStamper〜 で始まる3行のソースコードをネットで見つけたのが、今回のアプリ作製のきっかけでした。
今回もソースコードをだだ晒しです。

import java.io.File;
import java.io.FileOutputStream;

import com.itextpdf.text.pdf.PdfName;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;

public class PDFToolBox {

	/**
	 * 右綴じ
	 * @param sourceFilePath	変換元
	 * @param targetFilePath	変換先
	 * @throws Exception		例外
	 */
	public static void doRight(String sourceFilePath, String targetFilePath) throws Exception {
		File outFile = new File(targetFilePath);

		PdfStamper pdfStamper = new PdfStamper(new PdfReader(sourceFilePath), new FileOutputStream(outFile));
		pdfStamper.addViewerPreference(PdfName.DIRECTION, PdfName.R2L);
		pdfStamper.close();
	}
}

実物

自炊補助(PDF編集)ツールのダウンロードはこちら