Browse Source

Projektdateien hinzufügen.

Arne Diekmann 5 năm trước cách đây
mục cha
commit
d8a380d6dc

+ 25 - 0
.dockerignore

@@ -0,0 +1,25 @@
+**/.classpath
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/azds.yaml
+**/bin
+**/charts
+**/docker-compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md

+ 25 - 0
GreenTree.Firefly.Importer.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31205.134
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenTree.Firefly.Importer", "GreenTree.Firefly.Importer\GreenTree.Firefly.Importer.csproj", "{6D2A7A60-7A15-4CCE-A875-E44DA52E8DAB}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{6D2A7A60-7A15-4CCE-A875-E44DA52E8DAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6D2A7A60-7A15-4CCE-A875-E44DA52E8DAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6D2A7A60-7A15-4CCE-A875-E44DA52E8DAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6D2A7A60-7A15-4CCE-A875-E44DA52E8DAB}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {FAC6B778-A0C3-47E4-A357-10F4EB6FB109}
+	EndGlobalSection
+EndGlobal

+ 20 - 0
GreenTree.Firefly.Importer/Dockerfile

@@ -0,0 +1,20 @@
+#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
+
+FROM mcr.microsoft.com/dotnet/runtime:3.1 AS base
+WORKDIR /app
+
+FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
+WORKDIR /src
+COPY ["GreenTree.Firefly.Importer/GreenTree.Firefly.Importer.csproj", "GreenTree.Firefly.Importer/"]
+RUN dotnet restore "GreenTree.Firefly.Importer/GreenTree.Firefly.Importer.csproj"
+COPY . .
+WORKDIR "/src/GreenTree.Firefly.Importer"
+RUN dotnet build "GreenTree.Firefly.Importer.csproj" -c Release -o /app/build
+
+FROM build AS publish
+RUN dotnet publish "GreenTree.Firefly.Importer.csproj" -c Release -o /app/publish
+
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
+ENTRYPOINT ["dotnet", "GreenTree.Firefly.Importer.dll"]

+ 15 - 0
GreenTree.Firefly.Importer/GreenTree.Firefly.Importer.csproj

@@ -0,0 +1,15 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
+    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="itext7" Version="7.1.15" />
+    <PackageReference Include="iTextSharp.LGPLv2.Core" Version="1.7.1" />
+    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
+  </ItemGroup>
+
+</Project>

+ 43 - 0
GreenTree.Firefly.Importer/Program.cs

@@ -0,0 +1,43 @@
+using iText.Kernel.Pdf;
+using iText.Kernel.Pdf.Canvas.Parser;
+using iText.Kernel.Pdf.Canvas.Parser.Listener;
+using System;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace GreenTree.Firefly.Importer
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            var file = @"D:\\Downloads\\915733800_2021_Nr.004_Kontoauszug_vom_30.04.2021_20210521024123.pdf";
+            var reader = new PdfReader(file);
+            var pdfDocument = new PdfDocument(reader);
+
+            var pages = pdfDocument.GetNumberOfPages();
+
+            pdfDocument.Close();
+
+            var resultText = new StringBuilder();
+
+            for (int i = 1; i <= pages; i++)
+            {
+                reader = new PdfReader(file);
+                pdfDocument = new PdfDocument(reader);
+
+                var strategy = new LocationTextExtractionStrategy();
+                var page = pdfDocument.GetPage(i);
+
+                var resultLocation = PdfTextExtractor.GetTextFromPage(page, strategy);
+
+                resultText.Append(resultLocation);
+
+                pdfDocument.Close();
+            }
+
+            var allText = resultText.ToString();
+            var regex = Regex.Split(allText, @"\d\d\.\d\d\.\s\d\d\.\d\d\.\s");
+        }
+    }
+}

+ 10 - 0
GreenTree.Firefly.Importer/Properties/launchSettings.json

@@ -0,0 +1,10 @@
+{
+  "profiles": {
+    "GreenTree.Firefly.Importer": {
+      "commandName": "Project"
+    },
+    "Docker": {
+      "commandName": "Docker"
+    }
+  }
+}