Dear Experts,
Thanks for your time and help.
Looking for your HELP to resolve this issue
My application (developed by some one) is using different DOCTYPE like html4.01 lose /strick , XHTML Transnational / etc and some pages do not have any validation.

My application was running fine from last six months, but sudden it is skipping css file in pdf conversion.
Even in Firefox my java script don't work.
I have already put DOCTYPE but still can not run j.script,
Here is my code:

<!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>


<body>
<p class="head_style" >Reports</p>

My full code file:
Print.aspx:

<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Register TagPrefix="auth" Namespace="ICTMLogging" Assembly="ictmlogging" %>
<%@ Import Namespace="ICTMLogging" %>
<%
ICTMLogging log=null;

try{log=(ICTMLogging)Session.Contents["log"];}catch(Exception ex){
	Console.Write(ex.ToString());
}

string proj_id=Session.Contents["proj_id"].ToString();
string app=Session.Contents["app_id"].ToString();
string app_id=app;
string project_id=(Session.Contents["project_id"]!=null)?Session.Contents["project_id"].ToString():"";
string comp_id=Session.Contents["comp_id"].ToString();

int i=0;
%>
<!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>


<body>
<p class="head_style" >Reports</p>





<%
string at,pt,pnot;
string at_al,pt_al,pnot_al,ctitle_al;
at=pt=pnot=at_al=pt_al=pnot_al=ctitle_al="";
OleDbConnection conn=new OleDbConnection(System.Configuration.ConfigurationManager.AppSettings["MM_CONNECTION_STRING_ictmdb"]);
conn.Open();
OleDbCommand comm=null;
OleDbDataReader dr=null;
    
comm=new OleDbCommand("print_pack.check_print",conn);
comm.CommandType=CommandType.StoredProcedure;
OleDbParameter prm=comm.Parameters.Add("@proj_id",OleDbType.VarChar);
prm.Value=proj_id;
prm=comm.Parameters.Add("@app",OleDbType.Double);
prm.Value=app;
bool prt=false;
comm.ExecuteNonQuery();
    
string title="",uid="",uname="";
comm=new OleDbCommand("select ptitle_print,ptitle_align,atitle_print,atitle_align,pno_print,pno_align,"+
 	" ctitle_align from ictm_print_header prt where prt.proj_id='"+proj_id+"'",conn);
dr=comm.ExecuteReader();
if(dr.Read()){
	at=dr["atitle_print"].ToString();
	at_al=dr["atitle_align"].ToString();
	pt=dr["ptitle_print"].ToString();
	pt_al=dr["ptitle_align"].ToString();
	pnot=dr["pno_print"].ToString();
	pnot_al=dr["pno_align"].ToString();
	ctitle_al=dr["ctitle_align"].ToString();
}
dr.Close();

comm=new OleDbCommand("select * from ictm_project_detail where proj_id='"+proj_id+"'",conn);
dr=comm.ExecuteReader();
if(dr.Read()){
	title=(dr["title"].ToString());
    uid = (string)dr["user_id"].ToString().Trim();
}
dr.Close();   
    
    
    //----------  Get Username from employees table
    
comm = new OleDbCommand("select * from ictm_user where company_id='" + Session.Contents["comp_id"].ToString() + "' and user_id='"+ uid +"' ", conn);
dr = comm.ExecuteReader();
if (dr.Read()) { uname = (string)dr["user_name"].ToString().Trim(); }  
dr.Close();     

comm=new OleDbCommand("select * from ictm_project where project_id='"+project_id+"'",conn);
dr=comm.ExecuteReader();
string ptitle="";
if(dr.Read()){
ptitle=dr["description"].ToString();
}
dr.Close();

string fpath="";
fpath = Request.PhysicalApplicationPath.ToString();
fpath = fpath + "soft\\tmp\\reports\\final\\";

if (File.Exists(fpath + proj_id.ToString() + ".PDF"))
{ prt = true; }
%>




<form action="print_first.aspx" method="post"   target="_blank" name="frm">

