× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I didn't really understand what the "TextExtractionStrategy strategy" was
doing or how to do this in RPGLE. The fact that TextExtractionStrategy is
an interface, instead of a class, threw me. Maybe its just a declaration
and can be handled by the declaration as you've shown here. I'll just do
as best I can, code the calls, and deal with any invalid class errors I
happen to get. Thanks for the advice.





From: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>,
Date: 03/05/2013 05:00 PM
Subject: Re: Prototyping an interface in RPG
Sent by: rpg400-l-bounces@xxxxxxxxxxxx



This is off the top of my head, and untested:

D TextExtractionStrategy...
D s O CLASS(*JAVA
D : 'com.itextpdf.text.pdf.parser-
D TextExtractionStrategy')

D strategy s like(TextExtractionStrategy)



On 3/5/2013 3:07 PM, darren@xxxxxxxxx wrote:

I'm trying to figure out how to handle a java interface type object in
RPG.
The example I'm trying to replicate in RPG is using iText and the
TextExtractionStrategy interface. How do I define an object to have the
TextExtractionStrategy object type. When I read the javadoc, it doesn't
give me any clues to what to set the class to or even if there is a
constructor to specify.

Here is the java code example that I'm trying to somewhat do within RPG.
I
get stuck trying to figure out how to define the "strategy" object. This
code snippet is supposed to extract text within a given area of a PDF and
is taken from the iText website:

PdfReader reader = new PdfReader(pdf);
PrintWriter out = new PrintWriter(new FileOutputStream(txt));
Rectangle rect = new Rectangle(70, 80, 420, 500);
RenderFilter filter = new RegionTextRenderFilter(rect);
TextExtractionStrategy strategy;
for (int i = 1; i <= reader.getNumberOfPages(); i++) {
strategy = new FilteredTextRenderListener(
new LocationTextExtractionStrategy(), filter);
out.println(PdfTextExtractor
.getTextFromPage(reader, i, strategy));
}
out.flush();out.close();

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.