Welcome Guest Search | Active Topics | Sign In | Register

BaseUrl in intranet enviornment Options
nemcomedDEV
Posted: Thursday, July 5, 2012 12:04:33 PM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
My applications works fine whenever I am debugging in Visual Studio on my local machine, however once I deploy it (to an internal server for internal users) none of my images show up in the pdf nor do my custom fonts used show. I believe this is an issue with the BaseUrl member options property.

You access the website via http://servername/datasheets only **only** accessed internally.


In my debug settings I used myOptions.BaseUrl = "http://localhost:64467/"; which works locally. But once I deploy it to http://servername/datasheets it does not work.

So I tried the following changes but it has not made a difference and does not save any of the images or uses my custom fonts...

myOptions.BaseUrl = "http://servername/datasheets/";
myOptions.BaseUrl = "http://servername/datasheets";
myOptions.BaseUrl = "http://servername.domain.name.com/datasheets/";
myOptions.BaseUrl = "http://servername:80/datasheets/";
myOptions.BaseUrl = "http://servername/";
myOptions.BaseUrl = "servername/datasheets";

I've even tried to get the base url dynamiclly through c# (it returns "http://nemfp01/datasheets/")

HttpContext context = HttpContext.Current;
string baseUrl = context.Request.Url.Scheme + "://" + context.Request.Url.Authority + context.Request.ApplicationPath.TrimEnd('/') + '/';
myOptions.BaseUrl = baseUrl;

Also the settings on my folder(entire website) are to allow read/write for the following:
SYSTEM = Read/Write
LOCAL Service = Read/Write
Domain Users = Read/Write
IIS_IUSRS = Read/Write
Anonymous = Read/Write

Ive also tried setting myOptions.AllowLocalAccess = true; to see if it would make any difference... it did not.

has anyone ran into this issue and might be able to provide some insight in what needs to be done in order to run on a intranet?

eo_support
Posted: Thursday, July 5, 2012 12:11:58 PM
Rank: Administration
Groups: Administration

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

This can occur if the server name can not be correctly resolved on your server. See here for more details:

http://www.essentialobjects.com/doc/4/web/aspxtopdf.aspx#debug

The documentation is for ASPXToPDF, but it applies to HTML to PDF converter. As a simple test, you can try to login to your server locally, then type in the Url in your browser and see if it works. If that works, then our converter should work.

Thanks!
nemcomedDEV
Posted: Thursday, July 5, 2012 2:05:10 PM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
This actualy seemed to be the issue I could not access the website locally using the fqdn but could anywhere else on the network. However I changed the sites binding to point to the server name along with changing my host file so it pointed there as well. And now I can access http://servername/datasheets instead of only http://ip/datasheets and everything is displayed correctly.

However the pdf still does not display my image or the fonts. Any other suggestions?
nemcomedDEV
Posted: Thursday, July 5, 2012 4:57:58 PM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
one thing I did notice was if I put a "/" in front of my image paths('images/image.jpg' -> '/images/image.jpg') it would find the image whenever I copied them to the main folder. however it still did not find the fonts when I tried this method on them.

is there a way to see where its looking for the font?

also my baseurl is http://server/app
so inserting a "/images" makes it jump up to the server so it looks at http://server/images
But then why doesnt it do it the same way for the font? I copied them to http://server/app/<fontname>.tff (.eot) and http://server/<fontname>.tff (.eot) but it doesnt find it. any idea where it could be looking for it?
eo_support
Posted: Thursday, July 5, 2012 9:31:54 PM
Rank: Administration
Groups: Administration

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

Images and fonts are two totally different things. Images should work as soon as you have the correct Url/BaseUrl and have no problem with permission. Font are totally different. We do not load font. The font has to be installed on the server. You can only reference the font with font name.

Thanks!
nemcomedDEV
Posted: Friday, July 6, 2012 8:15:19 AM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
It currently is installed on the server under C:\windows\fonts, along with in the main dir, and the main server dir. so in http://server/<fontname> and http://server/datasheets/<fontname>
eo_support
Posted: Friday, July 6, 2012 9:57:20 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
I am not sure what you meant by "http://server/<fontname>". You can not use embedded font through an Url.

Thanks!
nemcomedDEV
Posted: Friday, July 6, 2012 10:14:35 AM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
I am refering to the server location. so if you looked at the pc path(s) my main location of sites is at C:\inetpub\wwwroot\

so this application is located at C:\inetpub\wwwroot\datasheets , So I have placed my font(s) in C:\inetpub\wwwroot\datasheets\ and in C:\inetpub\wwwroot\ and it is installed in windows(C:\windows\fonts) and works on my localmachine when I am debugging but once it is deployed nothing shows up in the pdf, even though it shows the font correctly on the webpage.
eo_support
Posted: Friday, July 6, 2012 10:25:19 AM
Rank: Administration
Groups: Administration

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

I am not sure how I can tell you this more clearly: to use a font, you install it in your windows\fonts directory. Then use it in your style. Whether you have placed your font in your c:\inetpub\wwwroot\datasheets or c:\inetpub\wwwroot\ is completely irrelevant. We do not load font through an Url. As long as the following conditions are met:

