Skip to content

Commit

Permalink
Added an option to configure the size the image is rendered by the pd…
Browse files Browse the repository at this point in the history
…fium engine.
  • Loading branch information
maforget committed Apr 3, 2024
1 parent b982e2f commit ed2b9dc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
12 changes: 10 additions & 2 deletions ComicRack.Engine/EngineConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ public PdfEngine PdfEngineToUse
set;
}

[DefaultValue(typeof(Size), "1920, 2540")]
public Size PdfiumImageSize
{
get;
set;
}

[DefaultValue(null)]
public string GhostscriptExecutable
{
Expand Down Expand Up @@ -633,9 +640,10 @@ public EngineConfiguration()
WifiSyncConnectionTimeout = 2500;
WifiSyncConnectionRetries = 1;
PdfEngineToUse = PdfEngine.Pdfium;
}
PdfiumImageSize = new Size(1920, 2540);
}

public string GetTempFileName()
public string GetTempFileName()
{
return Path.Combine(TempPath, string.Concat(Guid.NewGuid(), ".tmp"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ public byte[] ReadByteImage(string source, ProviderImageInfo info)

private Size CalculateSize(double width, double height)
{
Size maxSize = EngineConfiguration.Default.PdfiumImageSize;

//The width & height are returned in point (1/72 inch)
//but PDFs created by CR will have the wrong page size. Which would mean that opening this PDF would mean the resolution would balloon up.
//To prevent from the above mentioned ballooning, this will be the MAX resolution
int maxWidth = 1920; //8.5in at 225dpi
int maxHeight = 2540; //11in at 225dpi
int maxWidth = maxSize.Width; //1920 is 8.5in at 225dpi
int maxHeight = maxSize.Height; //2540 is 11in at 225dpi

//Calculate the width based on the max height
int targeWidth = (int)((width * maxHeight) / height);
Expand Down
24 changes: 12 additions & 12 deletions ComicRack/Changes.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
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: New PDF Engine using Google's PDFium, this is now the default. Check in the ComicRack.ini file to change the default engine or to change the rendering size. (See below for additional changes).
* 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.
* NEW: Added links to The Organizer guide to the online manual help system
* NEW: Added the possibility for unknown elements that may have been added my other software to the ComicInfo.xml to be kept, these are also saved in the database.
* NEW: Added possibility to add articles that terminate with an apostrophe in IgnoredArticles.
* NEW: Unknown elements that may have been added my other software to the ComicInfo.xml will be kept, these will also be saved in the database.
* NEW: Articles in IgnoredArticles can now terminate with an apostrophe (Like L').
* NEW: Added French articles (Le, La, Les, L') as default in IgnoredArticles.
* NEW: Remember the Location & Size of Script Output Console by the Workspace system. Since the Workspace system is configured via the Main window, the console will load at the default location but be restored once the Main window is loaded.
* NEW: Quick Search (using Mode All) will now search Scan Information & Custom Fields.
* NEW: Added the Web field to smart list, so no more need to use expressions.
* NEW: Added the Web field to smart list, so no more need to use expressions. (Again backup your DB, this could result in a corrupted database if going back to an older version)

* CHANGE: Updated to .NET Framework v4.8.
* CHANGE: Updated the Splash Screen and Renamed the Program to Community Edition, this means that a new config folder will be used %appdata%\cYo\ComicRack Community Edition.
Expand All @@ -32,21 +32,21 @@ Community Edition Build 0.9.180:
* CHANGE: File Format will be the actual file format of the archive and not simply based on the extension.
* CHANGE: The default docking mode is now Fill, instead of Bottom.
* CHANGE: Improved performances while handling Tar files (by Apiweb).
* CHANGE: Removed the Crash submission dialog because it depends on the cyolito.com website.
* CHANGE: Disabled the Public server checkbox because it depends on the cyolito.com website.
* CHANGE: Removed the Crash submission dialog because it depended on the cyolito.com website.
* CHANGE: Disabled the Public server checkbox because it depended on the cyolito.com website.
* 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). Ghostscript will no longer be the default if installed, to use it you will need to set ""PdfEngineToUse = Ghostscript"".
* CHANGE: Permit to set the maximum memory to be more than 1GB without going unlimited. The new maximum is 4064MB, more than that will be unlimited. This will not change your current settings, if you are already set to unlimited it will stay that way.
* CHANGE: Magnifing glass maximum size is twice the previous size (512 x 512 => 1024 x 1024)
* CHANGE: Replaced the old news by the Community Edition commit history, a way to keep up to date with dev progress.
* CHANGE: Replaced the ComicRack.ini setting of "DisableGhostscript" by "PdfEngineToUse", that lets you choose between Pdfium, Native & Ghostscript (if installed). Ghostscript will no longer be the default if installed, to use it you will need to set "PdfEngineToUse = Ghostscript".
* CHANGE: A bigger maximum memory value can now be set. It used to be that anyhting above 1GB would be unlimited (the default). You can now set your maximum memory to below 4GB (instead of only 1GB before). Setting it to the maximum will still result in unlimited memory. This will not change your current settings, if you are already set to unlimited it will stay that way.
* CHANGE: The magnifing glass can now be twice as big as before (512 x 512 => 1024 x 1024)

* 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.
* BUGFIX: Fixed possible crash if window size is less than 0 (Usually when using high DPI scaling).
* BUGFIX: Fixed a bug where clicking a folder that didn't exists anymore, would show the files from the program installation directory.
* BUGFIX: Fixed missing entry (MainCharacterOrTeam, Review & CommunityRating) in ComicInfo.xml.
* BUGFIX: Made getting list of book a lot faster when there was incompatible files. The slowdown was related to attempting to read the files as a WebComic. Previously the program would attempt all it's known provider on each and every file until it found a working one, regardless of the type. Now for Webcomic it will NEED to be a CBW.
* BUGFIX: Fixed missing entry (MainCharacterOrTeam, Review & CommunityRating) not being saved in ComicInfo.xml.
* BUGFIX: Made getting a list of book from a folder a lot faster when there was incompatible files. The slowdown was related to attempting to read the files as a WebComic. Previously the program would attempt to use all it's known provider on each and every file until it found a working one, regardless of the type. Now Webcomics will NEED to be a CBW.

^^^^^^^^^^ Community Edition ^^^^^^^^^^

Expand Down
4 changes: 4 additions & 0 deletions ComicRack/ComicRack.ini
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@
; Valid values are Pdfium, Native, Ghostscript
; PdfEngineToUse = Pdfium

; Maximum size of the image generated for a page rendered using the Pdfium engine.
; The image retains it's aspect ratio. The Width is favored unless the image is in landscape, then the Height is used.
; PdfiumImageSize = 1920, 2540

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

Expand Down

0 comments on commit ed2b9dc

Please sign in to comment.