mirror of
https://github.com/cyanfish/naps2.git
synced 2024-09-11 15:26:55 +03:00
Add xml doc and remove unnecessary types
This commit is contained in:
parent
8653b48410
commit
1eacb9986f
@ -12,13 +12,13 @@ public class AutoSaver
|
||||
private readonly DialogHelper _dialogHelper;
|
||||
private readonly OperationProgress _operationProgress;
|
||||
private readonly ISaveNotify _notify;
|
||||
private readonly IPdfExporter _pdfExporter;
|
||||
private readonly PdfExporter _pdfExporter;
|
||||
private readonly IOverwritePrompt _overwritePrompt;
|
||||
private readonly Naps2Config _config;
|
||||
private readonly ImageContext _imageContext;
|
||||
|
||||
public AutoSaver(ErrorOutput errorOutput, DialogHelper dialogHelper,
|
||||
OperationProgress operationProgress, ISaveNotify notify, IPdfExporter pdfExporter,
|
||||
OperationProgress operationProgress, ISaveNotify notify, PdfExporter pdfExporter,
|
||||
IOverwritePrompt overwritePrompt, Naps2Config config, ImageContext imageContext)
|
||||
{
|
||||
_errorOutput = errorOutput;
|
||||
|
@ -20,7 +20,6 @@ public class CommonModule : Module
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
// Export
|
||||
builder.RegisterType<PdfExporter>().As<IPdfExporter>();
|
||||
builder.RegisterType<AutofacEmailProviderFactory>().As<IEmailProviderFactory>();
|
||||
builder.RegisterType<StubMapiWrapper>().As<IMapiWrapper>();
|
||||
builder.RegisterType<OcrRequestQueue>().AsSelf().SingleInstance();
|
||||
|
@ -6,11 +6,11 @@ namespace NAPS2.Pdf;
|
||||
|
||||
internal class SavePdfOperation : OperationBase
|
||||
{
|
||||
private readonly IPdfExporter _pdfExporter;
|
||||
private readonly PdfExporter _pdfExporter;
|
||||
private readonly IOverwritePrompt _overwritePrompt;
|
||||
private readonly IEmailProviderFactory? _emailProviderFactory;
|
||||
|
||||
public SavePdfOperation(IPdfExporter pdfExporter, IOverwritePrompt overwritePrompt,
|
||||
public SavePdfOperation(PdfExporter pdfExporter, IOverwritePrompt overwritePrompt,
|
||||
IEmailProviderFactory? emailProviderFactory = null)
|
||||
{
|
||||
_pdfExporter = pdfExporter;
|
||||
|
@ -12,14 +12,14 @@ namespace NAPS2.Scan.Batch;
|
||||
public class BatchScanPerformer : IBatchScanPerformer
|
||||
{
|
||||
private readonly IScanPerformer _scanPerformer;
|
||||
private readonly IPdfExporter _pdfExporter;
|
||||
private readonly PdfExporter _pdfExporter;
|
||||
private readonly IOperationFactory _operationFactory;
|
||||
private readonly IFormFactory _formFactory;
|
||||
private readonly Naps2Config _config;
|
||||
private readonly IProfileManager _profileManager;
|
||||
private readonly ThumbnailController _thumbnailController;
|
||||
|
||||
public BatchScanPerformer(IScanPerformer scanPerformer, IPdfExporter pdfExporter,
|
||||
public BatchScanPerformer(IScanPerformer scanPerformer, PdfExporter pdfExporter,
|
||||
IOperationFactory operationFactory,
|
||||
IFormFactory formFactory, Naps2Config config, IProfileManager profileManager,
|
||||
ThumbnailController thumbnailController)
|
||||
@ -44,7 +44,7 @@ public class BatchScanPerformer : IBatchScanPerformer
|
||||
private class BatchState
|
||||
{
|
||||
private readonly IScanPerformer _scanPerformer;
|
||||
private readonly IPdfExporter _pdfExporter;
|
||||
private readonly PdfExporter _pdfExporter;
|
||||
private readonly IOperationFactory _operationFactory;
|
||||
private readonly IFormFactory _formFactory;
|
||||
private readonly Naps2Config _config;
|
||||
@ -60,7 +60,7 @@ public class BatchScanPerformer : IBatchScanPerformer
|
||||
private ScanParams _scanParams;
|
||||
private List<List<ProcessedImage>> _scans;
|
||||
|
||||
public BatchState(IScanPerformer scanPerformer, IPdfExporter pdfExporter, IOperationFactory operationFactory,
|
||||
public BatchState(IScanPerformer scanPerformer, PdfExporter pdfExporter, IOperationFactory operationFactory,
|
||||
IFormFactory formFactory, Naps2Config config, IProfileManager profileManager,
|
||||
ThumbnailController thumbnailController, BatchSettings settings,
|
||||
Action<string> progressCallback, CancellationToken cancelToken, IFormBase batchForm,
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace NAPS2.ImportExport;
|
||||
|
||||
/// <summary>
|
||||
/// Additional parameters for importing files (e.g. PDF password, barcode detection, thumbnail rendering).
|
||||
/// </summary>
|
||||
public class ImportParams
|
||||
{
|
||||
public ImportParams()
|
||||
|
@ -3,6 +3,9 @@ using NAPS2.Scan;
|
||||
|
||||
namespace NAPS2.Ocr;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for OCR (optical character recognition). See TesseractOcrEngine.
|
||||
/// </summary>
|
||||
public interface IOcrEngine
|
||||
{
|
||||
Task<OcrResult?> ProcessImage(ScanningContext scanningContext, string imagePath, OcrParams ocrParams,
|
||||
|
@ -1,5 +1,8 @@
|
||||
namespace NAPS2.Ocr;
|
||||
|
||||
/// <summary>
|
||||
/// The mode of an OCR request (fast/best), if supported by the engine.
|
||||
/// </summary>
|
||||
public enum OcrMode
|
||||
{
|
||||
Default,
|
||||
|
@ -7,6 +7,9 @@ using NAPS2.Unmanaged;
|
||||
|
||||
namespace NAPS2.Ocr;
|
||||
|
||||
/// <summary>
|
||||
/// OCR engine using Tesseract (https://github.com/tesseract-ocr/tesseract).
|
||||
/// </summary>
|
||||
public class TesseractOcrEngine : IOcrEngine
|
||||
{
|
||||
private readonly string _tesseractPath;
|
||||
|
@ -1,12 +0,0 @@
|
||||
using NAPS2.Ocr;
|
||||
|
||||
namespace NAPS2.Pdf;
|
||||
|
||||
public interface IPdfExporter
|
||||
{
|
||||
Task<bool> Export(string path, ICollection<ProcessedImage> images, PdfExportParams? exportParams = null,
|
||||
OcrParams? ocrParams = null, ProgressHandler progress = default);
|
||||
|
||||
Task<bool> Export(Stream stream, ICollection<ProcessedImage> images, PdfExportParams? exportParams = null,
|
||||
OcrParams? ocrParams = null, ProgressHandler progress = default);
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
namespace NAPS2.Pdf;
|
||||
|
||||
/// <summary>
|
||||
/// Compatibility format for generating PDFs, e.g. PDF/A (https://en.wikipedia.org/wiki/PDF/A).
|
||||
/// </summary>
|
||||
public enum PdfCompat
|
||||
{
|
||||
Default,
|
||||
|
@ -1,5 +1,8 @@
|
||||
namespace NAPS2.Pdf;
|
||||
|
||||
/// <summary>
|
||||
/// Configuration for PDF encryption (e.g. passwords, permissions).
|
||||
/// </summary>
|
||||
public record PdfEncryption
|
||||
{
|
||||
public bool EncryptPdf { get; init; }
|
||||
|
@ -1,5 +1,8 @@
|
||||
namespace NAPS2.Pdf;
|
||||
|
||||
/// <summary>
|
||||
/// Additional parameters for exporting PDFs (metadata, encryption, compatibility).
|
||||
/// </summary>
|
||||
public record PdfExportParams
|
||||
{
|
||||
public PdfExportParams()
|
||||
|
@ -16,7 +16,10 @@ using PdfPage = PdfSharpCore.Pdf.PdfPage;
|
||||
|
||||
namespace NAPS2.Pdf;
|
||||
|
||||
public class PdfExporter : IPdfExporter
|
||||
/// <summary>
|
||||
/// Exports images to a PDF file.
|
||||
/// </summary>
|
||||
public class PdfExporter
|
||||
{
|
||||
private readonly ScanningContext _scanningContext;
|
||||
private readonly ILogger _logger;
|
||||
|
@ -1,14 +0,0 @@
|
||||
namespace NAPS2.Pdf;
|
||||
|
||||
public class PdfImportException : Exception
|
||||
{
|
||||
public PdfImportException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public PdfImportException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
namespace NAPS2.Pdf;
|
||||
|
||||
/// <summary>
|
||||
/// Represents standard PDF metadata (e.g. author, subject, title).
|
||||
/// </summary>
|
||||
public record PdfMetadata
|
||||
{
|
||||
public string Author { get; init; } = "";
|
||||
|
@ -6,7 +6,7 @@ using NAPS2.Scan;
|
||||
namespace NAPS2.Pdf;
|
||||
|
||||
// TODO: Experimental. Also remember that this is failing with access violations on 32-bit (see tests).
|
||||
internal class PdfiumPdfExporter : IPdfExporter
|
||||
internal class PdfiumPdfExporter
|
||||
{
|
||||
private readonly ScanningContext _scanningContext;
|
||||
private readonly ILogger _logger;
|
||||
|
Loading…
Reference in New Issue
Block a user