0

谁能告诉,如何使用搜索文本功能在网络上显示 pdf 文件。

4

2 回答 2

2

如果你的意思是在 pdf 文件中搜索,你可以这样做:

  • 下载此 dll Interop.Cisso.DLL,然后将其添加为参考
  • 创建您的目录(您应该在索引服务中定义一个目录以在其中搜索)它是通过这种方式完成的:http: //support.microsoft.com/kb/308202
  • 最后,这是您进行搜索的代码:

       DataSet ds = new DataSet("IndexServerResults");
        CissoQueryClass q = new CissoQueryClass();
        CissoUtilClass util = new CissoUtilClass();
    
        OleDbDataAdapter da = new OleDbDataAdapter();
    
    string query = "";
    if (lstSearchIntegration.SelectedValue == "-1") {
        query = "@all Contains " + txtKeywordOne.Text + " and not #filename *.log";
    } else {
        string operation = "";
        if (lstSearchIntegration.SelectedValue.ToLower == "and") {
            operation = "and";
        } else {
            operation = "or";
        }
        query = "@all Contains " + txtKeywordOne.Text + " " + operation + " " + txtKeywordTwo.Text;
    
     }
    
    switch (lstDocType.SelectedValue) {
        case "doc":
            query += " and #filename *.doc";
            break;
        case "pdf":
            query += " and #filename *.pdf";
            break;
        case "ppt":
            query += " and #filename *.ppt";
            break;
        case "pps":
            query += " and #filename *.pps";
            break;
    }
    
    q.Query = query;
    q.Catalog = "YourCatalogName";
    q.SortBy = "rank[d]";
    q.Columns = "DocAppName,rank, path, size, FileName,VPath, Create";
    
    q.MaxRecords = 1000;
        util.AddScopeToQuery(q, "YourFolder", "deep");
    object obj = q.CreateRecordset("nonsequential");
    da.Fill(ds, obj, "IndexServerResults");
    DataTable mydt = new DataTable();
    mydt = ds.Tables[0];
    

请注意:

  1. 我正在使用和/或操作进行更智能的搜索
  2. 我在 doc、pdf、ppt 和 pps 中搜索
  3. 我正在从搜索中排除日志文件
于 2012-04-04T07:06:27.813 回答
0

我可以推荐Aspose.PDF但它要花钱

于 2012-04-04T07:00:05.993 回答