Dear Experts,
Thanks for your help and Time.

I have an application in asp.net , i am using HTML code , JavaScript and CSS there.
My application is also creating pdf file. 20 days back , My reports comming up with out background color or you can Say with out CSS implementation.

PDF is comming , but without CSS implementation (No Colors /format).
Where the problem might be.

Javascript ?
CSS ?
HTML Validation ? (As whole software is not html validated) developed in 2003.
OR some Thing Else ?

I am really Upset , after 20 days can not fix it.

Implemented on www.ict-m.com.

JavaScript in File

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">

function selhead(theElement) {
	var e=document.getElementById('atitle');
	e.checked=theElement.checked;
	e=document.getElementById('ptitle');
	e.checked=theElement.checked;
}
function sel(theElement) {
	
     var theForm = theElement.form, z = 0;
	 var t=theForm["no"].value;
	 var tx='';
	
	for (i=1;i<=t;i++)
	{
		var el=document.getElementById('print_'+i);
		if (el.type=='checkbox')
			el.checked=theElement.checked;
	}
}
function prev(fn,no){
	var frm=document.getElementById('frm');
	frm.target="_blank";
	frm.action='prev1.aspx?n='+no;
	frm.submit();
}
function final(){
	var frm=document.getElementById('frm');
	frm.target="_blank";
	frm.action='print_first.aspx';
	frm.submit();
}
function sp() {
	var frm=document.getElementById('frm');
	frm.target="_self";
	frm.action='save_print.aspx';
	frm.submit();
}

</script>
<link href="../../CSS/ee.css" rel="stylesheet" type="text/css" />
</head>
...

...
//Calling here
    <td nowrap="nowrap" class="print_data"><div align="center"><a href="javascript:prev('<%=dr["sub_id"]%>','<%=i%>')">Preview</a></div></td>

Prev1.aspx:

<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import namespace="APServerNET"%>
<%@ Import namespace="APWebGrbNET"%>
<%@ Import namespace="APToolkitNET"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<%
    OleDbConnection conn = new OleDbConnection(System.Configuration.ConfigurationManager.AppSettings["MM_CONNECTION_STRING_ictmdb"]);
    

    
