From 5c793ee403a7afadc8c43f0264d22fdbb88cd7eb Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sun, 1 Oct 2017 19:36:42 +0200 Subject: [PATCH] Added ability to raster orphan docs --- Backend/SocketServices/BackendServices.cs | 2 +- Utility/BotCode/PdfProcessor.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Backend/SocketServices/BackendServices.cs b/Backend/SocketServices/BackendServices.cs index ddeb8f3b..04a5341c 100644 --- a/Backend/SocketServices/BackendServices.cs +++ b/Backend/SocketServices/BackendServices.cs @@ -50,7 +50,7 @@ namespace Swarmops.Backend.SocketServices case "ConvertPdfHires": try { - PdfProcessor.Rerasterize(Document.FromIdentity((int)json["DocumentId"]), PdfProcessor.PdfProcessorOptions.HighQuality); + PdfProcessor.Rerasterize(Document.FromIdentity(Int32.Parse((string) json["DocumentId"])), PdfProcessor.PdfProcessorOptions.HighQuality | PdfProcessor.PdfProcessorOptions.ForceOrphans); } catch (Exception exc) { diff --git a/Utility/BotCode/PdfProcessor.cs b/Utility/BotCode/PdfProcessor.cs index 251f9cf3..971a04a0 100644 --- a/Utility/BotCode/PdfProcessor.cs +++ b/Utility/BotCode/PdfProcessor.cs @@ -19,7 +19,8 @@ namespace Swarmops.Utility.BotCode public enum PdfProcessorOptions { None = 0, - HighQuality = 0x0001 + HighQuality = 0x0001, + ForceOrphans = 0x0002 }; public static void RerasterizeAll() @@ -125,7 +126,7 @@ namespace Swarmops.Utility.BotCode { throw new InvalidOperationException("Document is not rasterized"); } - if (document.ForeignId == 0) + if (document.ForeignId == 0 && ((int) options & (int) PdfProcessorOptions.ForceOrphans) == 0) { throw new InvalidOperationException("Document is an orphan"); }