Welcome Guest Search | Active Topics | Sign In | Register

ASPX_to_PDF Timeout when loading dynamic images Options
smurphy
Posted: Monday, October 31, 2011 1:55:54 PM
Rank: Newbie
Groups: Member

Joined: 10/31/2011
Posts: 4
Hi,

I am considering buying your product as I have been extremely happy with the quality of the PDF output, however, I am having issues displaying dynamic images.

I am generating a pdf where my page includes a Repeater that contains images uploaded by the user. I am databinding the ImageUrl of the Image inside the Repeater to point to my image handler "img_display.ashx". My image handler then generates the image stored in the database. See below:

Code: HTML/ASPX
<asp:Repeater runat="server" ID="rpt_images" DataSourceID="sds_images">
    <ItemTemplate>
        <asp:Image ID="img_photo" runat="server" CssClass="bordered" ImageUrl='<%# "~/media/img_display.ashx?image=" + Eval("ImageID").ToString() + "_0x0" %>' />
    </ItemTemplate>
</asp:Repeater>


If I comment out the line "AspxToPdf1.RenderAsPDF(fileName);" in my .cs I can view my web page and see the images displaying correctly. I am also using the same image handler throughout the site so I know there is no problem with it.

Also if I replace my dynamic ImageUrl to point directly to an image location on the server, then I can RenderAsPDF correctly.

The issue arises when I attempt to RenderAsPDF using the databound ImageUrl. This times out every time regardless of the image size, number of images, image quality etc.

I have also tested by setting up breakpoints in my code both at the point where RenderAsPDF and within my image handler. I can see when I step through that RenderAsPDF is triggered but the process does not get as far as my image handler when using the databound ImageUrl.

Any help would be greatly appreciated. As I mentioned, I fully intend to have my company purchase the full version once I can show the client that this is working.

Thanks.
eo_support
Posted: Monday, October 31, 2011 2:08:51 PM
Rank: Administration
Groups: Administration

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

This is almost always caused by DNS for your own host name not properly configured/resolved on the web server itself. Usually the DNS is always properly configured for resolving the web server from outside (because otherwise other people won't be able to access your website at all). However it would often occur that the same DNS setting does not work when you access your website directly from your web server locally.

For example, if the Url is "www.yourdomain.com/Page1.aspx" and your server's public IP address is "11.22.33.44", then everybody who access that Url from the Internet will try to connect to "11.22.33.44" which will work fine. However if you try to log into your web server locally, open IE and then access the same Url, then you may NOT be able to open the Url at all because depending on your network configuration, the same IP address may not be reachable from the web server locally. When that happens, the HTML to PDF converter will get time out error because it is unable to get the image files. Not necessary just DNS, but web server bindings, firewall settings (even though its rare firewall would block local connections) can cause this problem as well.

To fix the problem, make sure you can access the same page fine locally from your web server. Usually this can be easily resolved by modify your web server’s local host file to map the server’s host name to an internal IP address used by the server. You may also need to adjust your web application’s binding settings so that it accepts connections from that internal IP address as well.

Hope this helps. Please feel free to let us know if you still have problems.

Thanks!
smurphy
Posted: Monday, October 31, 2011 3:53:02 PM
Rank: Newbie
Groups: Member

Joined: 10/31/2011
Posts: 4
I'm sorry but I'm not sure I understand.

I am having this issue both on my local dev machine and on my web server. The url is publicly available and so is the handler. The page and handler work fine on both dev and server until I add the line "AspxToPdf1.RenderAsPDF(fileName);".

Can you provide any further information or any other suggestions?

Thanks.
smurphy
Posted: Monday, October 31, 2011 4:25:33 PM
Rank: Newbie
Groups: Member

Joined: 10/31/2011
Posts: 4
eo_support
Posted: Monday, October 31, 2011 6:09:28 PM
Rank: Administration
Groups: Administration

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

Try to set ASPXToPDF.AutoFormsAuthentication to false and see if that makes a difference. The default value is true, which instructs ASPXToPDF to automatically impersonate your session cookies. When this is enabled, it may cause a dead lock on the session lock when both your client browser and ASPXToPDF are waiting for each other on the same session.

Note that once you set AutoFormsAuthentication to false, you will not be able to see your session variable inside your img_display.ashx handler. If that handler does not rely on any session information, then you do not need to make any further change. Otherwise you will need to have the information pass in through query string to your handler.

Please let us know if this solves the problem for you.

Thanks!
smurphy
Posted: Monday, October 31, 2011 6:41:28 PM
Rank: Newbie
Groups: Member

Joined: 10/31/2011
Posts: 4
That worked great on all browsers! I'm really impressed with how the PDF looks.

Thanks for the assistance!
eo_support
Posted: Tuesday, November 1, 2011 8:16:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Glad to hear that! Thank you very much for confirming it works!


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.