Welcome Guest Search | Active Topics | Sign In | Register

Convert Url Problem with Telerik RadChartHtml Options
IT-Presswerk Wolfsburg
Posted: Thursday, March 9, 2017 1:57:59 AM
Rank: Newbie
Groups: Member

Joined: 10/10/2016
Posts: 8
Hi,

I'm currently using ConvertUrl() to convert multiple one-pagers into a pdf folder (for-loop). Each page contains two HTML Tables and one RadHtmlChart-Control (http://demos.telerik.com/aspnet-ajax/htmlchart/examples/charttypes/barchart/defaultcs.aspx).

We use a Windows Task to execute the console application daily. It mostly works, but sometimes every second page doesn't contain the Chart Control. The other pages do contain it!

I've already tried to increase the HtmlToPdf.Options.MinLoadWaitTime to 2000, no success.

I'm not aware of any trigger in the chart control I could use to start the manual conversion trigger in EO.

Any help would be appreciated!

Jan
eo_support
Posted: Saturday, March 11, 2017 3:49:21 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,082
Hi,

Sorry about the delay. We can not think of any reason why one page does contain the chart and the other page doesn't. Is there anyway you can create a test project and send the test project to us? See here for more details:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!
IT-Presswerk Wolfsburg
Posted: Monday, March 13, 2017 2:43:49 AM
Rank: Newbie
Groups: Member

Joined: 10/10/2016
Posts: 8
I don't think it's possible, as the Telerik Libraries are licensed and I'm not allowed to share them to you. But to make the problem a litte more clear, I try to post some code snippets below to show the problem.

Program.cs:
Code: C#
foreach (int anlage in anlagen)
{
	var anlageTitle = new Base.Stammdaten.Anlagen(anlage).Title;
	PDFName = PathTagesberichtNeu + "/" + Jahr + "/" + Woche + "/" + Tag + "/Anlagenbericht-" + Jahr + "-" + Woche + "-" + Tag + "-Anlage-" + anlageTitle + ".pdf";

	EO.Pdf.PdfDocument doc = Base.Berichte.Tools.Helper_Header_Footer.GetEoPdfDocument(landscape_page,
		landscape_area, cssData,
		"Anlagenbericht " + anlageTitle + 
	  , s_Path);

	HtmlToPdf.Options.MinLoadWaitTime = 2000;

	//EO.Pdf.HtmlToPdf.UseClassicEngine();
	EO.Pdf.HtmlToPdf.Options.ZoomLevel = 0.8f;
	EO.Pdf.HtmlToPdf.Options.FooterHtmlPosition = EO.Pdf.HtmlToPdf.Options.PageSize.Height - 0.7f;

	EO.Pdf.HtmlToPdf.ConvertUrl(
		Base.Exec.Settings.LocalTempDomain + "/mberichte/Modules_Bericht_TagesberichtProd_Neu_Print.aspx"
		+ "?jahr=" + Jahr
		+ "&woche=" + Woche
		+ "&tag=" + Tag
		+ "&anlageid=" + anlage
		, doc);


	doc.Save(PDFName);
}


Modules_Bericht_TagesberichtProd_Neu_Print.aspx
Code: HTML/ASPX
<div id="grids" style="float: left; width: 100%">
	<asp:Literal runat="server" ID="lit_bericht" />

</div>
<div style="clear: both" />
<br />
<div style="width: 100%; float: left">
	<div style="float: left">
		<h2 id="header_hubzahlverlauf" runat="server">Hubzahlverlauf letzte 10 Tage</h2>
		<div id="chart_div" runat="server" style="float: left; border: 1px solid lightgray"></div>
	</div>
	<div style="float: left; margin-left: 10px">
		<h2 id="header_topx" runat="server">Top 10 Stillstände</h2>
		<asp:Literal runat="server" ID="lit_top10"></asp:Literal>
	</div>
</div>



Modules_Bericht_TagesberichtProd_Neu_Print.aspx.cs
Code: C#
var radHtmlChart = bericht.GetChart(-xTage, minHitsSoll);
if (radHtmlChart != null)
{
	chart_div.Controls.Add(radHtmlChart);
}
else
{
	chart_div.InnerText = "&lt;h3&gt;Kein Hubzahlverlauf verfügbar.&lt;/h3&gt;";
	missingDataCount++;
}
eo_support
Posted: Monday, March 13, 2017 12:47:42 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,082
Hi,

Your code looks fine. There isn't much we can do without being able to see the problem. One thing you can try to do is to capture a static set of files (HTML, JavaScript, CSS, etc) that represents the rendered result of your page, then try to call our converter on that static page. If this always works fine, then the issue is not in the converter, but in the process that generates those pages, this generally means the issue is on your server or server side code. In that case you would need to troubleshoot/address those yourself. If the problem does occur with the static set of files, you can send those files along with a small test project to us. Since you are just converting static files, there should be no dependency on any third party libraries.