<input type="hidden" name="uname" value="<%=uname%>"/>

<%    
comm=new OleDbCommand("select 1 rno,comp_name description from ictm_company where company_id='"+comp_id+"' "+
	"union select 2 rno,description from ictm_project where project_id='"+project_id+"' "+
	"union select 3 rno,description from ictm_application where app_id="+app_id+
	"union select 4 rno,title from ictm_project_detail where proj_id='"+proj_id+"' order by rno",conn);
dr=comm.ExecuteReader();
if (dr.Read()){
%>

<input type="hidden" name="title" value="<%=title%>"/>
<input type="hidden" name="comp" value="<%=dr["description"]%>"/>
<input type="hidden" name="ctitle" value="<%=ptitle%>"/>
<% dr.Read();%>
<input type="hidden" name="project" value="<%=dr["description"]%>"/>
<% dr.Read();%>
<input type="hidden" name="app_name" value="<%=dr["description"]%>"/>
<% dr.Read();
String tmp1="";
try{
	tmp1=dr["description"].ToString();
}catch(Exception ex){if(log!=null) log.log(ex.ToString());}
%>
<input type="hidden" name="application" value="<%=tmp1%>"/>
<% 
}dr.Close();%>
<table  border="0" cellpadding="4" cellspacing="0" >
<tr>
<td><input type="button" value="Print the PDF" onclick="final()"/></td>
<td><input type="button" name="button" value="Save Print Setup "  onclick="sp()"/></td>
<%if(prt){%>
<td><input type="button" onclick="window.open('/ictm/soft/tmp/reports/final/<%=proj_id%>.pdf')" value="Last Report"/></td>
<%}%>
</tr>
</table>


<h4>Page Header Setup</h4>
<table border="1" cellpadding="3" cellspacing="0">
  <tr class="print_head">
    <td class="print_head" width="150" rowspan="2" align="left" valign="middle" nowrap="nowrap"> &nbsp; Description </td>
    <td class="print_head" rowspan="2" align="center" valign="middle" nowrap="nowrap"> Print<br/>        
      <input type="checkbox" name="checkbox2" value="checkbox" style="border-width:0 " onclick="selhead(this)"/>    </td>
    <td class="print_head" colspan="3" align="center" valign="top" nowrap="nowrap"> Alignment </td>
  </tr>
  <tr >
    <td width="26" nowrap="nowrap" class="print_head"> Left </td>
    <td width="25" nowrap="nowrap" class="print_head"> Center </td>
    <td width="25" nowrap="nowrap" class="print_head"> Right </td>
  </tr>
  <tr align="center">
    <td align="left" class="print_data">  &nbsp; <b>Company Name</b> </td>
    <td class="print_data">  <input style="border-width:0 " name="ctitle" type="checkbox" id="ctitle" value="Y" checked="checked" disabled="disabled"/>      </td>
    <td class="print_data">  <input style="border-width:0 " name="ctitle_al" type="radio" value="1" <%=(ctitle_al=="1")?"checked":""%>/>      </td>
    <td class="print_data">  <input style="border-width:0 " name="ctitle_al" type="radio" value="2"<%=(ctitle_al=="2")?"checked":""%>/>      </td>
    <td class="print_data">  <input style="border-width:0 " name="ctitle_al" type="radio" value="3"<%=(ctitle_al=="3")?"checked":""%>/>      </td>
  </tr>
  <tr align="center">
    <td align="left" class="print_data">  &nbsp; <b>Project Title</b> </td>
    <td class="print_data">  <input style="border-width:0 " name="ptitle" type="checkbox" id="ptitle" value="Y" <%=(pt=="Y")?"checked":""%>/>      </td>
    <td class="print_data">  <input style="border-width:0 " name="ptitle_al" type="radio" value="1"  <%=(pt_al=="1")?"checked":""%>/>      </td>
    <td class="print_data">  <input name="ptitle_al" type="radio" value="2" style="border-width:0 " <%=(pt_al=="2")?"checked":""%>/>    </td>
    <td class="print_data">  <input style="border-width:0 " name="ptitle_al" type="radio" value="3" <%=(pt_al=="3")?"checked":""%>/>      </td>
  </tr>
  <tr align="center">
    <td align="left" class="print_data">  &nbsp; <b>Application Title</b> </td>
    <td class="print_data">  <input style="border-width:0 " name="atitle" type="checkbox" id="atitle" value="Y" <%=(at=="Y")?"checked":""%>/>      </td>
    <td class="print_data">  <input style="border-width:0 " name="atitle_al" type="radio" value="1"  <%=(at_al=="1")?"checked":""%>/>      </td>
    <td class="print_data">  <input name="atitle_al" type="radio" value="2"  style="border-width:0 " <%=(at_al=="2")?"checked":""%>/>    </td>
    <td class="print_data">  <input style="border-width:0 " name="atitle_al" type="radio" value="3" <%=(at_al=="3")?"checked":""%> />      </td>
  </tr>
