Go to register HKEY_CURRENT_USER and get installed Acrobat Reader verion Sub Key details, in my case Acrobat Reader 11.0 version is installed. Register key stored to fit page was 'bprintExpandToFit' default value 0x00000001 .Code snippet example show how to restore the value to page fit.
By checking and forcing set to fit page function before printing it will save unwanted paper wastage.
Example Source Snippets - AdodeCheckFitToPage.zip
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Microsoft.Win32; namespace AdodeCheckFitToPage { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { CheckPDFPageToFit(); } private void button2_Click(object sender, EventArgs e) { SetPDFPageToFit(); } private void CheckPDFPageToFit() { try { RegistryKey regKey = Registry.CurrentUser; regKey = regKey.CreateSubKey(@"Software\Adobe\Acrobat Reader\11.0\AVGeneral"); int bprintExpandToFit = (int)regKey.GetValue("bprintExpandToFit", (object)0); if(bprintExpandToFit ==1) { label1.Text = "Acrobat Reader 11.0 - FIT TO PAGE"; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } private void SetPDFPageToFit() { try { RegistryKey regKey = Registry.CurrentUser; regKey = regKey.CreateSubKey(@"Software\Adobe\Acrobat Reader\11.0\AVGeneral"); int defaultVal1 = 00000001; regKey.SetValue("bprintExpandToFit", (object)defaultVal1); int defaultVal2 = 00000000; regKey.SetValue("bprintCollate", (object)defaultVal2); int defaultVal3 = 00000002; regKey.SetValue("iprintScaling", (object)defaultVal3); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } } }
smartsnipps.ecomparefiles.com © 2022, All Rights Reserved | Disclaimer: smartsnipps.eCompareFiles.com is free to use any code snippets without guarantee