Hello,
I need to convert Html to Pdf in my web application and I downloaded Aspose.html (Java) library (aspose-html-18.11.1.jar) for that purpose. I tried following code in my Play (Scala) web application:
val document = new HTMLDocument("https://www.lipsum.com/feed/html")
val options = new PdfRenderingOptions()
val device = new PdfDevice(options, "/Users/nikhilm/Downloads/aspose.pdf");
val renderer = new HtmlRenderer();
renderer.render(device, document)
============
But I get following run time error:
+++++++++++++++++++++++++
play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[AssertionError: Cannot read a name from the name table in a font.]]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:293)
at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:220)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:100)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:99)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:346)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:345)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:36)
at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:70)
at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:44)
at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:252)
Caused by: java.lang.AssertionError: Cannot read a name from the name table in a font.
at com.aspose.html.internal.ms.System.Diagnostics.Debug.fail(Unknown Source)
at com.aspose.html.internal.p31.z26.m306(Unknown Source)
at com.aspose.html.internal.p31.z26.m666(Unknown Source)
at com.aspose.html.internal.p31.z26.m2(Unknown Source)
at com.aspose.html.internal.p31.z11.m1(Unknown Source)
at com.aspose.html.internal.p31.z11.(Unknown Source)
at com.aspose.html.internal.p31.z8.m618(Unknown Source)
at com.aspose.html.internal.p31.z8.m617(Unknown Source)
at com.aspose.html.internal.p31.z8.m7(Unknown Source)
at com.aspose.html.internal.p31.z10.m2(Unknown Source)
++++++++++++++++++