</table>




<h4>Page Footer Setup</h4>
<table border="1" cellpadding="3" cellspacing="0">
  <tr>
    <td width="150" rowspan="2" align="left" valign="middle" nowrap="nowrap" class="print_head">  &nbsp;  Description </td>
    <td rowspan="2" align="center" valign="middle" nowrap="nowrap" class="print_head"> Print <br>
    </td>
    <td colspan="3" align="center" valign="top" nowrap="nowrap" class="print_head"> Alignment </td>
  </tr>
  <tr >
    <td width="26" nowrap="nowrap" class="print_head"> Left </td>
    <td width="25" nowrap="nowrap" class="print_head"> Center </td>
    <td width="25" nowrap="nowrap" class="print_head"> Right </td>
  </tr>
  <tr align="center">
    <td align="left" class="print_data">  &nbsp; <b>Page No </b></td>
    <td class="print_data">
      <input style="border-width:0 " name="Pno" type="checkbox" id="Pno" value="Y" <%=(pnot=="Y")?"checked":""%>/>    </td>
    <td class="print_data">
      <input style="border-width:0 " name="pno_al" type="radio" value="1"  <%=(pnot_al=="1")?"checked":""%>/>    </td>
    <td class="print_data">
      <input name="pno_al" type="radio" value="2" style="border-width:0 " <%=(pnot_al=="2")?"checked":""%>/>    </td>
    <td class="print_data">
      <input style="border-width:0 " name="pno_al" type="radio" value="3"  <%=(pnot_al=="3")?"checked":""%>/>    </td>
  </tr>
</table>





<h4>Page Setup</h4>

<table border="1" cellpadding="3" cellspacing="0">
  <tr valign="top">
    <td rowspan="2" nowrap="nowrap" class="print_head" align="left" valign="middle"> Page Name </td>
    <td rowspan="2" nowrap="nowrap" class="print_head" align="center"> Print ? <br>
        <input style="border-width:0 " name="checkbox" type="checkbox"  onclick="sel(this)" value="checkbox" checked="checked"/>
    </td>
    <td rowspan="2" nowrap="nowrap" class="print_head" align="center" valign="top"> Back <br /> Color </td>
    <td colspan="2" nowrap="nowrap" class="print_head" align="center" valign="middle"> Orientation </td>
    <td rowspan="2" nowrap="nowrap" class="print_head" align="center" valign="middle"> Page Size  </td>
    <td colspan="4" nowrap="nowrap" class="print_head" align="center"> Margin [Inches] </td>
    <td rowspan="2" nowrap="nowrap" class="print_head" align="left" valign="middle"> Scaling </td>
    <td rowspan="2" nowrap="nowrap" class="print_head" align="left" valign="middle"> Preview </td>
  </tr>
  <tr >
    <td nowrap="nowrap" class="print_head" align="left">Portrait</td>
    <td nowrap="nowrap" class="print_head" align="left">Landscape</td>
    <td nowrap="nowrap" class="print_head" align="center"> Left </td>
    <td nowrap="nowrap" class="print_head" align="center"> Right </td>
    <td nowrap="nowrap" class="print_head" align="center"> Top </td>
    <td nowrap="nowrap" class="print_head" align="center"> Bottom </td>
    </tr>
