Hi there,
Is there any class used to export document in laserfiche repository to PDF using JAVA ? I don't find out yet...
Hi there,
Is there any class used to export document in laserfiche repository to PDF using JAVA ? I don't find out yet...
Please call Document.readEDoc to get an InputStream instance that can be used to read electronic document data, and Page.read to read page parts.
There isn't anything like DocumentExporter. The Laserfiche Java libraries do not have any facilities to generate PDFs, or to perform image format conversion (e.g., converting a PNG to a TIFF). You can download and upload the raw byte streams using the Java libraries but you'll need to use third-party libraries to generate a PDF.
Hi Michael,
You said: You can download and upload the raw byte streams using the Java libraries but you'll need to use third-party libraries to generate a PDF.
I I find out how to upload a file to laserfiche repository with Java. But i dont find any class in laserfiche java SDK to download a file through byte streams with Java. If you enlighten me in this problem, i'll be very gratefull.
Please call Document.readEDoc to get an InputStream instance that can be used to read electronic document data, and Page.read to read page parts.
Hi Michael, thanks for the help.
public void getFileFromRepository(int id){ try { if(id != 0){ Document doc = Document.getById(id, RepositoryConnection.getInstancia()); Entry entry = doc; String formato = ""; if(doc.getMIMEType().equals("application/pdf")) formato = "." + doc.getExtension(); File f = new File("C:\\Users\\allan.freitas\\Pictures\\"); InputStream inputStream = doc.readEDoc(); OutputStream saida = new FileOutputStream(new File(f, entry.getName() + formato)); int ler = 0; byte[] bytes = new byte[1024]; while((ler = inputStream.read(bytes)) != -1){ saida.write(bytes, 0, ler); } inputStream.close(); saida.flush(); saida.close(); RepositoryConnection.getInstancia().logOut(); System.out.println("Documento exportado com sucesso!"); } } catch (Exception e) { e.printStackTrace(); } }
I hope the code above help others with the same difficulty!
I am not sure that there is one but I do know you can export Laserfiche pages as a PDF file through Workflow or the SDK. Here is an example in VB that Workflow can use:
ExportDoc.ExportPdf(MyDocument,MyDocument.AllPages, PdfExportOptions.None, DirectoryFolder + EntryName + ".pdf")
Hi Cristobal Guerrero,
In VB or C# I already known! But thanks! i'm looking for the same thing in java.
Using the .COM (ActiveX/ OLE) libraries, you should have access to the PDFExporter provided by Laserfiche. Unfortunately I don't have a Java example (I use C# with .COM) which is mixing Win32 with .NET -- and have no problems. See if you can see how to use .COM in Java, and take it from there.