Question

CapGemini
IN
Last activity: 22 Oct 2024 4:51 EDT
Java Class not Found after import : com.spire.doc.Document
Hi All,
I imported Spire.Doc Java library for my requirement of Convert Docx stream to PDf stream by using this library. all the clsses are imported and able to access but Below class also deployed but not able to locate it in Pega.
Class: com.spire.doc.Document
Error: Failed to retrieve Java class location
If i use this class references in my function, I am not getting compilation errors but the code is not executing.
Example code:
try{ byte[] DocBytes2 = Base64.getDecoder().decode(DocStream); ByteArrayInputStream instream = new ByteArrayInputStream(DocBytes2); ByteArrayOutputStream pdfstream = new ByteArrayOutputStream();
Document document = new Document(); document.loadFromStream(instream, FileFormat.Docx); document.saveToStream(pdfstream, FileFormat.PDF); return pdfstream; } catch (Exception e) { String Error = e.toString(); return Error; }