<%
comm=new OleDbCommand("select prt.proj_id,prt.app_id,prt.sub_id,prt.print,prt.orientation,prt.pagesize,prt.lm,prt.back, " +
						"prt.rm,prt.tm,prt.bm,prt.scaling,mas.FILE_NAME,mas.description from ictm_print prt,ictm_print_master mas  " +
						"where prt.app_id=mas.APP_ID and prt.sub_id=mas.SUB_ID and prt.proj_id='"+proj_id+"' and prt.app_id="+app+" order by prt.sub_id",conn);
dr=comm.ExecuteReader();
while(dr.Read()){
i++;
%>
  <tr>
    <td class="print_data" align="left" valign="middle" nowrap="nowrap"> <b><%=dr["description"]%></b>&nbsp;
	<input type="hidden" name="fn_<%=i%>" value="<%=dr["file_name"]%>"/>
	<input name="sub_id_<%=i%>" type="hidden" id="sub_id_<%=i%>" value="<%=dr["sub_id"]%>"/>	
	</td>
    <td class="print_data" align="center"><input name="print_<%=i%>" type="checkbox" value="Y" <%=dr["print"].ToString()=="Y"?"checked":""%> style="border-width:0 "/></td>
    <td class="print_data">
      <div align="center">
        <input name="back_<%=i%>" type="checkbox" id="back_<%=i%>" value="Y" <%=dr["back"].ToString()=="Y"?"checked":""%> style="border-width:0 "/>
</div></td>
    <td nowrap="nowrap" class="print_data"><div align="center">
      <input name="ori_<%=i%>" type="radio" style="border-width:0 " value="1" <%=dr["orientation"].ToString()=="1"?"checked":""%>/>
    </div></td>
    <td nowrap="nowrap" class="print_data"><div align="center">
      <input name="ori_<%=i%>" type="radio" value="2" style="border-width:0 "<%=dr["orientation"].ToString()=="2"?"checked":""%>/>
    </div></td>
    <td nowrap="nowrap" class="print_data">
	<% int pg=9;
	try{
		pg=Convert.ToInt32(dr["pagesize"]);
	}catch(Exception ex){if(log!=null) log.log(ex.ToString());	}
	%>
      <select name="pg_<%=i%>" style="width:160">
        <option value="1" <%=(pg==1)?"selected":""%>>Letter 8 1/2 x 11 in</option>
        <option value="2" <%=(pg==2)?"selected":""%>>Letter Small 8 1/2 x 11 in</option>
        <option value="3" <%=(pg==3)?"selected":""%>>Tabloid 11 x 17 in</option>
        <option value="4" <%=(pg==4)?"selected":""%>>Ledger 17 x 11 in</option>
        <option value="5" <%=(pg==5)?"selected":""%>>Legal 8 1/2 x 14 in</option>
        <option value="6" <%=(pg==6)?"selected":""%>>Statement 5 1/2 x 8 1/2 in</option>
        <option value="7" <%=(pg==7)?"selected":""%>>Executive 7 1/2 x 10 1/2 in</option>
        <option value="8" <%=(pg==8)?"selected":""%>>A3 297 x 420 mm</option>
        <option value="9" <%=(pg==9)?"selected":""%>>A4 210 x 197 mm</option>
        <option value="10" <%=(pg==10)?"selected":""%>>A4 Small 210 x 297 mm</option>
        <option value="11" <%=(pg==11)?"selected":""%>>A5 148 x 210 mm</option>
        <option value="12" <%=(pg==12)?"selected":""%>>B4 250 x 354 mm</option>
        <option value="13" <%=(pg==13)?"selected":""%>>B5 182 x 257 mm</option>
        <option value="14" <%=(pg==14)?"selected":""%>>Folio 8 1/2 x 13 in</option>
        <option value="15" <%=(pg==15)?"selected":""%>>Quarto 215 x 275 mm</option>
        <option value="16" <%=(pg==16)?"selected":""%>>10 x 14 in</option>
        <option value="17" <%=(pg==17)?"selected":""%>>11 x 17 in</option>
        <option value="18" <%=(pg==18)?"selected":""%>>Note 8 1/2 x 11 in</option>
        <option value="24" <%=(pg==24)?"selected":""%>>C size sheet</option>
        <option value="25" <%=(pg==25)?"selected":""%>>D size sheet</option>
        <option value="26" <%=(pg==26)?"selected":""%>>E size sheet</option>
      </select>
	</td>
    <td nowrap="nowrap" class="print_data"><div align="center">
      <input name="lm_<%=i%>" type="text" value="<%=dr["lm"]%>" size="4"/>      
    </div></td>
    <td nowrap="nowrap" class="print_data"><div align="center">
      <input name="rm_<%=i%>" type="text" value="<%=dr["rm"]%>" size="4"/>
    &nbsp; </div></td>
    <td nowrap="nowrap" class="print_data"><div align="center">
      <input name="tm_<%=i%>" type="text" value="<%=dr["tm"]%>" size="4"/>
    &nbsp; </div></td>
    <td nowrap="nowrap" class="print_data"><input name="bm_<%=i%>" type="text" value="<%=dr["bm"]%>" size="4"/></td>
    <td nowrap="nowrap" class="print_data"><input name="scaling_<%=i%>" type="text" id="scaling_<%=i%>" value="<%=dr["scaling"]%>" size="5"/> 
      % </td>
    <td nowrap="nowrap" class="print_data"><div align="center"><a href="javascript:prev('<%=dr["sub_id"]%>','<%=i%>')">Preview</a></div></td>
  </tr>
<%
}
%>
</table>
<br/>
<input type="hidden" name="no" value="<%=i%>"/>

