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,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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user