Search code examples
javascriptjquerypdfcss-to-pdf

css to PDF using css2pdf@cloudformatter


i am a newbie in programming. recently tried to use the service provided by css2pdf@cloudformatter. I keep getting these errors while i try to generate a pdf

The server encountered an error processing the request. The exception message is 'Name cannot begin with the ''' character, hexadecimal value 0x27. Line 64, position 86.'. See server logs for more details. The exception stack trace is:at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) at System.Xml.XmlTextReaderImpl.ParseAttributes() at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r) at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o) at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XDocument.Load(XmlReader reader) at RenderX.WebServices.Worker.ReplaceResources(MemoryStream foStreamOriginal, MemoryStream foStreamLocalResources) in f:\Xportability\Projects\RenderX.WebServices\Src\Worker.cs:line 179 at RenderX.WebServices.Worker.generate(String xml, Attachments attachments, String systemId, String mimeType, IFormatter formatter, Func1 log, String global404, Boolean& succeed, Boolean genimages, Logger logger) in f:\Xportability\Projects\RenderX.WebServices\Src\Worker.cs:line 66 at RenderX.WebServices.Worker.Process(String xml, Attachments attachments, String systemId, String mimeType, IFormatter formatter, Func1 log, String global404, Logger logger) in f:\Xportability\Projects\RenderX.WebServices\Src\Worker.cs:line 22 at RenderX.WebServices.Chandra.Format(Stream stream) in f:\Xportability\Projects\RenderX.WebServices\Src\Chandra.svc.cs:line 68 at SyncInvokeFormat(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

An image of the error log error log

below is my code:

 <button class="btn btn-success pull-right"  onclick="return xepOnline.Formatter.Format('wrapper', {pageWidth:'216mm', pageHeight:'279mm'});">
        <i class="fa fa-print"></i><b>Print</b>

i have included the xepOnline.jqPlugin.js and jquery plugins. Thanks in anticipation of help


Solution

  • Just to wind this up with an answer as it was taken offline to solve. An examination of the data being sent to the server showed that the OP had some invalid HTML which the browser did not clear up and passed through. This was an attribute ' on an img tag.

     <img style="display: inline; float: none; padding-right: 0px; padding-left: 0px; vertical-align: middle; width: 200px; position: static; top: auto; left: auto; bottom: auto; right: auto;" src="../../uploads/admin_images/user5.jpg" alt="Uchechukwu" '="" class="img-rounded" width="200" height="200"/>  
    

    this '="" attribute was being parsed as XML and hence the error.