Welcome Guest Search | Active Topics | Sign In | Register

HtmlToPdf and WebResource.axd Options
Sara
Posted: Friday, June 29, 2012 12:44:58 PM
Rank: Member
Groups: Member

Joined: 6/22/2011
Posts: 22
Hi. I am using HtmlToPdf and my html points to WebResource.axd to reference some of its css files. My rendered output appears to be ignoring that css, so I'm thinking maybe HtmlToPdf is not able to load it. I'm not sure at all that my issue is with HtmlToPdf, but want to ask if HtmlToPdf should recognize and load items from WebResource.axd or if there is any setting or something I need to use to get it to do so?

Thank you!

Sara
eo_support
Posted: Friday, June 29, 2012 12:54:10 PM
Rank: Administration
Groups: Administration

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

WebResource is no different than any other Url to HtmlToPdf. So the problem must be somewhere else. I would recommend you to try to isolate the problem into a test page, that will often reveal where the problem is. Also if you use ConvertHtml, then you must set HtmlToPdfOptions.BaseUrl correctly.

Thanks!
Sara
Posted: Friday, June 29, 2012 12:59:26 PM
Rank: Member
Groups: Member

Joined: 6/22/2011
Posts: 22
Thanks. That's kind of what I was thinking. I am using ConvertHtml and I am setting the BaseUrl. I did save the html into a file on my drive. When I browse to it, the WebResource.axd links all get a 302 response. I'm sure it will hit me at some point what the problem is, but wanted to eliminate HtmlToPdf.
eo_support
Posted: Friday, June 29, 2012 1:06:43 PM
Rank: Administration
Groups: Administration

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

302 is a redirection and we can handle that fine. However a direction often occurs within the same server and that again has to do with BaseUrl if ConvertHtml is used. This can be a problem for you because a "normal" browser session always has a page Url thus BaseUrl can always be automatically deducted from the full page Url. So if you want to get exactly the same behavior as your browser, save the Html into a file and then use ConvertUrl to convert that file instead, this would be very much the same as double clicking that file to open it in your browser.

Thanks!
Sara
Posted: Friday, June 29, 2012 1:15:52 PM
Rank: Member
Groups: Member

Joined: 6/22/2011
Posts: 22
I didn't really explain my scenario...when a user hits certain pages, our app saves the rendered html to a database. In another place in the app, we retrieve that html from the db and run it through ConvertHtml to render it as a pdf. So, I think this is essentially what you are saying to do. My html has a 'base' tag pointing to the same place as the BaseUrl property. Thank you for the insight!
Sara
Posted: Friday, June 29, 2012 2:51:57 PM
Rank: Member
Groups: Member

Joined: 6/22/2011
Posts: 22
Just to give final closure to this. The 302 was being caused by forms authentication. I just needed to add a 'location' element to my web config with path attribute set to the .axd type and allowing all users access to eliminate the 302 redirect. Thanks again for your help with this!
eo_support
Posted: Friday, June 29, 2012 4:22:19 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
OK. Thanks for the update! That makes perfect sense.


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.