From 78631f686bca1cd365844ed301a5546ec8a4da0e Mon Sep 17 00:00:00 2001 From: dangowans Date: Fri, 14 Dec 2018 16:16:41 -0500 Subject: [PATCH] Source and destination parameter support --- .../pdfflattener/FlattenPDF$1.class | Bin 780 -> 780 bytes .../pdfflattener/FlattenPDF.class | Bin 7921 -> 8629 bytes dist/PDFFlattener.jar | Bin 4126924 -> 4127349 bytes .../pdfflattener/FlattenPDF.java | 110 ++++++++++++++---- 4 files changed, 86 insertions(+), 24 deletions(-) diff --git a/bin/ca/saultstemarie/pdfflattener/FlattenPDF$1.class b/bin/ca/saultstemarie/pdfflattener/FlattenPDF$1.class index 80c1ca2d18e0bfbac87717874a6567f26158e206..138984dfe99d931079f3b58cd5c408f5da9e7caa 100644 GIT binary patch delta 19 acmeBS>tWl_!NhoMawn4otWl_!Nk}xxs%C)v3v3%CNBU$5e91j diff --git a/bin/ca/saultstemarie/pdfflattener/FlattenPDF.class b/bin/ca/saultstemarie/pdfflattener/FlattenPDF.class index caca3600ca7320cfcc5b88c449a0bf64191a423e..68e5417603143f230a8f840b9061f5db3fbab8de 100644 GIT binary patch literal 8629 zcma)C31D0GdH;Q~WF3CF!O=nv9-}TN%qp=;@eIlZy8A#C6Lul193w+4Ir)Yj0`}ZxsYv#z=Hn=~%M2PT&u>)~{{a(byIy3I6r1io|2dn6+9^R8hHE z;BGLZh980%8aycWVV0m+ak*lJ8ZFh}g-`t|)8I#d>sn$-V?#F4ZKON(?zo{2HY0j` zGeuPI`N85<_AvnzVZMfW(0G*97t08$T8>vS z&xlq>5(ytp5}Z15ta@i8k*QwKuMQ){b@ja4ISU zB^krw>XebTb_>p}n9RoHk;=(K0aRhR7t5$e#p*y!rk@6?*%WTolX|a_*02KAf)jcT z%Q?QqGu#B`1=Lx0})1gK)l1&&% zE8_*tI1b$oG<`Uq2&6*&h zuFbw3YaDB=$;RUJ1|NF3FPz+^$79h@#>}Q8Mo8(cIuJkvE$S<#;R@`ee0nOy!vrg) zFxq60=1-_oB-d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src/ca/saultstemarie/pdfflattener/FlattenPDF.java +++ b/src/ca/saultstemarie/pdfflattener/FlattenPDF.java @@ -24,14 +24,32 @@ public class FlattenPDF { - public static int IMAGE_DPI = 200; + /** + * Whether or not debug output is printed to the console. + */ public static boolean SHOW_DEBUG = true; + + /** + * The suggested prefix to add to output files. + */ + public static String DESTINATION_FILENAME_PREFIX = "flat--"; + + /** + * The DPI that should be used when generating images. + * Higher DPI increases the memory requirements and output file sizes, but also produces sharper images. + */ + public static int IMAGE_DPI = 200; + public static void main(String[] args) { // Settings System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider"); + + /* + * Set up JFileChooser + */ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); @@ -40,50 +58,94 @@ public static void main(String[] args) { // ignore and use default } + JFileChooser fileChooser = new JFileChooser(); + fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("PDF Documents", "pdf")); + fileChooser.setAcceptAllFileFilterUsed(false); + /* * Get the source file */ - JFileChooser fileChooser = new JFileChooser(); - - fileChooser.setDialogTitle("Select the Source PDF File to Flatten"); - fileChooser.setApproveButtonText("Set Source PDF"); - fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("PDF Documents", "pdf")); - fileChooser.setAcceptAllFileFilterUsed(false); + File sourceFile = null; - int returnValue = fileChooser.showOpenDialog(null); + boolean sourceFileFromArgument = false; - if (returnValue != JFileChooser.APPROVE_OPTION) { - JOptionPane.showMessageDialog(null, "No Source PDF file selected.", "Error", JOptionPane.ERROR_MESSAGE); - System.exit(1); + if (args.length >= 1) { + sourceFile = new File(args[0]); + + if (!sourceFile.exists() || !sourceFile.isFile() || !sourceFile.canRead() || !sourceFile.getName().toLowerCase().endsWith(".pdf")) { + JOptionPane.showMessageDialog(null, "Invalid source file.\n" + + args[0], "Error", JOptionPane.ERROR_MESSAGE); + System.exit(1); + } + else { + sourceFileFromArgument = true; + } } - File sourceFile = fileChooser.getSelectedFile(); + if (!sourceFileFromArgument) { + + fileChooser.setDialogTitle("Select the Source PDF File to Flatten"); + fileChooser.setApproveButtonText("Set Source PDF"); + + int returnValue = fileChooser.showOpenDialog(null); + + if (returnValue != JFileChooser.APPROVE_OPTION) { + JOptionPane.showMessageDialog(null, "No Source PDF file selected.", "Error", JOptionPane.ERROR_MESSAGE); + System.exit(1); + } + + sourceFile = fileChooser.getSelectedFile(); + } /* * Get the destination file */ - - File destinationFile = new File(sourceFile.getAbsolutePath() + File.separator + "FLAT-" + sourceFile.getName()); - - fileChooser.setDialogTitle("Select the Destination PDF File"); - fileChooser.setApproveButtonText("Set Destination PDF"); - fileChooser.setSelectedFile(destinationFile); - returnValue = fileChooser.showSaveDialog(null); + File destinationFile = null; + boolean destinationFileFromArgument = false; - if (returnValue != JFileChooser.APPROVE_OPTION) { - JOptionPane.showMessageDialog(null, "No Destination PDF file selected.", "Error", JOptionPane.ERROR_MESSAGE); - System.exit(1); + if (args.length >= 2) { + destinationFile = new File(args[1]); + + if (!sourceFile.getName().toLowerCase().endsWith(".pdf")) { + JOptionPane.showMessageDialog(null, "Invalid destination file.\n" + + args[0], "Error", JOptionPane.ERROR_MESSAGE); + System.exit(1); + } + else { + destinationFileFromArgument = true; + } } - destinationFile = fileChooser.getSelectedFile(); + if (!destinationFileFromArgument) { + + destinationFile = new File(sourceFile.getAbsolutePath() + File.separator + DESTINATION_FILENAME_PREFIX + sourceFile.getName()); + + fileChooser.setDialogTitle("Select the Destination PDF File"); + fileChooser.setApproveButtonText("Set Destination PDF"); + fileChooser.setSelectedFile(destinationFile); + + int returnValue = fileChooser.showSaveDialog(null); + + if (returnValue != JFileChooser.APPROVE_OPTION) { + JOptionPane.showMessageDialog(null, "No Destination PDF file selected.", "Error", JOptionPane.ERROR_MESSAGE); + System.exit(1); + } + + destinationFile = fileChooser.getSelectedFile(); + } if (sourceFile.getPath().equals(destinationFile.getPath()) && sourceFile.getName().equals(destinationFile.getName())) { JOptionPane.showMessageDialog(null, "You cannot select the same PDF file as both the source and the destination.", "Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } + if (!destinationFile.getName().toLowerCase().endsWith(".pdf")) { + destinationFile = new File(destinationFile.getAbsolutePath() + ".pdf"); + } + + /* * Do the flattening */ @@ -96,7 +158,7 @@ public static void main(String[] args) { "Ready to Start", JOptionPane.INFORMATION_MESSAGE); - returnValue = flattenPDF (sourceFile, destinationFile); + int returnValue = flattenPDF (sourceFile, destinationFile); if (returnValue == 0) { JOptionPane.showMessageDialog(null, "The PDF file was flattened successfully.", "Success", JOptionPane.INFORMATION_MESSAGE);