Skip to content

Updated to support passwords w/ new GS library #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions GhostScriptSharp/GhostscriptSharp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ private static string[] GetArgs(string inputPath,
args.Add(String.Format("-dDEVICEXRESOLUTION={0}", settings.Resolution.Width));
args.Add(String.Format("-dDEVICEYRESOLUTION={0}", settings.Resolution.Height));

// Password
if (settings.Password != null)
{
args.Add(String.Format("-sPDFPassword={0}", settings.Password.Password));
}

// Files
args.Add(String.Format("-sOutputFile={0}", outputPath));
args.Add(inputPath);
Expand All @@ -227,6 +233,7 @@ public class GhostscriptSettings
private Settings.GhostscriptPages _pages = new Settings.GhostscriptPages();
private System.Drawing.Size _resolution;
private Settings.GhostscriptPageSize _size = new Settings.GhostscriptPageSize();
private Settings.GhostscriptPassword _password = new Settings.GhostscriptPassword();

public Settings.GhostscriptDevices Device
{
Expand All @@ -251,11 +258,35 @@ public Settings.GhostscriptPageSize Size
get { return this._size; }
set { this._size = value; }
}
public Settings.GhostscriptPassword Password
{
get { return this._password; }
set { this._password = value; }
}
}
}

namespace GhostscriptSharp.Settings
{
/// <summary>
/// Password for pdf file
/// </summary>
public class GhostscriptPassword
{
private string _password;
public string Password
{
set
{
this._password = value;
}
get
{
return this._password;
}
}
}

/// <summary>
/// Which pages to output
/// </summary>
Expand Down
Binary file modified ThirdParty/gsdll32.dll
Binary file not shown.