-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolved the problem with PDF media calculations that was causing blank pages in the rendered PDF.
- Loading branch information
Showing
1 changed file
with
18 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
// | ||
// | ||
// GhostscriptViewerPdfFormatHandler.cs | ||
// This file is part of Ghostscript.NET library | ||
// | ||
// Author: Josip Habjan ([email protected], http://www.linkedin.com/in/habjan) | ||
// Copyright (c) 2013-2021 by Josip Habjan. All rights reserved. | ||
// Copyright (c) 2013-2023 by Josip Habjan. All rights reserved. | ||
// | ||
// Author ported some parts of this code from GSView. | ||
// | ||
|
@@ -265,7 +265,7 @@ public override void StdOutput(string message) | |
|
||
public override void StdError(string message) | ||
{ | ||
|
||
System.Diagnostics.Debug.WriteLine($"GS:StdError > {message}"); | ||
} | ||
|
||
#endregion | ||
|
@@ -277,10 +277,15 @@ public override void InitPage(int pageNumber) | |
if (pageNumber >= this.FirstPageNumber && pageNumber <= this.LastPageNumber) | ||
{ | ||
this.Execute(string.Format("{0} GSNETViewer_PDFpage", pageNumber)); | ||
|
||
if (this.Viewer.Interpreter.LibraryRevision >= 10010) | ||
{ | ||
this.Execute("Page pdfshowpage_init"); | ||
} | ||
} | ||
else | ||
{ | ||
throw new GhostscriptException("Page number is not in pages number range!"); | ||
throw new GhostscriptException("The page number falls outside the range of valid page numbers!"); | ||
} | ||
} | ||
|
||
|
@@ -292,11 +297,18 @@ public override void ShowPage(int pageNumber) | |
{ | ||
if (pageNumber >= this.FirstPageNumber && pageNumber <= this.LastPageNumber) | ||
{ | ||
this.Execute("Page pdfshowpage"); | ||
if (this.Viewer.Interpreter.LibraryRevision >= 10010) | ||
{ | ||
this.Execute("Page pdfshowpage_finish"); | ||
} | ||
else | ||
{ | ||
this.Execute("Page pdfshowpage"); | ||
} | ||
} | ||
else | ||
{ | ||
throw new GhostscriptException("Page number is not in pages number range!"); | ||
throw new GhostscriptException("The page number falls outside the range of valid page numbers!"); | ||
} | ||
} | ||
|
||
|