Skip to content

Commit

Permalink
add logo to pdf - add opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
jurczewski committed May 30, 2024
1 parent 9d6a56a commit 1990057
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/PrivatePdfConverter/Commands/AddLogoToPdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace PrivatePdfConverter.Commands;

public static class AddLogoToPdf
{
public static void Run(string path, string logoPath, string position, string? output)
public static void Run(string path, string logoPath, string position, int? opacity, string? output)
{
if (!File.Exists(path))
{
Expand All @@ -28,11 +28,21 @@ public static void Run(string path, string logoPath, string position, string? ou

var logo = LoadImage(logoPath);
SetScale(logo);
SetOpacity(opacity, logo);
AddLogoToPages(pdfDoc, logo);

Log.Logger.Information("Created a new pdf at {ExportFullPath}", exportFullPath);
}

private static void SetOpacity(int? opacity, Image logo)
{
if (opacity.HasValue)
{
logo.SetOpacity(opacity.Value / 100f);
Log.Logger.Information("Opacity: {Opacity}%", opacity);
}
}

private static void SetScale(Image logo)
{
logo.SetAutoScaleWidth(true);
Expand Down

0 comments on commit 1990057

Please sign in to comment.