Pdf Import Rewrite
Pdf Import rewritten to greatly improve QR Code detection, reduce reliance on iTextSharp and improve thumbnails. Fixes #50
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Interop.DiscoServices;
|
||||
using Exceptionless;
|
||||
using Exceptionless.Configuration;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
[assembly: Exceptionless("https://errors.discoict.com.au", "c81e644582374f68aaf1fb546e3db0cd")]
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Disco.Web
|
||||
InitalizeCoreEnvironment(Database);
|
||||
|
||||
// Initialize Expressions
|
||||
BI.Expressions.Expression.InitializeExpressions();
|
||||
Disco.Services.Expressions.Expression.InitializeExpressions();
|
||||
|
||||
// Initialize Job Queues
|
||||
Disco.Services.Jobs.JobQueues.JobQueueService.Initialize(Database);
|
||||
@@ -93,10 +93,11 @@ namespace Disco.Web
|
||||
}
|
||||
|
||||
// Setup Attachment Monitor
|
||||
DiscoApplication.DocumentDropBoxMonitor = new BI.DocumentTemplateBI.Importer.DocumentDropBoxMonitor(Database, DiscoApplication.SchedulerFactory, HttpContext.Current.Cache);
|
||||
var dropboxLocation = DataStore.CreateLocation(Database, "DocumentDropBox");
|
||||
DiscoApplication.DocumentDropBoxMonitor = new Services.Documents.AttachmentImport.ImportDirectoryMonitor(dropboxLocation, DiscoApplication.SchedulerFactory.GetScheduler(), 5000);
|
||||
|
||||
DiscoApplication.DocumentDropBoxMonitor.StartWatching();
|
||||
DiscoApplication.DocumentDropBoxMonitor.ScheduleCurrentFiles(10);
|
||||
DiscoApplication.DocumentDropBoxMonitor.Start();
|
||||
DiscoApplication.DocumentDropBoxMonitor.ScheduleCurrentFiles(10000); // 10 Second Delay
|
||||
}
|
||||
|
||||
public static void InitializeUpdateEnvironment(DiscoDataContext Database, Version PreviousVersion)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Devices.ManagedGroups;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Models.Services.Devices.Importing;
|
||||
using Disco.Models.Services.Documents;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Devices.Exporting;
|
||||
using Disco.Services.Devices.Importing;
|
||||
using Disco.Services.Interop;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Services.Users;
|
||||
using Disco.Services.Web;
|
||||
@@ -388,7 +391,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
var timeStamp = DateTime.Now;
|
||||
Stream pdf;
|
||||
using (var generationState = Disco.Models.BI.DocumentTemplates.DocumentState.DefaultState())
|
||||
using (var generationState = DocumentState.DefaultState())
|
||||
{
|
||||
pdf = documentTemplate.GeneratePdf(Database, device, UserService.CurrentUser, timeStamp, generationState);
|
||||
}
|
||||
@@ -485,7 +488,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
var contentType = file.ContentType;
|
||||
if (string.IsNullOrEmpty(contentType) || contentType.Equals("unknown/unknown", StringComparison.OrdinalIgnoreCase))
|
||||
contentType = BI.Interop.MimeTypes.ResolveMimeType(file.FileName);
|
||||
contentType = MimeTypes.ResolveMimeType(file.FileName);
|
||||
|
||||
var da = new DeviceAttachment()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Plugins;
|
||||
using Disco.Services.Plugins.Features.RepairProvider;
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
using Disco.BI.DocumentTemplateBI.ManagedGroups;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Documents;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Services.Tasks;
|
||||
using Disco.Services.Users;
|
||||
@@ -558,7 +560,9 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned");
|
||||
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf"));
|
||||
if (BI.Interop.Pdf.PdfImporter.ProcessPdfAttachment(filename, Database, DocumentTemplateId, DataId, UserService.CurrentUser.UserId, DateTime.Now))
|
||||
var identifier = DocumentUniqueIdentifier.Create(Database, DocumentTemplateId, DataId, UserService.CurrentUser.UserId, DateTime.Now, 0);
|
||||
|
||||
if (Disco.Services.Documents.AttachmentImport.Importer.ImportPdfAttachment(identifier, Database, filename))
|
||||
{
|
||||
// Delete File
|
||||
System.IO.File.Delete(filename);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Expressions;
|
||||
using Disco.Services.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
@@ -9,7 +10,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
public virtual ActionResult ValidateExpression(string Expression)
|
||||
{
|
||||
var part = new BI.Expressions.EvaluateExpressionPart(Expression);
|
||||
var part = new EvaluateExpressionPart(Expression);
|
||||
return Json(Models.Expressions.ValidateExpressionModel.FromEvaluateExpressionPart(part), JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Models.Services.Documents;
|
||||
using Disco.Models.Services.Jobs.JobLists;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Interop;
|
||||
using Disco.Services.Jobs.JobLists;
|
||||
using Disco.Services.Users;
|
||||
using Disco.Services.Web;
|
||||
@@ -1920,9 +1922,9 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
var contentType = file.ContentType;
|
||||
if (string.IsNullOrEmpty(contentType) || contentType.Equals("unknown/unknown", StringComparison.OrdinalIgnoreCase))
|
||||
contentType = BI.Interop.MimeTypes.ResolveMimeType(file.FileName);
|
||||
contentType = MimeTypes.ResolveMimeType(file.FileName);
|
||||
|
||||
var ja = new Disco.Models.Repository.JobAttachment()
|
||||
var ja = new JobAttachment()
|
||||
{
|
||||
JobId = j.Id,
|
||||
TechUserId = CurrentUser.UserId,
|
||||
@@ -2096,7 +2098,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
var timeStamp = DateTime.Now;
|
||||
Stream pdf;
|
||||
using (var generationState = Disco.Models.BI.DocumentTemplates.DocumentState.DefaultState())
|
||||
using (var generationState = DocumentState.DefaultState())
|
||||
{
|
||||
pdf = documentTemplate.GeneratePdf(Database, job, CurrentUser, timeStamp, generationState);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Data.Configuration;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Services.Interop.DiscoServices;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Services.Documents;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Interop;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Services.Users;
|
||||
using Disco.Services.Web;
|
||||
@@ -70,7 +73,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
var contentType = file.ContentType;
|
||||
if (string.IsNullOrEmpty(contentType) || contentType.Equals("unknown/unknown", StringComparison.OrdinalIgnoreCase))
|
||||
contentType = BI.Interop.MimeTypes.ResolveMimeType(file.FileName);
|
||||
contentType = MimeTypes.ResolveMimeType(file.FileName);
|
||||
|
||||
var ua = new Disco.Models.Repository.UserAttachment()
|
||||
{
|
||||
@@ -171,7 +174,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
var timeStamp = DateTime.Now;
|
||||
Stream pdf;
|
||||
using (var generationState = Disco.Models.BI.DocumentTemplates.DocumentState.DefaultState())
|
||||
using (var generationState = DocumentState.DefaultState())
|
||||
{
|
||||
pdf = documentTemplate.GeneratePdf(Database, user, UserService.CurrentUser, timeStamp, generationState);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Disco.Services.Expressions;
|
||||
using System.Web;
|
||||
using Disco.BI.Expressions;
|
||||
|
||||
namespace Disco.Web.Areas.API.Models.Expressions
|
||||
{
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using Disco.BI.DocumentTemplateBI.ManagedGroups;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.UI.Config.DocumentTemplate;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Expressions;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
using Disco.Services.Web;
|
||||
using System;
|
||||
@@ -137,8 +139,8 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
DeviceType = typeof(Disco.Models.Repository.Device).AssemblyQualifiedName,
|
||||
JobType = typeof(Disco.Models.Repository.Job).AssemblyQualifiedName,
|
||||
UserType = typeof(Disco.Models.Repository.User).AssemblyQualifiedName,
|
||||
Variables = BI.Expressions.Expression.StandardVariableTypes(),
|
||||
ExtensionLibraries = BI.Expressions.Expression.ExtensionLibraryTypes()
|
||||
Variables = Expression.StandardVariableTypes(),
|
||||
ExtensionLibraries = Expression.ExtensionLibraryTypes()
|
||||
};
|
||||
|
||||
// UI Extensions
|
||||
@@ -151,7 +153,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
var t = Type.GetType(type);
|
||||
if (t != null)
|
||||
{
|
||||
return Json(BI.Expressions.ExpressionTypeDescriptor.Build(t, StaticDeclaredMembersOnly), JsonRequestBehavior.AllowGet);
|
||||
return Json(ExpressionTypeDescriptor.Build(t, StaticDeclaredMembersOnly), JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Disco.BI.DocumentTemplateBI.ManagedGroups;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Models.UI.Config.DocumentTemplate;
|
||||
using Disco.BI.DocumentTemplateBI.ManagedGroups;
|
||||
using Disco.Services.Expressions;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
|
||||
{
|
||||
@@ -15,9 +14,9 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
|
||||
|
||||
public int StoredInstanceCount { get; set; }
|
||||
|
||||
public List<Disco.BI.Expressions.Expression> TemplateExpressions { get; set; }
|
||||
public List<Expression> TemplateExpressions { get; set; }
|
||||
|
||||
public List<Disco.Models.Repository.JobType> JobTypes { get; set; }
|
||||
public List<JobType> JobTypes { get; set; }
|
||||
|
||||
public List<string> Scopes
|
||||
{
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
logHub = $.connection.logNotifications;
|
||||
logHub.client.receiveLog = parseLog
|
||||
|
||||
$.connection.hub.qs = { LogModules: '@(Disco.BI.DocumentTemplateBI.DocumentsLog.Current.LiveLogGroupName)' };
|
||||
$.connection.hub.qs = { LogModules: '@(Disco.Services.Documents.DocumentsLog.Current.LiveLogGroupName)' };
|
||||
$.connection.hub.error(onHubFailed);
|
||||
|
||||
$.connection.hub.start()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -466,7 +466,7 @@ WriteLiteral(@"',
|
||||
|
||||
|
||||
#line 309 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Disco.BI.DocumentTemplateBI.DocumentsLog.Current.LiveLogGroupName);
|
||||
Write(Disco.Services.Documents.DocumentsLog.Current.LiveLogGroupName);
|
||||
|
||||
|
||||
#line default
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@model IEnumerable<Disco.BI.Expressions.Expression>
|
||||
@model IEnumerable<Disco.Services.Expressions.Expression>
|
||||
@{
|
||||
Authorization.Require(Claims.Config.DocumentTemplate.Show);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -37,9 +37,9 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DocumentTemplate/_ExpressionsTable.cshtml")]
|
||||
public partial class ExpressionsTable : Disco.Services.Web.WebViewPage<IEnumerable<Disco.BI.Expressions.Expression>>
|
||||
public partial class _ExpressionsTable : Disco.Services.Web.WebViewPage<IEnumerable<Disco.Services.Expressions.Expression>>
|
||||
{
|
||||
public ExpressionsTable()
|
||||
public _ExpressionsTable()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
@@ -107,14 +107,14 @@ WriteLiteral(@">
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td");
|
||||
|
||||
WriteAttribute("rowspan", Tuple.Create(" rowspan=\"", 719), Tuple.Create("\"", 754)
|
||||
WriteAttribute("rowspan", Tuple.Create(" rowspan=\"", 725), Tuple.Create("\"", 760)
|
||||
|
||||
#line 24 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 729), Tuple.Create<System.Object, System.Int32>(expressionParts.Length
|
||||
, Tuple.Create(Tuple.Create("", 735), Tuple.Create<System.Object, System.Int32>(expressionParts.Length
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 729), false)
|
||||
, 735), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Web.Mvc;
|
||||
using Disco.Services.Plugins;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Users;
|
||||
using Disco.Services.Interop;
|
||||
|
||||
namespace Disco.Web.Controllers
|
||||
{
|
||||
@@ -57,7 +58,7 @@ namespace Disco.Web.Controllers
|
||||
|
||||
var pluginResourcePath = pluginResource.Item1;
|
||||
|
||||
var mimeType = Disco.BI.Interop.MimeTypes.ResolveMimeType(pluginResourcePath);
|
||||
var mimeType = MimeTypes.ResolveMimeType(pluginResourcePath);
|
||||
if (Download.HasValue && Download.Value)
|
||||
return File(pluginResourcePath, mimeType, Path.GetFileName(pluginResourcePath));
|
||||
else
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace Disco.Web
|
||||
}
|
||||
#endregion
|
||||
#region Dropbox Monitor
|
||||
public static BI.DocumentTemplateBI.Importer.DocumentDropBoxMonitor DocumentDropBoxMonitor { get; set; }
|
||||
public static Disco.Services.Documents.AttachmentImport.ImportDirectoryMonitor DocumentDropBoxMonitor { get; set; }
|
||||
#endregion
|
||||
#region Global Error Logging
|
||||
void DiscoApplication_Error(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user