</form>
</body>
</html>

Dani AI

Generated

As suggested, validating the output is a good start. The symptoms reports (mixed DOCTYPEs, CSS missing in PDF, JavaScript failing in Firefox) commonly come from three root causes: inconsistent or malformed markup (which triggers quirks mode), use of old/IE-only CSS, and relying on JavaScript in a PDF pipeline that does not execute scripts. The guidance below focuses on practical checks and fixes that remain useful years later.

A minimal, consistent document scaffold (one DOCTYPE only, UTF-8) helps avoid quirks-mode differences across browsers:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Title</title>
  <!-- link CSS here -->
</head>

JavaScript robustness notes: undeclared loop counters and null element references commonly break only in some browsers. Replace implicit globals and guard DOM access. Example safer pattern:

function sel(theElement) {
  var theForm = theElement.form;
  var t = parseInt(theForm.no.value, 10) || 0;
  for (var i = 1; i <= t; i++) {
    var el = document.getElementById('print_' + i);
    if (el && el.type === 'checkbox') {
      el.checked = !!theElement.checked;
    }
  }
}

CSS for vertical text: modern, cross-browser rules use the standardized properties with a transform fallback for older engines. Avoid old IE-only filters; prefer writing-mode + text-orientation and transform as fallback.

PDF conversion checklist (most common causes of "CSS skipped"):

  • Confirm the final HTML sent to the PDF tool contains a single DOCTYPE and the expected <link> tags (inspect "View Source").
  • Use absolute or site-root paths for styles so the converter can fetch them, or inline critical print styles into the page head.
  • Ensure styles intended for printed output use media="print" or @media print when appropriate.
  • Check the PDF generator docs: many server-side generators do not run client-side JavaScript, so logic that sets up the DOM in JS must be applied server-side or before capture.

Quick debug sequence: validate with an HTML/CSS validator, open the Firefox console/network inspector to spot 404s or JS errors, confirm final served markup, then adjust CSS and JS as above.

use W3 validation

Thanks,
But some attributes of my CSS does not work with FFox. like

.VerticalText
{
    FILTER: flipV() flipH() ;	
    WRITING-MODE: tb-rl;
	
}

What should I do for FF and Google Chrom.

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.