try{
	string comp=Request.Form["comp"];
	string project=Request.Form["project"];
	string app_name=Request.Form["app_name"];
	string application=Request.Form["application"];
	string ctitle_align=Request.Form["ctitle_al"];
	string atitle_align=Request.Form["atitle_al"];
	string ptitle_align=Request.Form["ptitle_al"];		
	string atitle=Request.Form["atitle"];
	string ptitle=Request.Form["ptitle"];		
//	Response.Buffer=false;
	Server.ScriptTimeout=2400;
	string pdfurl="";
	int no=Convert.ToInt32(Request.Form["no"]),i=0;
	string ht=Request.Form["ht"];
	string ft=Request.Form["ft"];	

	ht="<br><br><table cellpadding=0 celspacing=0 width='100%'><tr><td width='33%' valign='top'>";
	bool f=false;
	if (ctitle_align=="1") {
		ht+=comp;f=true;
	}
	if(ptitle=="Y" && ptitle_align=="1") {
		ht+=(f)?"<br>":"";
		ht+=project;
		f=true;
	}
	if(atitle=="Y" && atitle_align=="1") {
		ht+=(f)?"<br>":"";
		ht+=application;
		f=true;
	}
	ht+="</td><td width='33%' valign='top' align='Center' >";
	f=false;
	if (ctitle_align=="2") {
		ht+=comp;f=true;
	}
	if(ptitle=="Y" && ptitle_align=="2") {
		ht+=(f)?"<br>":"";
		ht+=project;
		f=true;
	}
	if(atitle=="Y" && atitle_align=="2") {
		ht+=(f)?"<br>":"";
		ht+=application;
		f=true;
	}
	ht+="</td><td width='33%' align='right' valign='top' >";
	f=false;
	if (ctitle_align=="3") {
		ht+=comp;f=true;
	}
	if(ptitle=="Y" && ptitle_align=="3") {
		ht+=(f)?"<br>":"";
		ht+=project;
		f=true;
	}
	if(atitle=="Y" && atitle_align=="3") {
		ht+=(f)?"<br>":"";
		ht+=application;
		f=true;
	}
	ht+="</td></tr></table><hr>";
    
	APWebGrabber wb=new APWebGrabber();
	APServer aps=new APServer();
	StringWriter wtr=new StringWriter();	
	i=Convert.ToInt32(Request.QueryString["n"]);
			string pg=Request.Form["fn_"+i];			
				Server.Execute(pg,wtr);			
			string htm=wtr.ToString();           
           htm=htm.Replace("/ictm/soft/tmp/","http://192.168.0.106/ictm/soft/tmp/");
          htm=htm.Replace("/ictm/images/","http://192.168.0.106/ictm/images/");
            
			pdfurl="http://192.168.0.106" + Request.FilePath;
			wb.URL=pdfurl;
			wb.PrintBackgroundColors=0;
			wb.HTMLTextToFile=true;
			wb.CreateFromHTMLText=htm;
			
			if (Request.Form["back_"+i]=="Y")
				wb.EngineToUse=1;
			else
				wb.EngineToUse=0;
				
			aps.PaperSize=Convert.ToInt16(Request.Form["pg_"+i]);
			aps.Orientation=Convert.ToInt16(Request.Form["ori_"+i]);
			aps.Scaling=Convert.ToInt16(Request.Form["scaling_"+i]);
			wb.LeftRightMargin=(int)(Convert.ToDouble(Request.Form["lm_"+i])*600);
			wb.TopBottomMargin=(int)(Convert.ToDouble(Request.Form["tm_"+i])*600);
			wb.IELeftMargin=(float)Convert.ToDouble(Request.Form["lm_"+i]);
			wb.IERightMargin=(float)Convert.ToDouble(Request.Form["rm_"+i]);
			wb.IETopMargin=(float)Convert.ToDouble(Request.Form["tm_"+i]);
			wb.IEBottomMargin=(float)Convert.ToDouble(Request.Form["bm_"+i]);		
			wb.HeaderHTML=ht;
			wb.FooterHTML="<hr>";
			
			aps.OutputDirectory=Server.MapPath("/ictm/soft/tmp/reports");
			wb.Prt2DiskSettings=aps.XMLData();
			int ixi=wb.DoPrint("192.168.0.106",64320);
       
            if (ixi!=0) {
				Response.Write("There is a error "+ ixi);
				Response.End();
			}
            string wr = wb.Wait("192.168.0.106", 64320, 90, "");
			if (wr!="019"){
                if (wr == "099")
                { Response.Write("<font color='red'><em>Margin inconsistent with printable area. Please check your margins and page size.</em></font>"); }
                else
                { Response.Write("There is a PDF Job " + wr); }			
				Response.End();
			}
			aps.Wait(400);
			
			Response.Write(htm);
		
	aps.FromString(wb.Prt2DiskSettings);
    conn.Open();
    OleDbCommand  comm = new OleDbCommand("insert into ictm_print_TmpPdfs (proj_id,file_name) values ('" + Session.Contents["proj_id"].ToString() + "','" + aps.NewUniqueID + "')", conn);
    comm.ExecuteNonQuery();
    conn.Close();
    
	Response.Redirect("/ictm/soft/tmp/reports/"+aps.NewUniqueID + ".PDF");

}catch(Exception ex){
    
Response.Write("----"+ex.ToString());
}

%>

Preview Comes without CSS Implementations.

Where are your CSS?

Where are your CSS?

Where JavaScript Ends on Line 47 there starts CSS

47. <link href="../../CSS/ee.css" rel="stylesheet" type="text/css" />

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.