Skip to content
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

Added UsePureJavaCMYKConversion option for Rendering Performance #22

Merged
merged 1 commit into from
Jan 24, 2025
Merged
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
1 change: 1 addition & 0 deletions src/net/NetPDF/InternalConst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CLIParam
public const string CommonLoggingConfiguration = "CommonLoggingConfiguration";
public const string LogPath = "LogPath";
public const string FontCachePath = "FontCachePath";
public const string UsePureJavaCMYKConversion = "UsePureJavaCMYKConversion";
}

/// <summary>
Expand Down
22 changes: 22 additions & 0 deletions src/net/NetPDF/NetPDFCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public override IEnumerable<IArgumentMetadata> CommandLineArguments
Name = CLIParam.FontCachePath,
Help = "The path where font cache will be stored.",
},
new ArgumentMetadata<object>()
{
Name = CLIParam.UsePureJavaCMYKConversion,
Help = "Add on command line to enable pure Java CMYK conversion.",
},
});
return lst;
}
Expand Down Expand Up @@ -106,6 +111,7 @@ protected override string[] ProcessCommandLine()
}
_logPath = ParsedArgs.Get<string>(CLIParam.LogPath);
_fontCachePath = ParsedArgs.Get<string>(CLIParam.FontCachePath);
_usePureJavaCMYKConversion = ParsedArgs.Exist(CLIParam.UsePureJavaCMYKConversion);
return result;
}
/// <summary>
Expand Down Expand Up @@ -155,6 +161,11 @@ protected virtual void PrepareMainClassToRun(string className)
/// </summary>
public static string ApplicationFontCachePath { get; set; }

/// <summary>
/// <see langword="true"/> to enable pure Java CMYK conversion
/// </summary>
public static bool? ApplicationUsePureJavaCMYKConversion { get; set; }

/// <summary>
/// value can be overridden in subclasses
/// </summary>
Expand Down Expand Up @@ -182,6 +193,12 @@ protected virtual void PrepareMainClassToRun(string className)
/// </summary>
public virtual string FontCachePath { get { return ApplicationFontCachePath ?? _fontCachePath; } }

bool _usePureJavaCMYKConversion;
/// <summary>
/// The log folder
/// </summary>
public virtual bool UsePureJavaCMYKConversion { get { return !ApplicationUsePureJavaCMYKConversion.HasValue ? _usePureJavaCMYKConversion : ApplicationUsePureJavaCMYKConversion.Value; } }

/// <summary>
/// The log4j configuration
/// </summary>
Expand Down Expand Up @@ -224,6 +241,11 @@ protected override IDictionary<string, string> Options
options.Add("pdfbox.fontcache", FontCachePath);
}

if (UsePureJavaCMYKConversion)
{
options.Add("org.apache.pdfbox.rendering.UsePureJavaCMYKConversion", "true");
}

return options;
}
}
Expand Down
Loading