Hi Aspose-Support,
I´m trying to convert a html page to pdf and get a System.ArgumentOutOfRangeException: 'Specified argument was out of the range of valid values. '.
See the code below. The exception occures at Converter.ConvertHTML
.
var cc = new CookieContainer();
foreach (var cookieKey in Request.Cookies.Keys)
{
try
{
cc.Add(
new Uri($"{Request.Scheme}://{Request.Host}{Request.PathBase}"),
new Cookie(cookieKey, Request.Cookies[cookieKey]));
}
catch (CookieException ex)
{
_logger.LogWarning(ex, $"[{nameof(Print)}] Error while adding cookie to collection");
}
}
using var request =
new RequestMessage(Url.Action("Summary", "Application", new { id = viewModel.ApplicationId }, Request.Scheme))
{
CookieContainer = cc
};
using var document = new HTMLDocument(request, new Configuration());
Converter.ConvertHTML(
document,
new PdfSaveOptions(),
Path.Combine(_configuration.AppDataPath, WellKnownDataFolders.Temp, fileName));
See the callstack below, that I get.
at ..MoveNext()
at . .MoveNext()
at . .MoveNext()
at . .MoveNext()
at . [TSource](IEnumerable`1 , Func`2 , Action )
at .( , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at ..(Tuple`2 )
at . [TSource](IEnumerable`1 , Func`2 , Action )
at .( , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at ..(Tuple`2 )
at . [TSource](IEnumerable`1 , Func`2 , Action )
at .( , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at ..(Tuple`2 )
at . [TSource](IEnumerable`1 , Func`2 , Action )
at .( , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at ..(Tuple`2 )
at . [TSource](IEnumerable`1 , Func`2 , Action )
at .( , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at ..(Tuple`2 )
at . [TSource](IEnumerable`1 , Func`2 , Action )
at .( , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .( , , , , , , Boolean , List`1 , List`1 , List`1 , List`1 )
at .(Document , , , , Boolean , , Int32 , , RenderingOptions )
at .(Document , Int32 , , , RenderingOptions )
at . .MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at .[TSource](IEnumerable`1 )
at .(Document , , , , RenderingOptions )
at .(Document , RenderingOptions , IDevice , )
at . (IDevice , )
at .()
at .MoveNext()
at . (Renderer , [] , IDevice , TimeSpan )
at Aspose.Html.Rendering.HtmlRenderer.(IDevice , TimeSpan , Element[] , Document[] )
at Aspose.Html.Rendering.HtmlRenderer.Render(IDevice device, TimeSpan timeout, Document[] documents)
at Aspose.Html.Rendering.Renderer`1.Render(IDevice device, TDocument document, TimeSpan timeout)
at Aspose.Html.Rendering.Renderer`1.Render(IDevice device, TDocument document)
at .( , IDevice )
at . ( , PdfSaveOptions , ICreateStreamProvider )
at . (HTMLDocument , PdfSaveOptions , String )
at Aspose.Html.Converters.Converter.ConvertHTML(HTMLDocument document, PdfSaveOptions options, String outputPath)
at ApplicationController.<Print>d__49.MoveNext() in