Initial Commit

This commit is contained in:
2022-05-24 11:19:34 -07:00
parent 68b2463480
commit 681ffefb58
10 changed files with 619 additions and 1 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EBD5F9D2-02E8-44E7-A91F-C7D28E7D5C7E}</ProjectGuid>
<LangVersion>10.0</LangVersion>
<OutputType>Exe</OutputType>
<RootNamespace>PDF_Text_Stripper</RootNamespace>
<AssemblyName>PDF-Text-Stripper</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="IKVM.AWT.WinForms">
<Version>7.2.4630.5</Version>
</PackageReference>
<PackageReference Include="Pdfbox">
<Version>1.1.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace PDF_Text_Stripper;
internal class Program
{
private static void PDFTextStripper(string file)
{
string altFileName = Path.ChangeExtension(file, ".txt");
if(File.Exists(altFileName))
File.Delete(altFileName);
org.apache.pdfbox.pdmodel.PDDocument pdfDocument = org.apache.pdfbox.pdmodel.PDDocument.load(file);
org.apache.pdfbox.util.PDFTextStripper stripper = new();
string text = stripper.getText(pdfDocument);
pdfDocument.close();
File.WriteAllText(altFileName, text);
}
public static void Secondary(List<string> args)
{
int silentIndex = args.IndexOf("s");
if (silentIndex > -1)
args.RemoveAt(silentIndex);
try
{
if (args.Any() && File.Exists(args[0]))
PDFTextStripper(args[0]);
else
throw new Exception(args[0]);
}
catch (Exception ex)
{
Console.WriteLine(string.Concat(ex.Message, Environment.NewLine, ex.StackTrace));
}
if (silentIndex > -1)
Console.WriteLine("Done. Bye");
else
{
Console.WriteLine("Done. Press 'Enter' to end");
_ = Console.ReadLine();
}
}
public static void Main(string[] args)
{
if (args is not null)
Secondary(args.ToList());
else
Secondary(new List<string>());
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PDFTextStripper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Infineon Technologies")]
[assembly: AssemblyProduct("PDFTextStripper")]
[assembly: AssemblyCopyright("Copyright © Infineon Technologies 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ebd5f9d2-02e8-44e7-a91f-c7d28e7d5c7e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.8.0.1")]
[assembly: AssemblyFileVersion("4.8.0.1")]

View File

@ -0,0 +1,14 @@
{
"scripts": {
"Alpha": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"nuget-clear": "dotnet nuget locals all --clear",
"build": "dotnet build --runtime win-x64 --self-contained",
"build-Package-Management": "dotnet build --runtime win-x64 --self-contained --source https://packagemanagement.eu.infineon.com:4430/api/v2/",
"build-nuget-And-Package-Management": "dotnet build --runtime win-x64 --self-contained --source https://api.nuget.org/v3/index.json --source https://packagemanagement.eu.infineon.com:4430/api/v2/",
"build-All-Sources": "dotnet build --runtime win-x64 --self-contained --source https://api.nuget.org/v3/index.json --source https://packagemanagement.eu.infineon.com:4430/api/v2/ --source https://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json --source http://192.168.0.73:5002/v3/index.json",
"dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity warn",
"MSBuild": "\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe\" /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /DetailedSummary /m /property:Configuration=Debug;TargetFrameworkVersion=v4.8 /restore:True /target:Build PDF-Text-Stripper.sln",
"pull": "git pull",
"garbage-collect": "git gc"
}
}