Added "OpenAfterCreating" app setting
This commit is contained in:
parent
faf775a12c
commit
5f96177f74
@ -33,7 +33,10 @@
|
||||
<value>%UserProfile%\PDFSCRIBE.PDF</value>
|
||||
</setting>
|
||||
<setting name="AskUserForOutputFilename" serializeAs="String">
|
||||
<value>True</value>
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="OpenAfterCreating" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
</PdfScribe.Properties.Settings>
|
||||
</applicationSettings>
|
||||
|
@ -69,6 +69,7 @@ namespace PdfScribe
|
||||
String.Format("-sOutputFile={0}", outputFilename), standardInputFilename };
|
||||
|
||||
GhostScript64.CallAPI(ghostScriptArguments);
|
||||
DisplayPdf(outputFilename);
|
||||
}
|
||||
}
|
||||
catch (IOException ioEx)
|
||||
@ -241,6 +242,22 @@ namespace PdfScribe
|
||||
return pathIsValid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the PDF in the default viewer
|
||||
/// if the OpenAfterCreating app setting is "True"
|
||||
/// and the file extension is .PDF
|
||||
/// </summary>
|
||||
/// <param name="pdfFilename"></param>
|
||||
static void DisplayPdf(String pdfFilename)
|
||||
{
|
||||
if (Properties.Settings.Default.OpenAfterCreating &&
|
||||
!String.IsNullOrEmpty(Path.GetExtension(pdfFilename)) &&
|
||||
(Path.GetExtension(pdfFilename).ToUpper() == ".PDF"))
|
||||
{
|
||||
Process.Start(pdfFilename);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Displays up a topmost, OK-only message box for the error message
|
||||
/// </summary>
|
||||
|
15
PdfScribe/Properties/Settings.Designer.cs
generated
15
PdfScribe/Properties/Settings.Designer.cs
generated
@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34003
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@ -12,7 +12,7 @@ namespace PdfScribe.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
@ -25,7 +25,7 @@ namespace PdfScribe.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("%Temp%\\PDFSCRIBE.PDF")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("%UserProfile%\\PDFSCRIBE.PDF")]
|
||||
public string OutputFile {
|
||||
get {
|
||||
return ((string)(this["OutputFile"]));
|
||||
@ -40,5 +40,14 @@ namespace PdfScribe.Properties {
|
||||
return ((bool)(this["AskUserForOutputFilename"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool OpenAfterCreating {
|
||||
get {
|
||||
return ((bool)(this["OpenAfterCreating"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,13 @@
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="OutputFile" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">%Temp%\PDFSCRIBE.PDF</Value>
|
||||
<Value Profile="(Default)">%UserProfile%\PDFSCRIBE.PDF</Value>
|
||||
</Setting>
|
||||
<Setting Name="AskUserForOutputFilename" Type="System.Boolean" Scope="Application">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="OpenAfterCreating" Type="System.Boolean" Scope="Application">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
@ -1,4 +1,4 @@
|
||||
# PdfScribe v1.0.5
|
||||
# PdfScribe v1.0.6
|
||||
|
||||
PdfScribe is a PDF virtual printer. Check the [releases](https://github.com/stchan/PdfScribe/releases) page for this project to download a prebuilt MSI package.
|
||||
|
||||
@ -9,7 +9,7 @@ PdfScribe is a PDF virtual printer. Check the [releases](https://github.com/stch
|
||||
|
||||
## Building from source
|
||||
|
||||
Visual Studio 2015, Wix 3.11, and Votive 2015 are required to build PdfScribe.
|
||||
Visual Studio 2017, Wix 3.11, and Votive 2017 are required to build PdfScribe.
|
||||
|
||||
PdfScribe links to, and distributes the following third party components:
|
||||
|
||||
@ -19,7 +19,7 @@ PdfScribe links to, and distributes the following third party components:
|
||||
|
||||
## License
|
||||
|
||||
Redmon is distributed under the GPL v3. Ghostscript is AGPL (more restrictive than GPLv3), so PdfScribe is bound by that license.
|
||||
Ghostscript is AGPL (more restrictive than GPLv3), so PdfScribe is bound by that license.
|
||||
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ In the application config file (PdfScribe.exe.config), there are two settings in
|
||||
|
||||
* ****AskUserForOutputFilename**** - set value to *true* if you want PdfScribe to ask the user where to save the PDF.
|
||||
* ****OutputFile**** - if there is a constant filename you want the PDF to be saved to, set its value here. Environment variables can be used. PdfScribe will overwrite each time. This setting is ignored if **AskUserForOutputFilename** is set to *true*.
|
||||
|
||||
* ****OpenAfterCreating**** - set value to *true* if you want the PDF automatically opened with the default viewer. This setting is ignored if the file extension is not .PDF
|
||||
|
||||
## To do
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user