-
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 for .NET and Java
- Loading branch information
1 parent
1123cb9
commit 05e3c54
Showing
12 changed files
with
89 additions
and
9 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
42 changes: 42 additions & 0 deletions
42
...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,42 @@ | ||
--- | ||
id: how-to-get-page-width-and-height | ||
url: viewer/java/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 GroupDocs.Viewer for Java." | ||
keywords: | ||
productName: GroupDocs.Viewer for Java | ||
hideChildren: False | ||
--- | ||
|
||
You can get the width and height of each document page using the [getViewInfo](https://reference.groupdocs.com/viewer/java/com.groupdocs.viewer/viewer/#getViewInfo-com.groupdocs.viewer.options.ViewInfoOptions-) method that returns a [ViewInfo](https://reference.groupdocs.com/viewer/java/com.groupdocs.viewer.results/viewinfo/) object. Use the [getPages](https://reference.groupdocs.com/viewer/java/com.groupdocs.viewer.results/viewinfo/#getPages--) method to access the collection that contains each [Page](https://reference.groupdocs.com/viewer/java/com.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 "Java" >}} | ||
```java | ||
import com.groupdocs.viewer.Viewer; | ||
import com.groupdocs.viewer.options.ViewInfoOptions; | ||
import com.groupdocs.viewer.results.ViewInfo; | ||
// ... | ||
|
||
try (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. | ||
for (Page page : viewInfo.getPages()) { | ||
System.out.println("Page: " + page.getNumber() + "; Width: " + page.getWidth() + ", pixels"); | ||
System.out.println("Page: " + page.getNumber() + "; Height: " + page.getHeight() + ", pixels"); | ||
} | ||
} | ||
``` | ||
{{< /tab >}} | ||
{{< /tabs >}} | ||
|
||
The following image shows a sample console output: | ||
|
||
![](/viewer/java/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.
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.