I just did:
XXXX\Java\PDFBox reactor 2>java -cp
"examples/target/pdfbox-examples-2.0.21.jar;app/target/pdfbox-app-2.0.21.jar"
org.apache.pdfbox.examples.util.PrintTextLocations
examples/target/SimpleForm.pdf
String[50.0,31.88977 fs=15.0 xscale=15.0 height=8.67 space=4.1700006
width=9.165001]F
String[59.165,31.88977 fs=15.0 xscale=15.0 height=8.67 space=4.1700006
width=3.3300018]i
String[62.495003,31.88977 fs=15.0 xscale=15.0 height=8.67
space=4.1700006 width=8.340004]e
String[70.83501,31.88977 fs=15.0 xscale=15.0 height=8.67 space=4.1700006
width=3.3300018]l
String[74.16501,31.88977 fs=15.0 xscale=15.0 height=8.67 space=4.1700006
width=8.339996]d
String[82.505005,31.88977 fs=15.0 xscale=15.0 height=8.67
space=4.1700006 width=4.169998]:
do both jar files exist with the names you used?
is your current directory the root of the project?
Could there be a hidden text in what you typed? (Happens to me
sometimes, that I use an arrow key and then filenames no longer work)
Does the class exist in the jar? To check this:
XXX\PDFBox reactor 2>jar -t
--file=examples/target/pdfbox-examples-2.0.21.jar
META-INF/MANIFEST.MF
META-INF/
org/
org/apache/
org/apache/pdfbox/
org/apache/pdfbox/examples/
org/apache/pdfbox/examples/ant/
org/apache/pdfbox/examples/interactive/
org/apache/pdfbox/examples/interactive/form/
org/apache/pdfbox/examples/lucene/
org/apache/pdfbox/examples/pdmodel/
org/apache/pdfbox/examples/printing/
org/apache/pdfbox/examples/rendering/
org/apache/pdfbox/examples/signature/
org/apache/pdfbox/examples/signature/cert/
org/apache/pdfbox/examples/signature/validation/
org/apache/pdfbox/examples/util/
org/apache/pdfbox/resources/
org/apache/pdfbox/resources/pdfa/
org/apache/pdfbox/resources/ttf/
META-INF/maven/
META-INF/maven/org.apache.pdfbox/
META-INF/maven/org.apache.pdfbox/pdfbox-examples/
META-INF/DEPENDENCIES
org/apache/pdfbox/examples/lucene/IndexPDFFiles.class
org/apache/pdfbox/examples/pdmodel/AddImageToPDF.class
META-INF/LICENSE
org/apache/pdfbox/examples/pdmodel/CreateGradientShadingPDF.class
org/apache/pdfbox/examples/pdmodel/HelloWorldType1.class
META-INF/NOTICE
org/apache/pdfbox/examples/lucene/LucenePDFDocument.class
org/apache/pdfbox/examples/pdmodel/AddJavascript.class
org/apache/pdfbox/examples/pdmodel/AddMetadataFromDocInfo.class
org/apache/pdfbox/examples/pdmodel/ExtractTTFFonts.class
org/apache/pdfbox/examples/pdmodel/HelloWorld.class
org/apache/pdfbox/examples/ant/PDFToTextTask.class
org/apache/pdfbox/examples/pdmodel/AddAnnotations.class
org/apache/pdfbox/examples/pdmodel/EmbeddedVerticalFonts.class
org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFiles.class
org/apache/pdfbox/examples/pdmodel/UsingTextMatrix.class
org/apache/pdfbox/examples/util/RemoveAllText.class
META-INF/maven/org.apache.pdfbox/pdfbox-examples/pom.xml
META-INF/maven/org.apache.pdfbox/pdfbox-examples/pom.properties
org/apache/pdfbox/examples/interactive/form/AddBorderToField.class
org/apache/pdfbox/examples/interactive/form/CreateCheckBox.class
org/apache/pdfbox/examples/pdmodel/EmbeddedMultipleFonts.class
org/apache/pdfbox/examples/signature/cert/CRLVerifier.class
org/apache/pdfbox/examples/signature/cert/RevokedCertificateException.class
org/apache/pdfbox/examples/signature/CreateEmbeddedTimeStamp.class
org/apache/pdfbox/examples/signature/CreateSignatureBase.class
org/apache/pdfbox/examples/signature/ShowSignature.class
org/apache/pdfbox/examples/signature/validation/AddValidationInformation.class
org/apache/pdfbox/examples/signature/ValidationTimeStamp.class
org/apache/pdfbox/examples/util/DrawPrintTextLocations.class
org/apache/pdfbox/examples/util/PrintImageLocations.class
org/apache/pdfbox/examples/util/PrintTextLocations.class <======== there
it is!
org/apache/pdfbox/resources/pdfa/sRGB.icc.LICENSE-ZLIB
org/apache/pdfbox/examples/interactive/form/CreateMultiWidgetsForm.class
org/apache/pdfbox/examples/pdmodel/AddMessageToEachPage.class
org/apache/pdfbox/examples/pdmodel/CreateBookmarks.class
org/apache/pdfbox/examples/interactive/form/CreateRadioButtons.class
org/apache/pdfbox/examples/pdmodel/CreateBlankPDF.class
org/apache/pdfbox/examples/interactive/form/CreateSimpleForm.class
org/apache/pdfbox/examples/pdmodel/ExtractMetadata.class
org/apache/pdfbox/examples/pdmodel/GoToSecondBookmarkOnOpen.class
org/apache/pdfbox/examples/interactive/form/CreateSimpleFormWithEmbeddedFont.class
org/apache/pdfbox/examples/rendering/CustomGraphicsStreamEngine.class
org/apache/pdfbox/examples/signature/CreateSignedTimestampBase.class
org/apache/pdfbox/examples/interactive/form/FieldTriggers.class
org/apache/pdfbox/examples/pdmodel/CreateLandscapePDF.class
org/apache/pdfbox/examples/pdmodel/PrintBookmarks.class
org/apache/pdfbox/examples/pdmodel/PrintURLs.class
org/apache/pdfbox/examples/pdmodel/ReplaceURLs.class
org/apache/pdfbox/examples/pdmodel/ShowColorBoxes.class
org/apache/pdfbox/examples/pdmodel/SuperimposePage.class
org/apache/pdfbox/examples/rendering/custom-render-demo.pdf
org/apache/pdfbox/examples/signature/cert/OcspHelper$1.class
org/apache/pdfbox/examples/signature/cert/OcspHelper$SHA1DigestCalculator.class
org/apache/pdfbox/examples/signature/cert/OcspHelper.class
org/apache/pdfbox/examples/signature/SigUtils.class
org/apache/pdfbox/examples/signature/TSAClient.class
org/apache/pdfbox/examples/signature/validation/CertificateProccessingException.class
org/apache/pdfbox/examples/signature/validation/CertInformationCollector$CertSignatureInformation.class
org/apache/pdfbox/examples/signature/validation/CertInformationCollector.class
org/apache/pdfbox/examples/util/ExtractTextByArea.class
org/apache/pdfbox/examples/util/PDFHighlighter.class
org/apache/pdfbox/examples/util/PrintTextColors.class
org/apache/pdfbox/resources/pdfa/sRGB.icc.COPYING
org/apache/pdfbox/resources/pdfa/sRGB.icc.README
org/apache/pdfbox/examples/interactive/form/FillFormField.class
org/apache/pdfbox/examples/pdmodel/CreatePageLabels.class
org/apache/pdfbox/examples/pdmodel/PrintDocumentMetaData.class
org/apache/pdfbox/examples/pdmodel/RemoveFirstPage.class
org/apache/pdfbox/examples/rendering/CustomPageDrawer$MyPDFRenderer.class
org/apache/pdfbox/examples/rendering/CustomPageDrawer.class
org/apache/pdfbox/examples/signature/cert/CertificateVerificationResult.class
org/apache/pdfbox/examples/signature/CreateVisibleSignature.class
org/apache/pdfbox/examples/interactive/form/FillFormField.pdf
org/apache/pdfbox/examples/pdmodel/CreatePatternsPDF.class
org/apache/pdfbox/examples/pdmodel/CreatePDFA.class
org/apache/pdfbox/examples/pdmodel/EmbeddedFiles.class
org/apache/pdfbox/examples/pdmodel/EmbeddedFonts.class
org/apache/pdfbox/examples/interactive/form/PrintFields.class
org/apache/pdfbox/examples/pdmodel/CreateSeparationColorBox.class
org/apache/pdfbox/examples/pdmodel/RubberStampWithImage.class
org/apache/pdfbox/examples/signature/cert/CertificateVerifier.class
org/apache/pdfbox/examples/signature/CMSProcessableInputStream.class
org/apache/pdfbox/examples/signature/CreateEmptySignatureForm.class
org/apache/pdfbox/examples/signature/CreateSignature.class
org/apache/pdfbox/examples/signature/CreateSignedTimeStamp.class
org/apache/pdfbox/resources/pdfa/sRGB.icc
org/apache/pdfbox/resources/ttf/Lohit-Bengali.ttf
org/apache/pdfbox/examples/interactive/form/SetField.class
org/apache/pdfbox/examples/pdmodel/RubberStamp.class
org/apache/pdfbox/examples/pdmodel/ShowTextWithPositioning.class
org/apache/pdfbox/examples/printing/Printing.class
org/apache/pdfbox/examples/interactive/form/UpdateFieldOnDocumentOpen.class
org/apache/pdfbox/examples/pdmodel/HelloWorldTTF.class
org/apache/pdfbox/examples/pdmodel/ImageToPDF.class
org/apache/pdfbox/examples/rendering/CustomPageDrawer$MyPageDrawer.class
org/apache/pdfbox/examples/signature/cert/CertificateVerificationException.class
org/apache/pdfbox/examples/signature/CreateVisibleSignature2.class
org/apache/pdfbox/examples/signature/validation/CertInformationHelper.class
org/apache/pdfbox/examples/util/AddWatermarkText.class
org/apache/pdfbox/examples/util/ExtractTextSimple.class
org/apache/pdfbox/examples/util/PDFMergerExample.class
Tilman
Am 28.08.2020 um 22:43 schrieb raytravis:
Hmm...
# java -cp
"examples/target/pdfbox-examples-2.0.21.jar;app/target/pdfbox-app-2.0.21.jar"
org.apache.pdfbox.examples.util.PrintTextLocations examples/target/SimpleForm.pdf
Error: Could not find or load main class
org.apache.pdfbox.examples.util.PrintTextLocations
Caused by: java.lang.ClassNotFoundException:
org.apache.pdfbox.examples.util.PrintTextLocations
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, August 28, 2020 11:55 AM, Tilman Hausherr <thaush...@t-online.de>
wrote:
You need to call it this way:
java -cp
"examples/target/pdfbox-examples-2.0.21.jar;app/target/pdfbox-app-2.0.21.jar"
org.apache.pdfbox.examples.util.PrintTextLocations <filename>
Tilman
Am 28.08.2020 um 20:29 schrieb raytravis:
Well...it compiled. The only thing I can think of is that I rebooted my local
computer and therefore had to establish a brand new SSH session to the server
this morning. So maybe some sort of environment related issue?
Regardless, now I'm trying to figure out how to run the generated JAR file:
java -jar examples/target/pdfbox-examples-2.0.21.jar PrintTextLocations
========================================================================
no main manifest attribute, in examples/target/pdfbox-examples-2.0.21.jar
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, August 27, 2020 11:48 PM, Tilman Hausherr thaush...@t-online.de
wrote:
Yeah that sounds pretty up-to-date, although maven is now at 3.6.3.
Another thing you can try is to open the "parent/pom.xml", find this segment
<!-- enable these when getting
CompilationFailureException without explanation: -->
<!--
<compilerArgument>-verbose</compilerArgument>
<verbose>true</verbose>
-->
and enable the disabled two lines and then see what happens.
Tilman
Am 27.08.2020 um 21:54 schrieb raytravis:
I'm not sure how to do that as I'm running with the latest Ubuntu package
versions (apt says it is fully up to date) and I've never used Maven directly
until today.
mvn -version
=============
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 11.0.8, vendor: Ubuntu, runtime:
/usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-112-generic", arch: "amd64", family: "unix"
javac -version
===============
javac 11.0.8
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, August 27, 2020 12:16 PM, Tilman Hausherr thaush...@t-online.de
wrote:
Hi,
Try updating your jdk... also maven itself.
But you can also create a (new) ordinary maven project, use the example
code (PrintTextLocations) you mentioned as main, and use pdfbox
dependencies in the pom without having to build the whole project.
Tilman
Am 27.08.2020 um 21:02 schrieb raytravis:
Downloaded PDFBox 2.0.21 source code from the website to an Ubuntu Server LTS 18.04.2 server,
extracted it, ran 'mvn clean install', and got errors. "Insanity is doing the same thing over
and over again and expecting a different result" but in this case, repeating the same, exact
command eventually started pulling down packages from Maven. First, it was failure to connect to
Maven sources which magically corrected themselves after a while but still broke at least two more
times. Re-running the same 'mvn clean install' command repeatedly eventually "fixed" the
problem. Then I ran into this:
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ fontbox ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 103 source files to
/home/rtravis/pdfbox/pdfbox-2.0.21/fontbox/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for PDFBox reactor 2.0.21:
[INFO]
[INFO] PDFBox parent ...................................... SUCCESS [ 1.322 s]
[INFO] Apache FontBox ..................................... FAILURE [ 0.502 s]
[INFO] Apache XmpBox ...................................... SKIPPED
[INFO] Apache PDFBox ...................................... SKIPPED
[INFO] Apache Preflight ................................... SKIPPED
[INFO] Apache Preflight application ....................... SKIPPED
[INFO] Apache PDFBox Debugger ............................. SKIPPED
[INFO] Apache PDFBox tools ................................ SKIPPED
[INFO] Apache PDFBox application .......................... SKIPPED
[INFO] Apache PDFBox Debugger application ................. SKIPPED
[INFO] Apache PDFBox examples ............................. SKIPPED
[INFO] PDFBox reactor ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.403 s
[INFO] Finished at: 2020-08-27T11:18:52-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile (default-compile) on
project fontbox: Compilation failure -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :fontbox
Both the -e and -X options to mvn resulted in nonsensical output. Tried various
things without any difference in the outcome. All I really want is the
precompiled 'examples' JARs. Specifically, the
'examples/util/PrintTextLocations' example because the precompiled pdfbox CLI
tool doesn't have an option to dump character location information within the
ExtractText option but the PrintTextLocations example code does! I just need to
be able to parse character locations from stdin in my language of choice and I
don't want to try parsing PDFs myself if there are already tools that can do
that.
--------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org