LOG.info("Found " + n + " pages in input pdf document.");
for (currentPage = 1; currentPage <= n; currentPage++) {
LOG.debug("Creating a new document.");
fileNum++;
File tmpFile = FileUtility.generateTmpFile(inputCommand.getOutputFile());
FileNameRequest request = new FileNameRequest(currentPage, fileNum, null);
File outFile = new File(inputCommand.getOutputFile().getCanonicalPath(), prefixParser
.generateFileName(request));
currentDocument = new Document(pdfReader.getPageSizeWithRotation(currentPage));
pdfWriter = new PdfSmartCopy(currentDocument, new FileOutputStream(tmpFile));