Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Help needed on using a jar file

I have downloaded a jar file PDFBOX to use to get information from some PDF Files which are simple text files.
I created a tLibraryload on my job and selected the pdfbox-app-1.3.1.jar in the basic settings for the library.
I cut and pasted the example code from the PDFBOX tutorial to a tJava using the OnsubJobok connector
http://pdfbox.apache.org/userguide/cookbook/creation.html#CreateBlankPDF
----------------------------------------------------------------------------------------------------------------------------
document = new PDDocument();
PDPage page = new PDPage();
document.addPage( page );
PDFont font = PDType1Font.HELVETICA_BOLD;
PDPageContentStream contentStream = new PDPageContentStream(document, page);
contentStream.beginText();
contentStream.setFont( font, 12 );
contentStream.moveTextPositionByAmount( 100, 700 );
contentStream.drawString( "Hello World" );
contentStream.endText();
contentStream.close();
document.save( "Hello World.pdf");
when I run this
Exception in thread "main" java.lang.Error: java.lang.Error: Unresolved compilation problems:
document cannot be resolved
PDDocument cannot be resolved to a type
PDPage cannot be resolved to a type
PDPage cannot be resolved to a type
document cannot be resolved
PDFont cannot be resolved to a type
PDType1Font cannot be resolved
PDPageContentStream cannot be resolved to a type
PDPageContentStream cannot be resolved to a type
document cannot be resolved
document cannot be resolved
document cannot be resolved
connecting to socket on port 3865
connected
disconnected
at debit_cards.pdftest_0_1.pdftest.tLibraryLoad_1Process(pdftest.java:301)
at debit_cards.pdftest_0_1.pdftest.runJobInTOS(pdftest.java:566)
at debit_cards.pdftest_0_1.pdftest.main(pdftest.java:437)
document.close();
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Could somebody help on this as soon as possible and explain what tghe problem is and how to fix it.
Many thanks in advance of teh help.
Labels (4)
2 Replies
Anonymous
Not applicable
Author

I have exactly the same problem.
Any advice on this?
alevy
Specialist
Specialist

Did you also add the necessary import statements in the Advanced Settings, either of tLibraryLoad or tJava?