iTextSharp最新版本不支持元数据?

时间:2010-06-09 07:28:00

标签: itextsharp

Console.WriteLine("Chapter 1 example 6: Meta Information");

        // step 1: creation of a document-object
        Document document = new Document();

        try
        {
            // step 2:
            // we create a writer that listens to the document
            // and directs a PDF-stream to a file
            PdfWriter.GetInstance(document, new FileStream("Chap0106.pdf", FileMode.Create));

            // step 3: we add some metadata and open the document
            document.AddTitle("Hello World example");
            document.AddSubject("This example explains step 6 in Chapter 1");
            document.AddKeywords("Metadata, iText, step 6, tutorial");
            document.AddCreator("My program using iText#");
            document.AddAuthor("Bruno Lowagie");
            document.AddHeader("Expires", "0");
            document.Open();

            // step 4: we add a paragraph to the document
            document.Add(new Paragraph("Hello World"));
        }
        catch (DocumentException de)
        {
            Console.Error.WriteLine(de.Message);
        }
        catch (IOException ioe)
        {
            Console.Error.WriteLine(ioe.Message);
        }

        // step 5: we close the document
        document.Close();

// step 1: creation of a document-object Document document = new Document(); try { // step 2: // we create a writer that listens to the document // and directs a PDF-stream to a file PdfWriter.GetInstance(document, new FileStream("Chap0106.pdf", FileMode.Create)); // step 3: we add some metadata and open the document document.AddTitle("Hello World example"); document.AddSubject("This example explains step 6 in Chapter 1"); document.AddKeywords("Metadata, iText, step 6, tutorial"); document.AddCreator("My program using iText#"); document.AddAuthor("Bruno Lowagie"); document.AddHeader("Expires", "0"); document.Open(); // step 4: we add a paragraph to the document document.Add(new Paragraph("Hello World")); } catch (DocumentException de) { Console.Error.WriteLine(de.Message); } catch (IOException ioe) { Console.Error.WriteLine(ioe.Message); } // step 5: we close the document document.Close();

我只是复制iTextSharp.tutorial。 我得到了pdf文件Chap0106.pdf,但元数据没有显示......

我使用vs2008 xp系统

1 个答案:

答案 0 :(得分:0)

我通过相同的例子,似乎工作得很好。您的代码也与我的代码匹配。确保你要去File> adobe reader中的属性。