summaryrefslogtreecommitdiff
path: root/platform/windows/gsview/ghostsharp.cs
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2015-01-20 11:37:59 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2015-01-20 11:37:59 -0800
commitf24f164f25b66df32d7e584ba9993c1519386aac (patch)
treea68b42373791f14f8126f48228cac93ef442867b /platform/windows/gsview/ghostsharp.cs
parent90c560641d9b459a658029eefc4cbb02fdbca0b5 (diff)
downloadmupdf-f24f164f25b66df32d7e584ba9993c1519386aac.tar.xz
Rework of gsview printing with addition of new Print control dialog
This adds an additional project (gsprint.vxcproj) which will do the necessary native calls to bring up the custom print dialog for the output device. We can then obtain the settings and make the appropriate page size adjustments in creating our xps content.
Diffstat (limited to 'platform/windows/gsview/ghostsharp.cs')
-rw-r--r--platform/windows/gsview/ghostsharp.cs17
1 files changed, 15 insertions, 2 deletions
diff --git a/platform/windows/gsview/ghostsharp.cs b/platform/windows/gsview/ghostsharp.cs
index 168ce476..099239e9 100644
--- a/platform/windows/gsview/ghostsharp.cs
+++ b/platform/windows/gsview/ghostsharp.cs
@@ -1047,10 +1047,10 @@ namespace gsview
return RunGhostscript(gsparams);
}
- public gsStatus CreateXPS(String fileName, int resolution, int num_pages)
+ public gsStatus CreateXPS(String fileName, int resolution, int num_pages,
+ PrintControl printsettings)
{
gsParams_t gsparams = new gsParams_t();
-
gsparams.init_file = null;
gsparams.init_string = null;
gsparams.device = gsDevice_t.xpswrite;
@@ -1065,6 +1065,19 @@ namespace gsview
gsparams.firstpage = -1;
gsparams.lastpage = -1;
gsparams.currpage = -1;
+
+ if (printsettings != null)
+ {
+ double paperheight = printsettings.m_pagedetails.PaperSize.Height;
+ double paperwidth = printsettings.m_pagedetails.PaperSize.Width;
+ double width = paperwidth * 72.0 / 100.0;
+ double height = paperheight * 72.0 / 100.0;
+ String temp = " -dDEVICEWIDTHPOINTS=" + width + " -dDEVICEHEIGHTPOINTS=" + height + " -dFIXEDMEDIA";
+ /* Scale and translate and rotate if needed */
+ if (printsettings.xaml_autofit.IsChecked == true)
+ temp = temp + " -dFitPage";
+ gsparams.options = gsparams.options + temp;
+ }
return RunGhostscript(gsparams);
}