1. The font is a true type font;
2. The font is installed on your server;
3. You reference the font in your style, such as style="font-family:arial";

The font should work.

Thanks
nemcomedDEV
Posted: Friday, July 6, 2012 10:40:36 AM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
I have met all 3 requirements. I tried calling the font from the following but none of them work on the server(when I export to pdf)

<p><span style="font-family: FCGDT2"></span></p>
<p><span style="font-family: 'FCGDT2'"></span></p>
<p><span style="font-family: FCGDT2,impact,arial,sans-serif"></span></p>
<p><span style="font-family: 'FCGDT2',impact,arial,sans-serif"></span></p>
<p><span style="font-family: 'FCGDT2',impact,arial,sans-serif">asdasd</span></p>



eo_support
Posted: Friday, July 6, 2012 11:08:12 AM
Rank: Administration
Groups: Administration

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

If your server is Windows 7/2008, try to turn off UAC on your server. For some reason Windows 7/2008 won't let you to access custom font when UAC is on. If that still does not work, you will need to try to reproduce the problem on a different server, then provide us the reproducing steps. We will then try to reproduce the problem in our environment to see what we can find.

Thanks!
nemcomedDEV
Posted: Friday, July 6, 2012 2:13:37 PM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
I currently do not have UAC on, however I found something very interesting. If I host it from IIS7.5 on a win7(x64) box it works with no issue. If I host it from IIS7.5 on a win server 2008 R2(x64) box it doesnt work. would anything come to mind that might cause this?

I also tried hosting it from a different win server 2008 r2 x64 box with the same results as the first win server 2008 r 2 box.

nemcomedDEV
Posted: Friday, July 6, 2012 2:48:40 PM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
One thing I should also note is that instead of displaying the next available font ex: "font-family: FCGDT2,impact,arial,sans-serif" if FCGDT2 isnt found then it should display impact, then arial, then sans-serif. But instead it does not display anything (just blank space)
nemcomedDEV
Posted: Friday, July 6, 2012 4:50:48 PM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
did some more testing and what was weird was that it will not work on windows server 2003 iis6 as well. However I can do the converturl to pdf and it exports the font just fine on windows server 2008 r2. So the question is what is different from the convert html2pdf than the convert url2pdf functions that would make 1 work and the other not be able to find the font?
eo_support
Posted: Friday, July 6, 2012 5:00:58 PM
Rank: Administration
Groups: Administration

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

The problem would most likely be in your code. When the converter can not find a font, it will fall back to the next availabel font. So you should always see something. When you don't see anything at all, your HTML is wrong. Try create small test HTML to test on your server first. This should not have anything to do with font.

Thanks
nemcomedDEV
Posted: Monday, July 9, 2012 9:45:17 AM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
After playing with this more it seems like if I run your demo app it will create my page, but once I copy the code from your example into a live project it will not work even though I point it to the same location. Everything displays correctly on the webpage but once I host from a server 2008 r2 box it fails, if the converturl code is hosted on server 2008, it still works on my localhost. and in fail I mean it wont display the font.
nemcomedDEV
Posted: Monday, July 9, 2012 10:11:31 AM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
in simplier terms I run the following code

PdfDocument doc = new PdfDocument();
HtmlToPdf.ConvertUrl("http://nemfp01/datasheets/view.aspx?id=92&speclist=9&type=view", doc);

//Setup HttpResponse headers
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ClearHeaders();
response.ContentType = "application/pdf";

//Send the PdfDocument to the client
doc.Save(response.OutputStream);

Response.End();


on my pc (localhost) = it works
on the demo.exe (server 2008) = it works
on iis7.5 on server 2008 = it fails

same code on all instances. to me it seems like a bug with server 2008 r2 & iis7.5
nemcomedDEV
Posted: Monday, July 9, 2012 11:22:23 AM
Rank: Member
Groups: Member

Joined: 6/26/2012
Posts: 17
I also setup a test page to prove it’s not my code. and set the convert url to test.html and I get the same results. Test.html contains the following code:

<html>
<body>
<span style="font-family: 'FCGDT2',impact,arial,sans-serif">hello</span>
</body>
</html>
eo_support
Posted: Monday, July 9, 2012 12:00:09 PM
Rank: Administration
Groups: Administration

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

We do not know what else to tell you on this. The next step would be for us to reproduce the problem. You can send us the font file and we will try the same font on our 2008 R2 system. If that can duplicate the problem, then we will investigate further. If that can not duplicate the problem, then we have no way of going any further. We will PM you as to where to send the file.

Thanks
eo_support
Posted: Tuesday, July 10, 2012 5:46:08 PM
Rank: Administration
Groups: Administration

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

We are able to consistently reproduce this problem on both Windows 2008 R2 and Windows 2003 systems. On Windows 2008 R2 as long as we turn off UAC the problem will go away. This is a known issue on Windows 2008 and turnning off UAC is the recommend solution for this problem.

We have not been able to find a solution for Windows 2003 system yet. We will continue working on it and let you know as soon as we find anything.

BTW: Your font file is actually marked as "not allow to be embedded". This means you are actually not allowed to use your font this way. We suppose to honor this flag but we didn't. So you might want to seek for another solution about this. We may start to honor this flag in a future version, when we do that it will refuse to embed this font.

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.