web stats
Need a library that can convert from pdf file to html - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-02-2015, 10:30 AM
rutledj rutledj is offline
Mirth Guru
 
Join Date: Nov 2010
Location: North Carolina
Posts: 388
rutledj is on a distinguished road
Default Need a library that can convert from pdf file to html

Looking for a library that will work in Mirth (ver 3.2.2) that allows for converting a pdf file into html that I can embed in a message. In other words, I don't need a html file produced but just the actual html that I can put inside a variable to send elsewhere.

Free would be great but would consider purchasing something.

Thanks,
Rut
Reply With Quote
  #2  
Old 12-02-2015, 11:07 AM
rutledj rutledj is offline
Mirth Guru
 
Join Date: Nov 2010
Location: North Carolina
Posts: 388
rutledj is on a distinguished road
Default

So I found a 3rd party tool but unclear how to use it in mirth. The .jar file (jpdf2html.jar) has been loaded into the Resources tab. In the channel summary I have set this library as a dependency. In the source transformer I'm trying to use the library but don't really know how to do that. Code:

Code:
try
{
var conversionOptions = new Packages.jpdf2html.HTMLConversionOptions();
conversionOptions.setDisableComments(true);

var contentOptions = new ContentOptions();

var converter = new PDFtoHTML5Converter(pdf,'D://',conversionOptions,contentOptions);
converter.convert();
}
catch(er)
{
	logger.error('error ' + er.toString());
}
I get this error:

error TypeError: [JavaPackage jpdf2html.HTMLConversionOptions] is not a function, it is object.
Reply With Quote
  #3  
Old 12-02-2015, 12:09 PM
rutledj rutledj is offline
Mirth Guru
 
Join Date: Nov 2010
Location: North Carolina
Posts: 388
rutledj is on a distinguished road
Default

Ok. I've gotten a little further on this. Looks like the constructor is expecting in a byte stream

public PDFtoHTML5Converter(File pdfFile,
File outputDirectory,
HTMLConversionOptions htmlConversionOptions,
OutputModeOptions outputModeOptions)

The example they use is this:

Code:
 HTMLConversionOptions conversionOptions = new HTMLConversionOptions();//Set conversion options here
     conversionOptions.setDisableComments(true);

     ContentOptions contentOptions = new ContentOptions();//Set content options here

     File pdfFile = new File("C:/MyDocument.pdf");
     File outputDir = new File("C:/MyOutputDirectory/");

     //Alternative constructor exists for converting from byte array
     PDFtoHTML5Converter converter = new PDFtoHTML5Converter(pdfFile, outputDir, conversionOptions, contentOptions);
I'm using a file reader to read in the pdf. How can I work this into using the pdf binary in this constructor?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 07:26 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation