Hi @Atir_Tahir
Thanks for the reply. I have already went through the article. I’m aware of how to read a file via stream (as mentioned in the article) but getting the output file(pdf file) as a stream is what I’m bothered about. Could you plz assist me on that. Rather than providing a output folder/directory I need the converter to provide me an InputStream object. I dont want to create a file after converting it to pdf. I would need the stream after pdf conversion
I have one more concern on svg, txt, eml format. Below is the method I’m using to convert some formats which includes svg , txt, eml.
private static InputStream convertToPdf(InputStream srcFileStream, String fileName, String fileExtension) throws Exception{
Converter converter = new Converter(srcFileStream);
PdfConvertOptions options = new PdfConvertOptions();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
converter.convert(byteArrayOutputStream, options);
return new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
}
For the files with svg, txt and eml extension. I’m getting the following issue;
Exception in thread “main” java.lang.NoClassDefFoundError: com/groupdocs/conversion/internal/o/a/c/compress/archivers/ArchiveStreamFactory
at com.groupdocs.conversion.internal.c.g.f.adapters.b.r(Unknown Source)
at com.groupdocs.conversion.internal.c.g.f.adapters.b.f(Unknown Source)
at com.groupdocs.conversion.internal.c.g.f.adapters.b.a(Unknown Source)
at com.groupdocs.conversion.internal.c.g.f.adapters.b.a(Unknown Source)
at com.groupdocs.conversion.filetypes.FileType.fromStream(Unknown Source)
at com.groupdocs.conversion.pipeline.a.a(Unknown Source)
at com.groupdocs.conversion.Converter.(Unknown Source)
at com.groupdocs.conversion.Converter.(Unknown Source)
at com.example.docstore.DocStoreMainApplication.convertToPdf(DocStoreMainApplication.java:63)
at com.example.docstore.DocStoreMainApplication.convertFileToPdf(DocStoreMainApplication.java:83)
at com.example.docstore.DocStoreMainApplication.main(DocStoreMainApplication.java:102)
Caused by: java.lang.ClassNotFoundException: com.groupdocs.conversion.internal.o.a.c.compress.archivers.ArchiveStreamFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
… 11 more
But when I change the code like below, it starts to work
Converter converter = new Converter("src/main/resources/input/Angular.txt");
Its only taking the src path, else I’m getting an exception like above for the highlighted formats. Can you help me on this…
Thanks for your help.
I have uploaded a zip version of the project. Kindly extract and import it as a maven project. You will find the files under src/main/resources/input directory
Thank you for the details. This issue is reproduced at our end. Hence, we’ve logged it in our internal issue tracking system with ID CONVERSIONJAVA-1189. You’ll be notified as there’s any update.
The issues you have found earlier (filed as CONVERSIONJAVA-1189) have been fixed in this update. This message was posted using Bugs notification tool by Atir_Tahir