Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jPedal PDF page to JPG  RSS feed

 
Don Blodgett
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using jPedal to read a PDF file and save each page as a JPG file using ImageIO. I need the JPG to have equal resolution to the PDF page. I have code that works, it just takes way too long. In the code below it will create a single JPG after about 40 seconds to 1 minute!

This is running on an iSeries v5r3 with java.awt.headless=true

There has to be a faster way. Thanks for any help.

 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36393
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don,
Have you done any profiling to see what the bottleneck is - CPU or IO?
 
Don Blodgett
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne,

Thanks for the reply. I don't believe this is an IO issue as I can copy the same file using FileInputStream and FileOutputStream fairly quickly.

After some more testing I have found that the line that is holding everything up is Which when I looked into the source code for it I seen that it uses Graphics2D and seems to redundantly call the method that builds the image. Although this is in the newest GPL version, which only gives me a blank image as the output on the iSeries rather than the actual page and I am not using the newest version because of that very reason.

I have noticed that the smaller the output JPG file is the faster the process goes, however slowly. I am thinking that this may come down to the fact that I am running this on an iSeries, which as I understand it, isn't a system which has a lot of support for graphics operations.

Does anyone have experience running graphics operations on an iSeries? Or more specifically getting images of PDF pages on an iSeries? I am open to other methods of extraction.
 
Don Blodgett
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems that I am not alone in this problem. I have found this link on jPedal support forum from as resent as April of this year, for those interested.

http://support.idrsolutions.com/default.asp?support.2.226.3

This appears to be confirming my guess that it is an iSeries issue. One way I have determined how to solve this is to use a remote system running Linux or Windows to actually process the files, which even with all the network traffic it requires is still far faster than than waiting for the iSeries to do it. Of course this is far from acceptable, but it will work for the time being.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36393
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don,
Thank you for posting the "answer" for those who come across this thread in the future. And I only use answer in quotes because it's not the best solution in the world. But if it helps you for the time being, it is likely to help others!
 
Carey Evans
Ranch Hand
Posts: 225
Debian Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a few things you can do to try to improve Java performance on OS/400:
  • Use the 32-bit JDK, which is pretty much AIX Java. I think this is only available on V5R4, though.
  • Run CRTJVAPGM JDKVER(xxx) OPTIMIZE(xxx) on the jPedal .jar files, with appropriate parameters. This could take a very long time to finish.
  • Java startup time seems to be a big deal on i5/OS, so you could try a long-running program that scans a directory or a data queue and does the conversion on demand.
  •  
    Don Blodgett
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Carey,

    Thanks for the suggestions. I have heard about 32-bit JDK being available on v5r4, but unfortunately I will also need it to work on v5r3. I am also currently using a long running process that monitors a DB file to help speed things along. I will have to try the CL command to see what results I get from that.

    Thanks again.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!