Forum How do I...?

XML file with CSS with a Chart or Image

elwege
I have a XML file and a CSS file. See below

Dim xmlPrint As Prince = New Prince("C:\Program Files\Prince\Engine\bin\prince.exe")
xmlPrint.SetLog(Server.MapPath("Print.log"))
xmlPrint.AddStyleSheet(Server.MapPath("Report.css"))

If xmlPrint.Convert(Server.MapPath("Report.Xml"), Response.OutputStream) Then
Response.AddHeader("Content-Type", "application/pdf")
Response.AddHeader("Content-Disposition", "attachment; filename=" & "Report.pdf")
Response.Flush()
Response.End()
Else
Response.Write("<html><body><h2>Error generating PDF</h2></body></html>")
End If

This works correct.

I have also an image file or chart. Can somebody my explain what the beste way is to include an image in this report
mikeday
In HTML documents, images can be included like this:
<img src="...filename or URL for image..."/>

If you want to use a different element or attribute name in your XML document, you can write CSS to support it. Here is an example:
image[srcurl] {
    content: attr(srcurl, url)
}
...
<image srcurl="...filename or URL for image..."/>
elwege
Thanks that workst correct.

I have another question about an image in de header.
I have try this:

image1[srcurl1] {
content: attr(srcurl1, url)

@top-right
{
font-size:11px;
border-style: none none solid none;
border-width: 1px;
border-color: black;
font-family: Arial;
font-size:11pt;
content: attr(srcurl1, url);
margin-top:45px;
margin-right:20px;

The content don't display in de header. Can you tell me wat is wrong ? Thanks
mikeday
You would need to apply the flow property to move the image to the header. The @top-right rule can only be used inside a @page rule to define the content of a page margin box. And since page margin boxes are not elements and have no attributes, the attr() function cannot be used there.