导出PDF格式

时间:2014-05-15 08:00:21

标签: c# xaml

我之前的问题很模糊。而我仍然不知道如何,我在这里用于Windows 8应用程序的c#/ XAML。这是我的代码

using System;
using System.Collections.Generic;
using System.Text;
using iTextSharp.text;

namespace iTextSharpTester
{
public class PDFCreator
{
    // Set up the fonts to be used on the pages
    private iTextSharp.text.Font _largeFont = new    iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 18, iTextSharp.text.Font.BOLD, iTextSharp.text.BaseColor.BLACK);
    private iTextSharp.text.Font _standardFont = new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 14, iTextSharp.text.Font.NORMAL, iTextSharp.text.BaseColor.BLACK);
    private iTextSharp.text.Font _smallFont = new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10, iTextSharp.text.Font.NORMAL, iTextSharp.text.BaseColor.BLACK);

    public void Build()
    {
        iTextSharp.text.Document doc = null;

        try
        {
            // Initialize the PDF document
            doc = new Document();
            iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(doc,
                new System.IO.FileStream(System.IO.Directory.GetCurrentDirectory() + "\\asd.pdf",
                    System.IO.FileMode.Create));

            // Set the margins and page size
            this.SetStandardPageSize(doc);

这里的问题是System.IO.Directory.GetCurrentDirectory,System.IO.FileStream和System.IO.FileMode.Create。它说这些代码在命名空间System.IO中不存在。提前致谢!这是为Windows 8应用程序。顺便说一下,我只关注了itextsharp的文章教程。代码在wpf中,我试图在Windows 8应用程序中传输它

0 个答案:

没有答案