When upgrading from 22.3 to 24.7 the java convert(OutputStream var1, ConvertOptions var2) runs forever.
22.3 works fine but when upgrading to 24.7 it stop working.
Runs in the same docker container as 22.3 “eclipse-temurin:17-jre-focal”.
Have tried alpine/ubuntu images and Java 8 to 22 with the same result.
Please share the sample application with sample file, so we could reproduce the issue on our side.
Thank you for attaching the sample application.
Since you’re passing ByteArrayInputStream
it seems Conversion can’t properly detect file type.
As a workaround I would recommend using Conversion
class constructor that accepts load options as a second parameter:
String input = Files.readString(Path.of("base64-image-jpg-1.txt"));
byte[] bytes = Base64.getDecoder().decode(input.getBytes("UTF-8"));
InputStream doc = new ByteArrayInputStream(bytes);
ImageLoadOptions loadOptions = new ImageLoadOptions();
loadOptions.setFormat(ImageFileType.Jpeg);
Converter converter = new Converter(() -> doc, () -> loadOptions);
Also, in the code above I’m performing conversion from Bas64 to byte array using decode()
method.
One more note. The file base64-image-jpg-1.txt
contains data:image/jpeg;base64,
prefix that has to be removed for successful decoding.
Thanks for a quick answer!
Updated the sample application but still can’t get it to work with my Dockerfile.
Running outside docker as a main class still works fine, any suggestions what could be wrong with my docker file? Suspecting the fonts but the absent of logging makes it hard to know.
Attaching the new sample app.
GroupDocs.zip (1.6 MB)
Any progress with this problem?