Debugging Hires PDF conversion failure

This commit is contained in:
Rick Falkvinge
2018-02-10 10:47:23 +01:00
parent 8b0b11b12d
commit ab200e9f77
7 changed files with 239 additions and 6 deletions
+9
View File
@@ -179,6 +179,11 @@
<DesignTime>True</DesignTime>
<DependentUpon>Logic.Structure.Geography.resx</DependentUpon>
</Compile>
<Compile Include="Resources\Logic.Support.Document.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Logic.Support.Document.resx</DependentUpon>
</Compile>
<Compile Include="Resources\Logic.Support.ErrorMessages.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -668,6 +673,10 @@
<EmbeddedResource Include="Resources\Logic.Structure.Geography.ru-RU.resx" />
<EmbeddedResource Include="Resources\Logic.Structure.Geography.sv-SE.resx" />
<EmbeddedResource Include="Resources\Logic.Structure.Geography.zh-CN.resx" />
<EmbeddedResource Include="Resources\Logic.Support.Document.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Logic.Support.Document.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Logic.Support.ErrorMessages.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Logic.Support.ErrorMessages.Designer.cs</LastGenOutput>
+81
View File
@@ -0,0 +1,81 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Swarmops.Logic.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Logic_Support_Document {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Logic_Support_Document() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Swarmops.Logic.Resources.Logic.Support.Document", typeof(Logic_Support_Document).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to (Single page).
/// </summary>
internal static string PageSingle {
get {
return ResourceManager.GetString("PageSingle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to (Page {0} of {1}).
/// </summary>
internal static string PageXofY {
get {
return ResourceManager.GetString("PageXofY", resourceCulture);
}
}
}
}
+128
View File
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="PageSingle" xml:space="preserve">
<value>(Single page)</value>
<comment>If it is possible to say "this is the only page" or "you're looking at the only page" in the translated language, it's preferable to the English wording. "Only page" doesn't sound like correct English, but your language might have a construct for it.</comment>
</data>
<data name="PageXofY" xml:space="preserve">
<value>(Page {0} of {1})</value>
<comment>This should convey a meaning that there's more than is being looked at.</comment>
</data>
</root>
+1
View File
@@ -21,6 +21,7 @@ namespace Swarmops.Logic.Support
{
foreach (BackendServiceOrder order in this)
{
Console.WriteLine("Excecuting backend order #" + order.Identity); // debug purposes
order.Execute();
}
}
@@ -101,7 +101,8 @@ namespace Swarmops.Logic.Support.BackendServices
{
string executingAssemblyName = Assembly.GetExecutingAssembly().GetName().Name;
string className = this.GetType().FullName;
string serviceClassName = executingAssemblyName + "," + className;
string serviceClassName = BackendServiceClass = executingAssemblyName + "," + className;
this.CreatedDateTime = DateTime.UtcNow;
// Create the service order through reflection and XML serialization
@@ -112,7 +113,11 @@ namespace Swarmops.Logic.Support.BackendServices
public DateTime CreatedDateTime { get; set; }
public string BackendServiceClass { get; set; }
[XmlIgnore]
public int ServiceOrderIdentity { get; set; }
[XmlIgnore]
public bool HasTerminated { get; set; }
[XmlIgnore]
@@ -122,6 +127,7 @@ namespace Swarmops.Logic.Support.BackendServices
[XmlIgnore]
public bool HasWorkerThread { get; set; }
[XmlIgnore]
public Thread WorkerThread { get; set; }
@@ -25,22 +25,30 @@ namespace Swarmops.Logic.Support.BackendServices
HasWorkerThread = true;
WorkerThread = new Thread(LongRun);
WorkerThread.Start(this);
Console.WriteLine(" - Worker thread for #" + this.ServiceOrderIdentity + " started"); // debugging
}
private static void LongRun(object orderObject)
{
RasterizeDocumentHiresOrder order = (RasterizeDocumentHiresOrder) orderObject;
Document document = Document.FromIdentity(order.DocumentId);
RasterizeDocumentHiresOrder order = null;
try
{
order = (RasterizeDocumentHiresOrder)orderObject;
Console.WriteLine(" - Worker thread for #" + order.ServiceOrderIdentity + " running"); // debugging
Document document = Document.FromIdentity(order.DocumentId);
PdfProcessor.Rerasterize((Document)document, PdfProcessor.PdfProcessorOptions.HighQuality | PdfProcessor.PdfProcessorOptions.ForceOrphans);
order.Close();
}
catch (Exception exception)
{
Console.WriteLine(" - Exception thrown: " + exception.ToString()); // debugging
order.ThrewException(exception);
}
order.Close();
order.HasTerminated = true;
if (order != null)
{
order.HasTerminated = true;
}
}
public override void Terminate()
+1 -1
View File
@@ -209,7 +209,7 @@ namespace Swarmops.Logic.Support
long fileLength = new FileInfo(Document.StorageRoot + lastPageFileName).Length;
documents.Add( Document.Create(lastPageFileName,
clientFileName + " " + (pageCounter + 1).ToString(CultureInfo.InvariantCulture) + "/" + pdfPageCount.ToString(CultureInfo.InvariantCulture),
clientFileName + " {{LOCPAGE-" + (pageCounter).ToString(CultureInfo.InvariantCulture) + "-" + pdfPageCount.ToString(CultureInfo.InvariantCulture) + "}}",
fileLength, guid, null, uploader));
// Set to readonly, lock out changes, permit all read