|
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
|
|
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!
|
|
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.
|
|
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!
|
|
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!
|
|
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!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
OK. Thanks for the update! That makes perfect sense.
|
|