PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

PdfDocument.Info returns incorrect values?
http://forum.pdfsharp.com/viewtopic.php?f=2&t=716
Page 1 of 1

Author:  gfreeman14094 [ Fri Apr 24, 2009 5:00 pm ]
Post subject:  PdfDocument.Info returns incorrect values?

Whenever I print a file to PDF using PDFCreator, then read the file with PDFSharp, the PdfDocument.Info object returns what appear to be incorrect values:
Code:
doc1.Info
(pairs=8)
    base {PdfSharp.Pdf.PdfDictionary}: (pairs=8)
    Author: "þÿ\0s\0r\0s\0m\0i\0t\0h"
    CreationDate: {4/24/2009 12:15:11 PM}
    Creator: "þÿ\0P\0D\0F\0C\0r\0e\0a\0t\0o\0r\0 \0V\0e\0r\0s\0i\0o\0n\0 \00\0.\09\0.\08"
    Keywords: ""
    Meta: {PdfSharp.Pdf.DictionaryMeta}
    ModificationDate: {4/24/2009 12:15:11 PM}
    Producer: "GPL Ghostscript 8.54"
    Subject: ""
    Title: "þÿ\0B\0o\0o\0k\01"


When i use iTextSharp to read the same file, i get the following:
Code:
doc2.Info
Count = 8
    ["CreationDate"]: "D:20090424121511-04'00'"
    ["Keywords"]: ""
    ["Author"]: "srsmith"
    ["Title"]: "Book1"
    ["Creator"]: "PDFCreator Version 0.9.8"
    ["Subject"]: ""
    ["ModDate"]: "D:20090424121511-04'00'"
    ["Producer"]: "GPL Ghostscript 8.54"


The code I used for the above (C# 3, .NET 3.5, PDFSharp 1.20):
Code:
string filename = @"C:\PDFs\Book1.pdf";
var doc1 = PdfSharp.Pdf.IO.PdfReader.Open(filename, PdfSharp.Pdf.IO.PdfDocumentOpenMode.Import);
var doc2 = new iTextSharp.text.pdf.PdfReader(filename);


I find PdfSharp easier to work with vs iTextSharp, however I need to be able to correctly read the Title from a PDF document. Is there some setting that I am missing when reading the PDF? If not, is there another method to obtaining the Title that returns the correct string?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/