allcolor / YaHP-Converter

YaHP is a Java library that allows you to convert an HTML document into a PDF document.
GNU Lesser General Public License v2.1
56 stars 23 forks source link

java.lang.ClassNotFoundException: org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer cannot be found #26

Open rnagpure37 opened 10 years ago

rnagpure37 commented 10 years ago

I am use YaHp Converter in RCP Application to convert HTML page to PDF format. I make plugin from YaHp jar file. and this plugin import into our Project but to convert HTML page to Pdf its gives an Error

java.lang.ClassNotFoundException: org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer cannot be found by in.abc.yahp_1.0.0 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:423) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:336) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:328) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160) at java.lang.ClassLoader.loadClass(Unknown Source) at org.allcolor.yahp.converter.CClassLoader.findClass(CClassLoader.java:1495) at org.allcolor.yahp.converter.CClassLoader.findClass(CClassLoader.java:1477) at org.allcolor.yahp.converter.CClassLoader.loadClass(CClassLoader.java:2056) at java.lang.ClassLoader.loadClass(Unknown Source) at org.allcolor.yahp.converter.CYaHPConverter.getTransformer(CYaHPConverter.java:383) at org.allcolor.yahp.converter.CYaHPConverter.convertToPdf(CYaHPConverter.java:171)

code are----

CYaHPConverter converter = new CYaHPConverter(); FileOutputStream out = new FileOutputStream(pdfOut); Map<String, String> properties = new HashMap<String, String>(); // properties.put(IHtmlToPdfTransformer.FOP_TTF_FONT_PATH,BaseFont.TIMES_ROMAN); List headerFooterList = new ArrayList();
headerFooterList.add(new IHtmlToPdfTransformer.CHeaderFooter(/Header Code Here/,
IHtmlToPdfTransformer.CHeaderFooter.HEADER));
headerFooterList.add(new IHtmlToPdfTransformer.CHeaderFooter(/Footer code Here/ , IHtmlToPdfTransformer.CHeaderFooter.FOOTER)); properties.put(IHtmlToPdfTransformer.PDF_RENDERER_CLASS,IHtmlToPdfTransformer.FLYINGSAUCER_PDF_RENDERER); converter.convertToPdf(htmlIn.toURI().toURL(), new PageSize(20.8d, 29.6d, 1d, 1d, 1.6d, 1.7d), headerFooterList,
out, properties);
out.flush(); out.close();

allcolor commented 10 years ago

Either you're using the classloading feature and so you must use the jar as-is with all the internal-yahp jar inside it... or you should instantiate without the classloading features and have all the jars available in the classpath.

Regards

2014-09-29 13:29 GMT+02:00 rnagpure37 notifications@github.com:

I am use YaHp Converter in RCP Application to convert HTML page to PDF format. I make plugin from YaHp jar file. and this plugin import into our Project but to convert HTML page to Pdf its gives an Error

java.lang.ClassNotFoundException: org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer cannot be found by in.airinfotech.yahp_1.0.0 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:423) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:336) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:328) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160) at java.lang.ClassLoader.loadClass(Unknown Source) at org.allcolor.yahp.converter.CClassLoader.findClass(CClassLoader.java:1495) at org.allcolor.yahp.converter.CClassLoader.findClass(CClassLoader.java:1477) at org.allcolor.yahp.converter.CClassLoader.loadClass(CClassLoader.java:2056) at java.lang.ClassLoader.loadClass(Unknown Source) at org.allcolor.yahp.converter.CYaHPConverter.getTransformer(CYaHPConverter.java:383) at org.allcolor.yahp.converter.CYaHPConverter.convertToPdf(CYaHPConverter.java:171)

code are----

CYaHPConverter converter = new CYaHPConverter(); FileOutputStream out = new FileOutputStream(pdfOut); Map properties = new HashMap(); // properties.put(IHtmlToPdfTransformer.FOP_TTF_FONT_PATH,BaseFont.TIMES_ROMAN); List headerFooterList = new ArrayList();

headerFooterList.add(new IHtmlToPdfTransformer.CHeaderFooter( " " +

"" + " " +

"My Name

",

IHtmlToPdfTransformer.CHeaderFooter.HEADER));

headerFooterList.add(new IHtmlToPdfTransformer.CHeaderFooter(

"

" +

" Page / , IHtmlToPdfTransformer.CHeaderFooter.FOOTER));

properties.put(IHtmlToPdfTransformer.PDF_RENDERER_CLASS,IHtmlToPdfTransformer.FLYINGSAUCER_PDF_RENDERER); converter.convertToPdf(htmlIn.toURI().toURL(), new PageSize(20.8d, 29.6d, 1d, 1d, 1.6d, 1.7d), headerFooterList,

out, properties);

out.flush(); out.close();

— Reply to this email directly or view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/26.

All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)

rnagpure37 commented 10 years ago

I have set classpath in eclipse IDE already and making plugin of yahp.jar the all the needed plugin in inside the jar. but still getting this error

allcolor commented 10 years ago

This is a classpath error, that mrans it's wrong. Regards. Le 30 sept. 2014 06:19, "rnagpure37" notifications@github.com a écrit :

I have set classpath in eclipse IDE already and making plugin of yahp.jar the all the needed plugin in inside the jar. but still getting this error

— Reply to this email directly or view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/26#issuecomment-57265386 .

rnagpure37 commented 10 years ago

I set all the classpath properly but still i get this Error java.lang.NoClassDefFoundError: org/allcolor/xml/parser/dom/ADocument

allcolor commented 10 years ago

Hi, that means the shaniparser-yahp.jar is not in the classpath.

You have a classpath problem and as long as you don't describe how you start it, what is the classpath and how you use it, I cannot help you. All I can say, is that if it is properly used, it works without any classpath issues.

Regards, Quentin Anciaux

2014-10-08 9:12 GMT+02:00 rnagpure37 notifications@github.com:

I set all the classpath properly but still i get this Error java.lang.NoClassDefFoundError: org/allcolor/xml/parser/dom/ADocument

— Reply to this email directly or view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/26#issuecomment-58319064 .

All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)