-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added page How to get page width and height.
- Loading branch information
1 parent
8bed32e
commit a0bcd35
Showing
6 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...loper-guide/retrieving-document-information/how-to-get-page-width-and-height.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.