HtmlConverter: The path is not of a legal form.

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Converter for .NET (v3)  /  HtmlConverter: The path is not of a legal form.

DynamicPDF Converter for .NET (v3) Forum

Hello,

I am trying to convert a html file to pdf file.

But the process throws the exception:
The path is not of a legal form.   at ceTe.DynamicPDF.Conversion.HtmlConverter.b(String A_0)
   at ceTe.DynamicPDF.Conversion.HtmlConverter.a.a()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

The version of the library DynamicPDF.Converter.NETStandard20 is v3.9.0.43617

The OS is Windows Server 2016

Please, can you help me?

Thanks
Posted by a ceTe Software moderator
Hello,

The error indicates that the path specified for conversion is an incorrect format. Please try using a valid path for the HTML file and see if it resolves issue for you.

One thing you can do to verify the path is to read the HTML file into a byte array and use it for the conversion. Here is a code sample:

            string SourceFilePath = @"Input HTML file path";
            string DestinationFilePath = @"Output PDF file path";

            byte[] input = File.ReadAllBytes(SourceFilePath);
            byte[] byteData = Converter.Convert(input, System.IO.Path.GetFileName(SourceFilePath));
            File.WriteAllBytes(DestinationFilePath, byteData);

Thanks,
ceTe Software Support Team
Hello,

Using your code also throws the same error.

The problem occurs when we use the library from a WCF webservice. From a console application it works correctly.

Thanks,
Posted by a ceTe Software moderator
Hi,

The issue is likely a permissions issue then. Make sure that the user that the WCF web service is running under has access to the path. That should resolve the issue.

Thanks,
ceTe Software Support Team
Hi,

What path use HtmlConvert?

Thanks
Hi,

I see that the HtmlConverter.ChromiumProcessPath property is empty.

It's possible that unable to extrat the necessary files. For example: BrowserProc.exe

Can we manually extract the files and tell the library where they are found?

Thanks

Hi,
My process runs under IIS.
We have build a WCF service.
 When we run process have the next errors:

Se han producido uno o varios errores.
   en System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   en System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   en ceTe.DynamicPDF.Conversion.Converter.Convert(Byte[] inputData, String inputFileName)
   en WcfServiceLibrary1.Service1.GetData(Int32 value) en C:\Program Files\GCO\TEST PDF\WcfServiceLibrary1\Service1.cs:línea 22

Se han producido uno o varios errores.
   en ceTe.DynamicPDF.Conversion.Converter.d(ConversionOptions A_0)
   en ceTe.DynamicPDF.Conversion.Converter.b(ConversionOptions A_0)
   en ceTe.DynamicPDF.Conversion.Converter.h.a()
   en System.Threading.Tasks.Task`1.InnerInvoke()
   en System.Threading.Tasks.Task.Execute()

Se han producido uno o varios errores.
   en ceTe.DynamicPDF.Conversion.HtmlConverter.b(String A_0)
   en ceTe.DynamicPDF.Conversion.HtmlConverter.a.a()
   en System.Threading.Tasks.Task`1.InnerInvoke()
   en System.Threading.Tasks.Task.Execute()

Se han producido uno o varios errores.
   en System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   en System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   en zz93.c.a.a()
   en System.Threading.Tasks.Task`1.InnerInvoke()
   en System.Threading.Tasks.Task.Execute()

Conversion failed. Refer inner exception for details.
   en zz93.c.o.MoveNext()
--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---
   en System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   en zz93.c.o.MoveNext()
--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---
   en System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   en zz93.c.m.MoveNext()

Se han producido uno o varios errores.
   en zz93.c.o.MoveNext()

Error al enviar la solicitud.
   en System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   en ceTe.DynamicPDF.Conversion.DevTools.RuntimeCLI.Chrome.<CreateNewSession>d__6.MoveNext()

No es posible conectar con el servidor remoto
   en System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   en System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)

La dirección solicitada no es válida en este contexto
   en System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP, Boolean flowContext, AsyncCallback callback, Object state)
   en System.Net.Sockets.Socket.UnsafeBeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state)
   en System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
Hi,

We have fixed the issue.

Thanks
Hi,

We have fixed the issue.

Thanks
Hi,

We have fixed the issue.

Thanks

All times are US Eastern Standard time. The time now is 6:23 PM.