Hello,
I came across a very strange issue. When using GroupDocs.Conversion 20.1.0.0 to get document information, for every pdf document it returns same value of Height: 842 and Width: 595 which is wrong.
using (Converter converter = new Converter(DocumentSource))
{
IDocumentInfo info = converter.GetDocumentInfo();
DocumentInfo documentInfo = info as DocumentInfo;
keyValues.Add(ContentAttribute.CreationDate.ToString(), documentInfo.CreationDate.ToString("MM/dd/yyyy h:mm tt"));
keyValues.Add(ContentAttribute.Format.ToString(), documentInfo.Format);
keyValues.Add(ContentAttribute.PagesCount.ToString(), documentInfo.PagesCount.ToString());
keyValues.Add(ContentAttribute.Size.ToString(), documentInfo.Size.ToString());
foreach (string propertyName in documentInfo.PropertyNames)
{
if (!keyValues.ContainsKey(propertyName)) {
keyValues.Add(propertyName, documentInfo[propertyName]);
}
}
}
1 Like
@Shaheer1995
This issue is reproduced at our end. We have logged it in our internal issue tracking system with ID CONVERSIONNET-3938. As there’s any update, you’ll be notified.
1 Like
@atirtahir3,
While you are looking into this issue, for now can I use GroupDocs.Parser.GetDocumentInfo method to get correct Height and Width? Will it work reliably for all documents? Or is there any other GroupDocs library which can be used for finding these attributes.
1 Like
@Shaheer1995,
Yes, you can use GroupDocs.Parser for this purpose. Below is the code to find height and width of a page:
using (Parser parser = new Parser(@"D:/sample.pdf"))
{
IDocumentInfo info = parser.GetDocumentInfo();
for (int i = 0; i < info.PageCount; i++)
{
Console.WriteLine(string.Format("Page Width: {0}", info.Pages[i].Width));
Console.WriteLine(string.Format("Page Height: {0}", info.Pages[i].Height));
Console.WriteLine("\n");
}
}
We’d recommend you to download and integrate latest version of the API that is 20.5. Have a look at this screenshot.JPG (26.9 KB).
Ok. Thanks for your quick response.
Looking forward for the fix of my main issue
1 Like
@Shaheer1995
We’ll surely notify you as there’s any update.
@Shaheer1995
Your reported issue CONVERSIONNET-3938 is now fixed in API version 20.6.
1 Like