2015-05-28 238 views
0

之前,我用ITextSharp在C#for Windows中生成PDF文件,並且它工作得很完美,現在我需要編譯它並在Windows store框架中運行它,我得到錯誤:主要錯誤來自使用System.IO.FileStream,它不存在於Windows Store API中,是否有另一種類型與Windows Store應用程序中的System.IO.FileStream相同? 這裏的代碼我使用之前:iTextSharp C#windows store應用程序

 String mat; 
     System.IO.FileStream fs; 
     Document doc; 
     mat = textBox1.Text; 

     fs = new FileStream(mat + ".pdf", FileMode.Create, FileAccess.Write, FileShare.None); 
      doc = new Document(); 
      PdfWriter writer = PdfWriter.GetInstance(doc, fs); 
      doc.Open(); 
String texto = richTextBox1.Text; 

      doc.Add(new Paragraph(texto)); 
doc.Close(); 

      this.Hide(); 
+0

你確定這可以工作嗎?請記住,Windows Store應用程序使用與標準Windows .NET Framework不同的.NET Framework版本,而iTextSharp可能會引用Windows .NET Framework程序集。 – toadflakz

+0

https://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.storagefile.aspx –

+0

你能夠使用'System.IO.MemoryStream'嗎? –

回答

2

iTextSharp的不是Windows Store應用程序直接兼容,轉換工作不是那麼多,但它沒有這樣做。請查看iTextSharp-Monotouch瞭解可能的解決方法。

相關問題