PNG problem
Hi When I use jpg as imageformat,everything goes finen but when I use a png, my image isn't showed in the pdf.
This is the error in the logfile:
Tue Apr 13 14:23:03 2010: ---- begin
Tue Apr 13 14:23:03 2010: Loading document...
Tue Apr 13 14:23:04 2010: http://localhost:50377/Docubis/images/header2.png: warning: Unknown image MIME type: application/octet-stream
Tue Apr 13 14:23:04 2010: Converting document...
Tue Apr 13 14:23:04 2010: finished: success
Tue Apr 13 14:23:04 2010: ---- end
Can you make your server use the correct MIME type, eg. "image/png" instead of "application/octet-stream"?
Is the image a static file or generated by some kind of script? What is the server software?
I generate the image like this:
header.innertHtml += @"<img src="database-source" id="Id" />";
Jpg's do work so that shouldn't be the problem....
So the image is coming out of a database? If JPEG images work, I'm surprised that it doesn't recognise PNG files. It should set the Content-Type automatically based on the file extension.
Yes the imagepath is coming from the database. Yeah it's strange for me too...
The image path is coming from the database, eg. "
http://localhost:50377/Docubis/images/header2.png"? But which code is responsible for actually serving up this file, when it receives a request for this URL? That's the code that needs to be changed. Where is "header2.png" stored, basically.
BLDocPart blDocPart = new BLDocPart();
List<DocPart> docParts = blDocPart.getDocPartsByDocId(document.DocId);
HtmlGenericControl genControl = (HtmlGenericControl)FindControl(tempPart.CssId);
string ImagePath = "../images/" + docParts[i].Value;
genControl.InnerHtml += @"<img height='100' runat='server' width='500' src='" + ImagePath + "' /><br />";
When I view this page in the browser everything is fine, but when I convert it to pdf, the png images aren't showed
Yes, we've established that. The question is, which code is serving up the actual image? The code you've pasted only gives the URL for the image, which Prince will later try to download. If it's ASP itself serving up the image, and not your code, then this may get tricky, as I don't know where ASP stores its mapping of file extensions to MIME types. You may need to ask this question on an ASP.NET forum to solve the problem.
Prince 8.0 now tries harder to load images that are incorrectly assigned the wrong MIME type, which should solve this issue.