voyent
PDF to Tiff Error: sun.awt.image.ImageFormatException: Didn't expect more than one scan  XML
Forum Index -> ICEpdf General
Author Message
rajasekhar.mailto

Joined: 28/Sep/2017 04:17:15
Messages: 5
Offline


Hi All,

Please suggest how to solve below error,while converting pdf to tiff.The pdf has multiple pages with scanned (Example Application form scanned and converted to PDF). Issue is if a pdf page has two or more scanned images in a single pdf page then below error is coming.

sun.awt.image.ImageFormatException: Didn't expect more than one scan.

Exception:
---------------------
sun.awt.image.ImageFormatException: Didn't expect more than one scan
at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
at sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:119)
at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:246)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)



 Filename MultiPageCapture.java [Disk] Download
 Description
 Filesize 14 Kbytes
 Downloaded:  983 time(s)

 Filename Main.java [Disk] Download
 Description
 Filesize 3 Kbytes
 Downloaded:  954 time(s)

patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1982
Offline


Unfortunately we don't support the older releases but I would strongly recommend you upgrade the library to at least 5.1.2 or purchase a support plan.

In the code you are working off you could merge the Jpeg changes in the current trunk with the 4.x tag you are using.

On the trunk the code in question is found in ImageStream.dctDecode(). In the 4.x code the class is Stream.dctDecode(). It should be relatively straight forward to do the merge. This will avoid using the depricated com.sun.image.codec.jpeg.JPEGCodec in favor of ImageIO.
[Email]
rajasekhar.mailto

Joined: 28/Sep/2017 04:17:15
Messages: 5
Offline


Thansk patrick.corless,

Can we fix the issue with 4.x or else Can we have sample example of code to run above scenario with icepdf 5.1.2.
patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1982
Offline


You should be able to fix the issue but you will need to merge the dctdecode feature back to 4.x from any of the 5.x tags or the trunk. But you will have to do some programming/work on your end.

Each tag has corresponding examples. If you want the multi-page example for 5.1.2 you can see it on our public svn server, http://anonsvn.icesoft.org/repo/icepdf/tags/icepdf-5.1.2_P05/icepdf/examples/captureMultiple/MultiPageCapture.java
[Email]
rajasekhar.mailto

Joined: 28/Sep/2017 04:17:15
Messages: 5
Offline


Dear patrick.corless,

Where we need to do changes to fix on 4.x in order to fix the above issue. Where can find the libraries to download 5.1.2 jars
patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1982
Offline


If your using the open source version you'll need to download the source code from our svn repository. All the release tags can be found here, http://anonsvn.icesoft.org/repo/icepdf/tags/ . Once downloaded you can use Apache Ant to build the jars with the command >ant build.jars

The pro version trial bundle and official releases can be be downloaded form http://www.icesoft.org/java/downloads/icepdf-downloads.jsf

If you want to back port the changes you'll need to check out for example
http://anonsvn.icesoft.org/repo/icepdf/tags/icepdf-4.1.5/
and
http://anonsvn.icesoft.org/repo/icepdf/tags/icepdf-5.1.2_P05/

Then merge ImageStream.dctdecode() in 5.1.2 back into Stream.dctdecode() of 4.1.5
[Email]
rajasekhar.mailto

Joined: 28/Sep/2017 04:17:15
Messages: 5
Offline


Dear patrick.corless,

Can you suggest where to do changes in 4.2.2 version. Source code attached. Kindly confirm.

Where can find the libraries of 5.1.2?
 Filename MultiPageCapture.java [Disk] Download
 Description
 Filesize 14 Kbytes
 Downloaded:  1014 time(s)

patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1982
Offline


The MultiPageCapture.java hasn't change much from 4. to 5. You can do a diff with this version, http://anonsvn.icesoft.org/repo/icepdf/tags/icepdf-5.1.2_P05/icepdf/examples/captureMultiple/MultiPageCapture.java

Like I mentioned earlier you need to check out the a 5.x tag, for example http://anonsvn.icesoft.org/repo/icepdf/tags/icepdf-5.1.2_P05/ And then run the command ant build.jars. The binaries will be created.
[Email]
rajasekhar.mailto

Joined: 28/Sep/2017 04:17:15
Messages: 5
Offline


Dear patrick.corless,

As suggested by you we made changes in the code and now error is not coming but conversion is not happening if pdf page has two or more scanned images in single page. I am able to convert the remaining pages.

for example: If We scanned aadhar card back to back in single page pdf.


Please refer the screen shot and java class. required you suggestion what is the cause for this without conversion in specific pages.


Note:Error is removed after update the code and even we tried with 4.x and 5.1.2 versions both same out put is coming as image attached, pages are not converting on specific pages instead page is coming as blur blank page. screen shot attached.
 Filename BlackAndWhiteMultiPageCpature.java [Disk] Download
 Description
 Filesize 9 Kbytes
 Downloaded:  988 time(s)

[Thumb - issueAtPage15.png]
 Filename issueAtPage15.png [Disk] Download
 Description
 Filesize 53 Kbytes
 Downloaded:  1315 time(s)

patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1982
Offline


Can you post the actual PDF document?
[Email]
 
Forum Index -> ICEpdf General
Go to:   
Powered by JForum 2.1.7ice © JForum Team