2

I have a bunch of PDF files created by iText which i want to convert to images. I'm using JPedal to do so and it works in 99% of the cases but sometimes the images are incomplete. That means the content of forms or tables is missing or if the page contains only a picture (scan of a page) the resulting image is completely blank.

I have noticed that this only happens if the PDF file contains scanned pages. These are not exactly A4 like the rest of the document.

I tried to read the files with iText, create a new one in a temporary bytearray which contains only A4 pages and give this to JPedal. Also i set flattening to true. But nothing has changed.

Any ideas what causes this problem?

EDIT: I'm using jpedal-lgpl.jar in version 4.70. I searched for a more recent package and found version 4.92b23. With this one the content of forms gets converted correctly but the scanned pages are still blank with parts that look like what old TVs show when they have no signal.

I'd love to use the newest version but i can't find a download link. Did IDR Solutions stop publishing a lgpl version?

Metalzwerg
  • 23
  • 1
  • 7
  • "Did IDR Solutions stop publishing a lgpl version?" - As of version 5.0, yes. Source: archived JPedal support forum: https://idrsolutions.fogbugz.com/default.asp?support.2.5168.3 – Amedee Van Gasse Jan 25 '16 at 13:51
  • That's a pity. At least Apache PDFBox seems to be a useful alternative. – Metalzwerg Jan 25 '16 at 16:25

2 Answers2

1

Did you use the flattening functionality of iText or of jPedal?

The "classic" jpedal LGPL version stopped since version 4.92b23. The first version not released under LGPL was 4.93 and later 5.0. The author removed it completely from sourceforge a while ago which contradicts the open source idea imho but that is another story...

However depending on the java version you are using there is a new LGPL JPedal. Instead of Swing/AWT it uses JavaFX but you can still transform your images like before. So if you can use Java 1.8 then you can use that LGPL version and see if that fixes your problem...

Update: To fix the problems with your forms you can also flatten with jpedal: -Dorg.jpedal.flattenForm=true (or System.setProperty("org.jpedal.flattenForm","true"); )

One last possibility which comes to mind would be to fiddle around with the other jpedal options: https://www.idrsolutions.com/jpedal/support/jvm-flags/

Do you have the possibility to supply such an problematic PDF file for analysis?

Lonzak
  • 9,334
  • 5
  • 57
  • 88
  • I used the flattening method of iText. I'm using Java 7 and i will try this. Thanks – Metalzwerg Jan 27 '16 at 09:53
  • Unfortunately OpenViewerFX demands Java8 to work and there is no Java7 download available anymore as stated in the official forums [here](https://support.idrsolutions.com/forums/topic/can-i-download-an-earlier-version-of-the-openviewerfx/). Nevertheless i tried this locally with Java8 and converting the scanned pages works! But sadly the contents of forms are missing again. Results of testing PDFBox are even worse. Only the recent trial version of the commercial JPedal works without any problems...However thanks for helping – Metalzwerg Jan 28 '16 at 08:21
  • Ah ok remember the java 8 issue. With forms I also had problems in the past. What happens if you flatten your forms before? Hint: You can flatten with jpedal, too see my update – Lonzak Jan 28 '16 at 08:58
  • I set the system property first of all in my testclient but it didn't change anything. These PDFs contain very personal data of our customers so i cannot publish it. – Metalzwerg Jan 28 '16 at 09:22
  • Can you try to generate a generic (e.g with empty images etc) PDF file? Difficult to tell otherwise whats going wrong... – Lonzak Jan 28 '16 at 09:38
  • Looks like JPedal was removed from SourceForge altogether. – Amedee Van Gasse Jan 28 '16 at 09:40
  • I thought you meant that they only removed the last version, but they removed all of it. That wasn't clear. – Amedee Van Gasse Jan 28 '16 at 09:42
  • That was what I was trying to say - clarified that in my post. Thanks – Lonzak Jan 28 '16 at 09:45
  • I get these PDFs from another webservice and don't create them myself. I know it's difficult sorry. Also it can take months until our servers are ready to work with Java8. Maybe i should just convince my Boss to buy a commercial license... – Metalzwerg Jan 28 '16 at 10:31
  • To upgrade the server is not an option I know from experience. And if you flat with iText and then use the javaFX version is then everything ok? Another possibility would be to debug the new and the old version and see what changed...But that is quite a challenge when you look at the jpedal source code. – Lonzak Jan 28 '16 at 12:59
  • I'm afraid that would take too much time ;) we decided to use OpenViewerFX. Until we are ready to use Java8 we have to live with that error. It's rare at least. Thanks for your help! – Metalzwerg Feb 01 '16 at 10:44
0

We are paying customer of JPedal and we stumbled accross some threading issues some while ago. The problem got fixed quite quickly by IDR.

Try rendering in a synchronized block and see if the problem still persists.

TomB
  • 1,010
  • 10
  • 14