naveedqadri 0 Junior Poster in Training

Dear Experts,

I have installed Activepdf Server 2009 and APWebgrabber 2009 to convert my document to PDF then Print.

NOTE: My website is already compiled with .net v-2,
OS: server 2003
.Net 3.5 and .Net 4 are also installed

I am getting this error.

CS0246: The type or namespace name 'Set' could not be found (are you missing a using directive or an assembly reference?)

Line 80: APWebGrbNET.APWebGrabber wb = new APWebGrbNET.APWebGrabber();
Line 81: //APServer aps=new APServer();
Line 82:  Set aps = CreateObject("APServer.Object");   Error at this Point

Actual Page 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();
APWebGrbNET.APWebGrabber wb = new APWebGrbNET.APWebGrabber();
//APServer aps=new APServer();
Set aps = Server.CreateObject("APServer.Object");
	StringWriter wtr=new StringWriter();	
	i=Convert.ToInt32(Request.QueryString["n"]);
			string pg=Request.Form["fn_"+i];
			//if(Session.Contents["app_id"].ToString()=="63"){
				Server.Execute(pg,wtr);
			//}else{
			//Server.Execute(pg+"?pl="+(Request.Form["ori_"+i]=="1"?"1":"0"),wtr);
			//}
			string htm=wtr.ToString();

           
           htm=htm.Replace("/ictm/soft/tmp/","http://124.217.245.184/ictm/soft/tmp/");
           htm = htm.Replace("/ictm/images/", "http://124.217.245.184/ictm/images/");
            
    
           pdfurl = "http://124.217.245.184" + 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");
            aps.OutputDirectory = aps.PSToPDF(Server.MapPath("/ictm/soft/tmp/reports"));
            
    //varReturn = APS.PSToPDF(Server.MapPath(varFile),Server.MapPath(varPDFName))

    
    
			wb.Prt2DiskSettings=aps.XMLData();
            int ixi = wb.DoPrint("124.217.245.184", 64320);
           
            if (ixi!=0) {
				Response.Write("There is a error "+ ixi);
				Response.End();
			}
            string wr = wb.Wait("124.217.245.184", 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){
    
    //check error here naveed 
Response.Write("----"+ex.ToString());
}

%>