Hi. I’m trying to convert a Base64 Byte Array into a PDF Document using Java.
However, I get the following Exception:
JavaException: com.aspose.words.internal.zzY6: Could not create the bitmap with the specified parameters. Possible lack of system resources.
Here is my code:
var bytes = getBytes();
var pdfDoc = new com.aspose.words.Document();
var documentBuilder = new com.aspose.words.DocumentBuilder(pdfDoc);
documentBuilder.insertImage(bytes);
var path = "C:\Temp\sample.pdf";
pdfDoc.save(path, com.aspose.words.SaveFormat.PDF);
@swy Thank you for additional information. I cannot reproduce the problem on my side using the latest 22.11 version of Aspose.Words for Java. The following code does not throw an exception and properly generated PDF document:
byte[] bytes = Files.readAllBytes(Paths.get("C:\\Temp\\BitmapImage.bmp"));
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertImage(bytes);
doc.save("C:\\Temp\\out.pdf");
Thanks for looking into this for me Alexey. I have downloaded the latest version of Aspose.words (aspose-words-22.11-jdk16.jar), but I still get the same problem. In fact, tif files no longer work with the latest version.