c# - 使用 PdfSharp-WP7 在 wp8 中读取和写入带有一些图像的 pdf 文件

标签 c# silverlight windows-phone-7 windows-phone-8

我正在开发一个应用程序。在我的应用程序中,我成功地添加了 PdfSharp-WP7 的引用。现在我想创建一个包含一些图像和文本的新 pdf 文件并将其保存在本地我想在成功创建文件后显示/读取数据。请分享一些代码或任何链接以开始使用。

注意:我不是在寻找启动器应用。

提前致谢

最佳答案

根据项目主页上的说明,它是 PDFsharp 的一个端口,您应该在那里寻找文档。

可以在 http://www.pdfsharp.net/wiki/HelloWorld-sample.ashx 找到 hello world smaple看起来有点像这样:

  // Create a new PDF document
  PdfDocument document = new PdfDocument();
  document.Info.Title = "Created with PDFsharp";

  // Create an empty page
  PdfPage page = document.AddPage();

  // Get an XGraphics object for drawing
  XGraphics gfx = XGraphics.FromPdfPage(page);

  // Create a font
  XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);

  // Draw the text
  gfx.DrawString("Hello, World!", font, XBrushes.Black,
    new XRect(0, 0, page.Width, page.Height),
    XStringFormats.Center);

  // Save the document...
  const string filename = "HelloWorld.pdf";
  document.Save(filename);

关于c# - 使用 PdfSharp-WP7 在 wp8 中读取和写入带有一些图像的 pdf 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19956077/

相关文章:

html - 有没有办法将 html "inside"放入 Silverlight 控件?

windows-phone-7 - 为什么在尝试使用 HttpWebRequest 时会收到 ProtocolViolationException?

c# - Visual Studio 中的“首选 32 位”在控制台应用程序 (.NET Core) 下生成 64 位代码

c# - Azure Graph 与 B2C AD

AggregateException 中的 C# InnerException

silverlight - 从Silverlight RichTextBox获取行数?

c# - 如何 Hook 一个全局的 PASTE EVENT?

c# - 我如何知道 Silverlight 控件已显示?

windows - WP7知道在 "navigated to"页面按下后退键

windows-phone-7 - 与对服务器的正常请求相比,原始通知有何优势?