【问题标题】:Offline PDF creation on Windows Phone在 Windows Phone 上离线创建 PDF
【发布时间】:2016-04-15 01:40:40
【问题描述】:

它存在吗?我尝试使用 iTextSharp,但它不起作用。这个小例子的代码是错误的:

 IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
        Document document = new Document();

        string path = "/first.pdf";

        PdfWriter.GetInstance(document, store.CreateFile( path));

        document.Open();
        document.SetPageSize(PageSize.A4);
        Paragraph p = new Paragraph("Working with pdfs");
        document.Close();

错误信息是:

无法加载文件或程序集 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 或其之一 依赖项。系统找不到指定的文件。

有人可以帮助我吗?工作示例代码,工作 dll,任何东西......

【问题讨论】:

  • 我认为 WP8 不存在 iTextSharp

标签: windows-phone-8 pdf-generation windows-phone itextsharp


【解决方案1】:

来自 NuGet 的 iTextSharp 没有为 Windows Phone CLR 编译。不知道有没有官方的。您可以尝试将 iTextSharp 源代码 (http://sourceforge.net/p/itextsharp/code/564/tree/branches/iTextSharp_5_4_2/) 编译为可移植类库,或使用非官方源代码,例如 http://itextsharpsl.codeplex.com/

【讨论】:

  • 如果 dll 未获批准,NuGet 不允许我安装,不是吗?
  • NuGet 没有说明您使用的是哪个 dll,因此您可以添加您的 dll。
【解决方案2】:

您似乎没有将段落“添加”到文档中。 :)

document.Add(p);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-04
    • 1970-01-01
    • 2021-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多