Skip to content

Commit

Permalink
Added page How to get page width and height.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel-A-Sokolov committed Jun 16, 2023
1 parent 8bed32e commit a0bcd35
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: how-to-check-if-file-is-encrypted
url: viewer/net/how-to-check-if-file-is-encrypted
title: Check if a file is encrypted
weight: 5
weight: 3
description: "This article explains how to check if a file is encrypted using .NET / C# with GroupDocs.Viewer for .NET."
keywords: check, file, encrypted, C#, .NET
productName: GroupDocs.Viewer for .NET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: how-to-determine-file-type
url: viewer/net/how-to-determine-file-type
title: Determine the file type
weight: 4
weight: 1
description: "This article explains how to get a type of a file with GroupDocs.Viewer for .NET using .NET / C#."
keywords:
productName: GroupDocs.Viewer for .NET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: how-to-get-file-type-and-pages-count
url: viewer/net/how-to-get-file-type-and-pages-count
title: Get the format family and the additional information
weight: 4
weight: 2
description: "This article explains how to get the format family and the additional information using .NET / C# with GroupDocs.Viewer for .NET."
keywords:
productName: GroupDocs.Viewer for .NET
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
id: how-to-get-page-width-and-height
url: viewer/net/how-to-get-page-width-and-height
title: Get the width and height of the document pages
weight: 5
description: "This article explains how to get the width and height of the document pages using .NET / C# with GroupDocs.Viewer for .NET."
keywords:
productName: GroupDocs.Viewer for .NET
hideChildren: False
---

You can get the width and height of each document page using the [GetViewInfo](https://reference.groupdocs.com/viewer/net/groupdocs.viewer/viewer/methods/getviewinfo) method that returns a [ViewInfo](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.results/viewinfo) object. The object contains the [Pages](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.results/viewinfo/pages/) collection that represents each [Page](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.results/page/) of the document.

The following code snippet shows how to get the width and height of each document page:

{{< tabs "example1">}}
{{< tab "C#" >}}
```csharp
using (Viewer viewer = new Viewer("sample.pdf"))
{
// Get file information.
ViewInfoOptions viewInfoOptions = ViewInfoOptions.ForHtmlView();
ViewInfo viewInfo = viewer.GetViewInfo(viewInfoOptions);

// Display width and height of each page.
foreach (Page page in viewInfo.Pages)
{
Console.WriteLine($"Page: {page.Number}; Width: {page.Width}, pixels");
Console.WriteLine($"Page: {page.Number}; Height: {page.Height}, pixels");
}
}
```
{{< /tab >}}
{{< /tabs >}}

The following image shows a sample console output:

![](/viewer/net/images/how-to-get-page-width-and-height.png)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: how-to-list-and-print-all-supported-file-types
url: viewer/net/how-to-list-and-print-all-supported-file-types
title: List and print all supported file types
weight: 5
weight: 4
description: "This article explains how to list and print file types supported by GroupDocs.Viewer for .NET"
productName: GroupDocs.Viewer for .NET
hideChildren: False
Expand Down
Binary file added net/images/how-to-get-page-width-and-height.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a0bcd35

Please sign in to comment.