Welcome Guest Search | Active Topics | Sign In | Register

Google Streeview image not rendering Options
John
Posted: Wednesday, October 23, 2013 11:24:54 AM
Rank: Newbie
Groups: Member

Joined: 10/23/2013
Posts: 2
We are evaluating your product and are pleased with the ease of use. The one area we're running into issue with is a google streetview image that is displaying on the screen but not in the pdf. Is there a reason that the image wouldn't render in the pdf? Below is the controller action that is being used:

<RenderAsPDF(AutoConvert:=False)> _
Public Function PrintPropertyCard(id As String) As ActionResult
Dim propertyData As PropertyData = New PropertyData()

Try
propertyData.GeneralInformation = GetGeneralInfo(id)(0)
propertyData.Building = GetBuildingInformation(id)
propertyData.Land = GetLand(id)
propertyData.Values = GetValues(id)
propertyData.OtherImprovements = GetOtherImprovements(id)
propertyData.Transfers = GetTransfers(id)
propertyData.CurrentYearTaxSummary = CurrentTaxSummary(id)
propertyData.PermitsForCard = GetPermitsForCard(id)

EO.Pdf.HtmlToPdf.Options.PageSize = New System.Drawing.SizeF(8.5F, 11.0F)
EO.Pdf.HtmlToPdf.Options.OutputArea = New System.Drawing.RectangleF(0.25F, 0.25F, 8.0F, 10.5F)
EO.Pdf.HtmlToPdf.Options.FooterHtmlFormat = "Information included on this report is believed to be accurate, but is not guaranteed. Cuyahoga County is not liable for errors or omissions."
MVCToPDF.ResultFileName = id
MVCToPDF.RenderAsPDF()

Return View("PropertyCardFull", propertyData)
Catch ex As Exception
Dim errString As String = "<html><head></head><body><h1>Error Generating PDF:</h1><br />" & ex.Message & "</body></html>"

Return Content(errString, System.Net.Mime.MediaTypeNames.Application.Pdf)
End Try
End Function
eo_support
Posted: Wednesday, October 23, 2013 11:59:47 AM
Rank: Administration
Groups: Administration

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

The most likely reason is the timing of the conversion. May web pages such as Google map or street views load the initial page very fast and then use JavaScript to load additional information. The converter would run all those JavaScript code the same way as a browser does, but it does not know at which point everything in the page is loaded. So it's possible that the converter kicks in before all dynamically loaded contents are loaded. When that happens, you will see missing contents.

There are two ways to resolve this problem. One way is to increase HtmlToPdf.Options.MinLoadWaitTime. This option simply instructs the converter to wait for a given period of time before starting the conversion. Another way is to use manual trigger:

http://www.essentialobjects.com/doc/4/htmltopdf/eo_js.aspx#manual_trigger

With manual trigger, you will have to explicitly call eopdf.convert() from JavaScript in order for the conversion to start. In order to do that, you will need to find out the proper event of Google StreeView API that would tell you when everything in your page is loaded. Inside that event handler you can then call eopdf.convert().

Hope this helps. Please let us know if it works for you.

Thanks!
John
Posted: Wednesday, October 23, 2013 2:17:39 PM
Rank: Newbie
Groups: Member

Joined: 10/23/2013
Posts: 2
I don't think timing is the issue. I've tried setting the MinLoadWaitTime up to 10000 miliseconds and it's the same thing. I'm getting a question mark image, is that something you put in? Also, I'm using MVCToPDF so I don't know why I would use the javascript solution.
eo_support
Posted: Wednesday, October 23, 2013 2:36:31 PM
Rank: Administration
Groups: Administration

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

If you are getting a question mark image, then it means the converter has tried to load the image but is not able to due to some reasons. There are two usual causes: 1. The Url is wrong. 2. The Url is not wrong, but it requires some kind of authentication that somehow the converter is not able to do. You will want to find out which case it is first.

The first problem should be easy to fix. As to the second problem, usually it has to do with cookies. The converter does not have your cookies because it's a completely different sessions (your session is between your client machine to Google's server, the converter's session is between the converter, which runs on your web server, to Google's server). The converter will automatically duplicates ASP.NET session cookies for you so that it is able to make your ASP.NET web server think these two sessions are the same. However for other third party solutions, usually you have to explicitly attach authentication cookies (or whatever other cookies that solution needs) through HtmlToPdf.Options.Cookies. One way for you to find out why the converter is not able to load the image is to run a network traffic analyzer on your web server (or your own development machine the problem occurs on your dev machine) while performing the conversion. The analyzer should show you that the request is sent and what kind of respond it gets from the server. That should help you identify the root cause.

As a side note, MVCToPDF and JavaScript solution are not mutually exclusive. MVCToPDF feed the input HTML (using your MVC page's rendering result HTML) to the converter. The JavaScript interface determines when the conversion starts. So they are at two totally different stage of the conversion process.

Thanks!


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.