Skip to content

Commit

Permalink
Added a new configuration to select the pdf engine, default is pdfium.
Browse files Browse the repository at this point in the history
Removed old ComicRack.ini config DisableGhostscript & replaced it with PdfEngineToUse.
  • Loading branch information
maforget committed Mar 8, 2024
1 parent eaca408 commit 51d3fae
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
24 changes: 16 additions & 8 deletions ComicRack.Engine/EngineConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ public enum CbEngines
SharpZip
}

public enum PdfEngine
{
Ghostscript,
Pdfium,
Native
}

private string tempPath = Path.GetTempPath();

private float pageBowWidth = 0.07f;
Expand Down Expand Up @@ -189,21 +196,21 @@ public string ComicExportFileNameFormat
set;
}

[DefaultValue(false)]
public bool DisableGhostscript
{
get;
set;
}
[DefaultValue(PdfEngine.Pdfium)]
public PdfEngine PdfEngineToUse
{
get;
set;
}

[DefaultValue(null)]
[DefaultValue(null)]
public string GhostscriptExecutable
{
get;
set;
}

[DefaultValue(null)]
[DefaultValue(null)]
public string DjVuLibreInstall
{
get;
Expand Down Expand Up @@ -625,6 +632,7 @@ public EngineConfiguration()
WifiSyncSendTimeout = 5000;
WifiSyncConnectionTimeout = 2500;
WifiSyncConnectionRetries = 1;
PdfEngineToUse = PdfEngine.Pdfium;
}

public string GetTempFileName()
Expand Down
2 changes: 1 addition & 1 deletion ComicRack.Engine/IO/Provider/Readers/Pdf/PdfGhostScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public bool IsAvailable()
{
PdfImages.GhostscriptPath = EngineConfiguration.Default.GhostscriptExecutable;
}
if (!EngineConfiguration.Default.DisableGhostscript)
if (EngineConfiguration.Default.PdfEngineToUse == EngineConfiguration.PdfEngine.Ghostscript)
{
return PdfImages.IsGhostscriptAvailable;
}
Expand Down
8 changes: 6 additions & 2 deletions ComicRack.Engine/IO/Provider/Readers/PdfComicProvider.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
Expand All @@ -24,8 +25,11 @@ public PdfComicProvider()
}
else
{
pdfReader = new PdfNative();
}
if (EngineConfiguration.Default.PdfEngineToUse == EngineConfiguration.PdfEngine.Native)
pdfReader = new PdfNative();
else
pdfReader = new PdfiumReaderEngine();
}
}

protected override bool OnFastFormatCheck(string source)
Expand Down
2 changes: 2 additions & 0 deletions ComicRack/Changes.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Community Edition Build 0.9.180:

* NEW: RAR5 Support (Default & SharpCompress)
* NEW: New PDF Engine using Google's PDFium, this is now the default. Check in the ComicRack.ini file to replace the engine.
* NEW: Added Virtual Tags. You can set any combination of field in a single one. Can be used with grouping, sorting, smart lists. Configure them in Preferences => Library => Virtual Tags. BACKUP YOUR DB, IF YOU PLAN ON GOING BACK TO AN OLDER VERSION. USING A VIRTUAL TAG IN A SMART LIST AND OPENING AN OLDER VERSION WOULD RESULT IN A DATABASE CORRUPTED MESSAGE. YOU NEED TO REMOVE ANY OF THESE LISTS BEFORE GOING BACK.
* NEW: Added the Git version to the Splash Screen, to more easily identify bugs in specific releases.
* NEW: Added the "-local" command line switch, to have the program load on portable mode.
Expand Down Expand Up @@ -33,6 +34,7 @@ Community Edition Build 0.9.180:
* CHANGE: Made Tags be saved inside the ComicInfo.xml. First Sync after the update will cause all the data to be updated, so a slower sync is expected. (will this mess with other programs that uses the ComicInfo.xml?)
* CHANGE: Changed ParallelConversions from 8 to the Number of Processor. ini says it was related to the number of Processor, but I do not see any evidence for that setting. This only increases the number of pages it converts at the same time.
* CHANGE: Replaced the old news by the Community Edition commit history.
* CHANGE: Replaced the ComicRack.ini setting of DisableGhostscript by PdfEngineToUse, that let's you choose between Pdfium, Native & Ghostscript (if installed).

* BUGFIX: Fixed crash when the clipboard contains some objects while the program is idle. The check should now only happen on a right-click and not in the background. It should at least lessen the frequency of the crash, maybe remove it completely.
* BUGFIX: Fixed smartlist "in range" for dates, the second field wasn't taken into account.
Expand Down
7 changes: 4 additions & 3 deletions ComicRack/ComicRack.ini
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
; This is the color of the page curl for thumbnails
; ThumbnailPageCurlColor = LightBlue

; Sets if page bows are drawn on thumbails
; Sets if page bows are drawn on thumbnails
; ThumbnailPageBow = true

; This sets how rating stars are displayed on thumbnails
Expand Down Expand Up @@ -224,8 +224,9 @@
; ------------------------------------------------------------------
; PDF

; Set this to true to always use the built in PDF parser, even when ghostscript is installed
; DisableGhostscript = true
; Set what engine is used for PDF files. Changing this setting to Ghostscript requires it to be installed, or it will default to Pdfium.
; Valid values are Pdfium, Native, Ghostscript
; PdfEngineToUse = Pdfium

; This is an override for specifying the direct path to ghostscript (if ComicRack somehow fails to detect)
; GhostscriptExecutable =
Expand Down

0 comments on commit 51d3fae

Please sign in to comment.