Thanks!
IT-Presswerk Wolfsburg
Posted: Tuesday, March 14, 2017 2:15:18 AM
Rank: Newbie
Groups: Member

Joined: 10/10/2016
Posts: 8
I don't think they are all static files, as the Chart is a dynamic Javascript control. Is there any chance to debug the Javascript code, see if there's an error? Or maybe some kind of "document.onload" method i can override to manually start the conversion?
eo_support
Posted: Tuesday, March 14, 2017 9:11:45 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,082
Jan wrote:
I don't think they are all static files, as the Chart is a dynamic Javascript control. Is there any chance to debug the Javascript code, see if there's an error? Or maybe some kind of "document.onload" method i can override to manually start the conversion?


All "dynamic" occurs on your server side. The process is:

1. Your server side code (including Telerik's Chart control) dynamically generates script files;
2. That script files is sent to the client side your browser;

What we were asking is to save the script the browser got on step 2 as static files. This removes step 1 from the process. However from the browser point of view on step 2, it doesn't really care how the script file is generated --- as soon as it can get the correct script, it should run. Hope this makes sense to you.

You can also use the debug console to trace any JavaScript error:

https://www.essentialobjects.com/doc/eo.pdf.htmltopdf.debugconsole.aspx

Thanks!
IT-Presswerk Wolfsburg
Posted: Friday, March 17, 2017 5:11:42 AM
Rank: Newbie
Groups: Member

Joined: 10/10/2016
Posts: 8
I implemented a Thread.Sleep and the debugger, we will see. The static content ist just a few seconds available, as there is some dynamic script content which is temporarily served. I'm sorry I cannot provide a working copy of the report for you.
IT-Presswerk Wolfsburg
Posted: Monday, March 20, 2017 7:58:41 AM
Rank: Newbie
Groups: Member

Joined: 10/10/2016
Posts: 8
Adjusting the process to sleep didn't help, but at least I got an error log showing some caching problems (if I interpret it correctly).

Any thoughts to that? Maybe a EO.CachePath problem using the same cache for multiple conversions?

Code: JavaScript
->Converting Anlagenbericht 742 at Sonntag, 19. März 2017 06:54:43
Source: http://localhost/jquery/jquery-1.10.2.min.js
Line #: 0
Severity: Error
Failed to load resource: net::ERR_CACHE_READ_FAILURE

Source: http://localhost/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl05_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3ade%3ad28568d3-e53e-4706-928f-3765912b66ca%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2014.2.724.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3ade%3a9ac720df-7b88-4e1e-8026-2b8c24207e88%3a16e4e7cd%3af7645509%3a24ee1bba%3a4cd1fec6%3a9b7cc2d2%3a8d1fecce%3ad944e0f6%3ac442ac3f%3aec7335e%3a69667591%3a6b6b9ee5%3af7a2f0e3%3a675e40c2%3a595e7652
Line #: 0
Severity: Error
Failed to load resource: net::ERR_CACHE_READ_FAILURE

Source: http://localhost/mberichte/Modules_Bericht_TagesberichtProd_Neu_Print.aspx?jahr=2017&woche=11&tag=6&anlageid=32
Line #: 57
Severity: Error
Uncaught Error: Fehler beim Laden des clientseitigen ASP.NET Ajax-Frameworks.

Source: http://localhost/mberichte/Modules_Bericht_TagesberichtProd_Neu_Print.aspx?jahr=2017&woche=11&tag=6&anlageid=32
Line #: 67
Severity: Error
Uncaught ReferenceError: Sys is not defined

Source: http://localhost/mberichte/Modules_Bericht_TagesberichtProd_Neu_Print.aspx?jahr=2017&woche=11&tag=6&anlageid=32
Line #: 124
Severity: Error
Uncaught ReferenceError: Sys is not defined

->Converting finished at Sonntag, 19. März 2017 06:54:57
eo_support
Posted: Monday, March 20, 2017 11:05:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,082
Hi,

This makes sense. The chart won't be rendered correctly if the underlying JavaScript file can not be properly loaded. The messages indicates that the browser engine is trying to load the file from cache but is unable to do so.

The most common reason for this is you have some background program that locked the cache file. The most common type of such background program including indexing service, backup service or AntiVirus program. So you can check if your system have such program and temporarily disable them to see if that fixes the issue for you. Another work around would be disabling cache in your page's header. That would be the less preferred option since it would have an impact on the performance.

Also please check if you are running the latest build. There is always a chance that this is an issue on our end and it has either been fixed directly or indirectly, so it's always worth a try to see if the latest build resolves the issue for you.

Thanks!
IT-Presswerk Wolfsburg
Posted: Tuesday, March 21, 2017 3:30:27 AM
Rank: Newbie
Groups: Member

Joined: 10/10/2016
Posts: 8
eo_support wrote:
So you can check if your system have such program and temporarily disable them to see if that fixes the issue for you. Another work around would be disabling cache in your page's header. That would be the less preferred option since it would have an impact on the performance


I will try both and respond soon.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.