首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

大家来看看,一命名空间的引用,该怎么解决

2012-03-20 
大家来看看,一命名空间的引用private Document documentprivate IEnumerator DocPagesprivate ArrayList

大家来看看,一命名空间的引用
private Document document;
  private IEnumerator DocPages;
  private ArrayList DocPagesList;
  private const string PrinterName = @"\\sutlej\SamsungM";
  private const string DocLocation = @"E:\a.pdf";
   
  protected void print()
  {
  FileStream file = null;
  DocPagesList = new ArrayList();
  try
  {
  file = new FileStream(DocLocation, FileMode.Open, FileAccess.Read);
  byte[] buffer = new byte[file.Length];
  file.Read(buffer, 0, buffer.Length);
   

  document = new Document(new BinaryReader(new MemoryStream(buffer)));


  for (int i = 0; i < document.Pages.Count; i++)
  {
  DocPagesList.Add(i.ToString());
  }
  DocPages = DocPagesList.GetEnumerator();
  DocPages.Reset();
  if (DocPages.MoveNext())
  {
  PrintDocument oPrintDocument = new PrintDocument();
  PrinterSettings oPrinterSettings = new PrinterSettings();
  PageSettings oPageSettings = new PageSettings();
  oPrinterSettings.PrinterName = PrinterName;
  oPageSettings.Landscape = true;
  oPrintDocument.DocumentName = document.Title;
  oPrintDocument.PrinterSettings = oPrinterSettings;
  oPrintDocument.DefaultPageSettings = oPageSettings;
  oPrintDocument.PrintPage += new PrintPageEventHandler(oPrintDocument_PrintPage);
  oPrintDocument.Print();
  }
  }
  catch (Exception exc)
  {
  //lblResult.Text = exc.Message;
  }
  finally
  {
  file.Close();
  }

  }

上面是一个打印pdf的方法
不知道Document在哪个命名空间中,需要导入什么东西。

[解决办法]
应该是读写pdf的类,你看看读写pdf的控件有那些就知道该引用什么了。

热点排行