You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2024/09/17 08:55:19 UTC
svn commit: r1920735 - in /pdfbox/trunk/tools/src/test: java/org/apache/pdfbox/tools/TestExtractText.java resources/org/apache/pdfbox/AngledExample.pdf
Author: tilman
Date: Tue Sep 17 08:55:19 2024
New Revision: 1920735
URL: http://svn.apache.org/viewvc?rev=1920735&view=rev
Log:
PDFBOX-5879: add test for rotationMagic
Added:
pdfbox/trunk/tools/src/test/resources/org/apache/pdfbox/AngledExample.pdf (with props)
Modified:
pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestExtractText.java
Modified: pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestExtractText.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestExtractText.java?rev=1920735&r1=1920734&r2=1920735&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestExtractText.java (original)
+++ pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestExtractText.java Tue Sep 17 08:55:19 2024
@@ -49,6 +49,7 @@ class TestExtractText
PrintStream printStream = null;
static final String testfile1 = "src/test/resources/org/apache/pdfbox/testPDFPackage.pdf";
static final String testfile2 = "src/test/resources/org/apache/pdfbox/hello3.pdf";
+ static final String testfile3 = "src/test/resources/org/apache/pdfbox/AngledExample.pdf";
static String filename1 = null;
static String filename2 = null;
@@ -243,4 +244,35 @@ class TestExtractText
assertTrue(result.contains("PDF file: " + filename2));
}
+ /**
+ * Simple test to check that the rotationMagic feature works.
+ *
+ * @param tempDir
+ * @throws Exception
+ */
+ @Test
+ void testRotationMagic(@TempDir Path tempDir) throws Exception
+ {
+ Path path = null;
+
+ try
+ {
+ path = tempDir.resolve("outfile.txt");
+ Files.deleteIfExists(path);
+ }
+ catch (InvalidPathException ipe)
+ {
+ System.err.println(
+ "Error creating temporary test file in " + this.getClass().getSimpleName());
+ }
+ assertNotNull(path);
+
+ PDFBox.main(new String[] { "export:text", "-rotationMagic", "-i", testfile3,
+ "-o", path.toString() });
+
+ String result = new String(Files.readAllBytes(path), "UTF-8");
+ assertTrue(result.contains("Horizontal Text"), result);
+ assertTrue(result.contains("Vertical Text"), result);
+ }
+
}
Added: pdfbox/trunk/tools/src/test/resources/org/apache/pdfbox/AngledExample.pdf
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/test/resources/org/apache/pdfbox/AngledExample.pdf?rev=1920735&view=auto
==============================================================================
Binary file - no diff available.
Propchange: pdfbox/trunk/tools/src/test/resources/org/apache/pdfbox/AngledExample.pdf
------------------------------------------------------------------------------
svn:mime-type = application/pdf