Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 062f80f84c | |||
| 98a6b8e746 | |||
| a46bf67f81 | |||
| 6faf2d0fbe | |||
| 70c6272113 | |||
| 3108d03a75 | |||
| c651a22209 | |||
| f946a1bc1a | |||
| cfd8c37ab8 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -29,3 +29,6 @@ _ReSharper*/
|
|||||||
*.nupkg
|
*.nupkg
|
||||||
|
|
||||||
.vs
|
.vs
|
||||||
|
PDFTests
|
||||||
|
Doc
|
||||||
|
/.issues/
|
||||||
|
|||||||
51
README.md
51
README.md
@@ -6,42 +6,40 @@
|
|||||||
Add the resulting assembly as reference in your projects, and this line on code:
|
Add the resulting assembly as reference in your projects, and this line on code:
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
using VAR.PdfTools;
|
using VAR.PdfTools;
|
||||||
```
|
```
|
||||||
|
|
||||||
Then extract the contents of a data column using:
|
Then extract the contents of a data column using:
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
var columnData = new List<string>();
|
var columnData = new List<string>();
|
||||||
PdfDocument doc = PdfDocument.Load("document.pdf");
|
PdfDocument doc = PdfDocument.Load("document.pdf");
|
||||||
foreach (PdfDocumentPage page in doc.Pages)
|
foreach (PdfDocumentPage page in doc.Pages)
|
||||||
{
|
{
|
||||||
PdfTextExtractor extractor = new PdfTextExtractor(page);
|
PdfTextExtractor extractor = new PdfTextExtractor(page);
|
||||||
columnData.AddRange(extractor.GetColumnAsStrings("Column"));
|
columnData.AddRange(extractor.GetColumnAsStrings("Column"));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Or the content of a field (text on the right of the indicated text):
|
Or the content of a field (text on the right of the indicated text):
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
var fieldData = new List<string>();
|
var fieldData = new List<string>();
|
||||||
PdfDocument doc = PdfDocument.Load("document.pdf");
|
PdfDocument doc = PdfDocument.Load("document.pdf");
|
||||||
foreach (PdfDocumentPage page in doc.Pages)
|
foreach (PdfDocumentPage page in doc.Pages)
|
||||||
{
|
{
|
||||||
PdfTextExtractor extractor = new PdfTextExtractor(page);
|
PdfTextExtractor extractor = new PdfTextExtractor(page);
|
||||||
fieldData.Add(extractor.GetFieldAsString(txtFieldName.Text));
|
fieldData.Add(extractor.GetFieldAsString(txtFieldName.Text));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### VAR.PdfTools.Workbench
|
### VAR.PdfTools.Workbench
|
||||||
It is a simple Windows.Forms application, to test basic funcitionallity of the library.
|
It is a simple Windows.Forms application, to test basic funcitionallity of the library.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
A Visual Studio 2015 and 2010 solutions are provided. Simply, click build on the IDE.
|
A Visual Studio solution is provided. Simply, click build on the IDE.
|
||||||
|
|
||||||
A .nuget package can be build using:
|
The build generates a DLL and a Nuget package.
|
||||||
|
|
||||||
VAR.PdfTools\Build.NuGet.cmd
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
1. Fork it!
|
1. Fork it!
|
||||||
@@ -53,26 +51,3 @@ A .nuget package can be build using:
|
|||||||
## Credits
|
## Credits
|
||||||
* Valeriano Alfonso Rodriguez.
|
* Valeriano Alfonso Rodriguez.
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2016-2019 Valeriano Alfonso Rodriguez
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|||||||
@@ -333,6 +333,8 @@ namespace VAR.PdfTools.Workbench
|
|||||||
pdfPageRenderer.RenderColumn(columnData, bmp);
|
pdfPageRenderer.RenderColumn(columnData, bmp);
|
||||||
string fileName = Path.Combine(baseDocumentPath, string.Format("{0}_{1:0000}.png", baseDocumentFilename, pageNum));
|
string fileName = Path.Combine(baseDocumentPath, string.Format("{0}_{1:0000}.png", baseDocumentFilename, pageNum));
|
||||||
bmp.Save(fileName, ImageFormat.Png);
|
bmp.Save(fileName, ImageFormat.Png);
|
||||||
|
bmp.Dispose();
|
||||||
|
GC.Collect();
|
||||||
}
|
}
|
||||||
columns.AddRange(columnData.Elements.Select(t => t.VisibleText));
|
columns.AddRange(columnData.Elements.Select(t => t.VisibleText));
|
||||||
}
|
}
|
||||||
@@ -370,6 +372,8 @@ namespace VAR.PdfTools.Workbench
|
|||||||
// Save image to disk
|
// Save image to disk
|
||||||
string fileName = Path.Combine(baseDocumentPath, string.Format("{0}_{1:0000}.png", baseDocumentFilename, pageNum));
|
string fileName = Path.Combine(baseDocumentPath, string.Format("{0}_{1:0000}.png", baseDocumentFilename, pageNum));
|
||||||
bmp.Save(fileName, ImageFormat.Png);
|
bmp.Save(fileName, ImageFormat.Png);
|
||||||
|
bmp.Dispose();
|
||||||
|
GC.Collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
txtOutput.Lines = lines.ToArray();
|
txtOutput.Lines = lines.ToArray();
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
[assembly: AssemblyTitle("VAR.PdfTools.Workbench")]
|
|
||||||
[assembly: AssemblyDescription("PdfTools Workbench")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("VAR")]
|
|
||||||
[assembly: AssemblyProduct("VAR.PdfTools.Workbench")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © VAR 2016")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
[assembly: Guid("a5825d8e-9f81-49e0-b610-8ae5e46d02ea")]
|
|
||||||
[assembly: AssemblyVersion("1.6.0.*")]
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
|
-->
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Any CPU</Platform>
|
||||||
|
<PublishDir>bin\Release\net5.0-windows\publish\</PublishDir>
|
||||||
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
|
<TargetFramework>net5.0-windows</TargetFramework>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
|
<PublishSingleFile>True</PublishSingleFile>
|
||||||
|
<PublishReadyToRun>False</PublishReadyToRun>
|
||||||
|
<IncludeNativeLibrariesForSelfExtract>True</IncludeNativeLibrariesForSelfExtract>
|
||||||
|
<PublishTrimmed>True</PublishTrimmed>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -1,80 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<TargetFramework>net5.0-windows</TargetFramework>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{A5825D8E-9F81-49E0-B610-8AE5E46D02EA}</ProjectGuid>
|
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<RootNamespace>VAR.PdfTools.Workbench</RootNamespace>
|
|
||||||
<AssemblyName>VAR.PdfTools.Workbench</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
|
||||||
<TargetFrameworkProfile />
|
|
||||||
</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>
|
|
||||||
<LangVersion>6</LangVersion>
|
|
||||||
</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>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<StartupObject />
|
<PackageId>VAR.PdfTools.Workbench</PackageId>
|
||||||
|
<Title>VAR.PdfTools.Workbench</Title>
|
||||||
|
<Version>1.6.1</Version>
|
||||||
|
<Description>PdfTools Workbench</Description>
|
||||||
|
<Authors>VAR</Authors>
|
||||||
|
<Company>VAR</Company>
|
||||||
|
<Copyright>Copyright © VAR 2016-2019</Copyright>
|
||||||
|
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
|
||||||
|
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
|
||||||
|
<PackageProjectUrl>https://github.com/Kableado/VAR.PdfTools</PackageProjectUrl>
|
||||||
|
<PackageTags>PDF;PDF Tool</PackageTags>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Content Include="..\LICENSE.txt" Link="LICENSE.txt" Pack="true" PackagePath="" />
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Configuration.cs" />
|
<ProjectReference Include="..\VAR.PdfTools\VAR.PdfTools.csproj" />
|
||||||
<Compile Include="FrmPdfInfo.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="FrmPdfInfo.Designer.cs">
|
|
||||||
<DependentUpon>FrmPdfInfo.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\VAR.PdfTools\VAR.PdfTools.csproj">
|
|
||||||
<Project>{eb7e003a-6a95-4002-809f-926c7c8a11e9}</Project>
|
|
||||||
<Name>VAR.PdfTools</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="FrmPdfInfo.resx">
|
|
||||||
<DependentUpon>FrmPdfInfo.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 14
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 14.0.25420.1
|
VisualStudioVersion = 16.0.31402.337
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.PdfTools", "VAR.PdfTools\VAR.PdfTools.csproj", "{EB7E003A-6A95-4002-809F-926C7C8A11E9}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.PdfTools", "VAR.PdfTools\VAR.PdfTools.csproj", "{EB7E003A-6A95-4002-809F-926C7C8A11E9}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -19,10 +19,10 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{EB7E003A-6A95-4002-809F-926C7C8A11E9}.Debug|Any CPU.ActiveCfg = Debug .Net 4.6.1|Any CPU
|
{EB7E003A-6A95-4002-809F-926C7C8A11E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{EB7E003A-6A95-4002-809F-926C7C8A11E9}.Debug|Any CPU.Build.0 = Debug .Net 4.6.1|Any CPU
|
{EB7E003A-6A95-4002-809F-926C7C8A11E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{EB7E003A-6A95-4002-809F-926C7C8A11E9}.Release|Any CPU.ActiveCfg = Release .Net 4.6.1|Any CPU
|
{EB7E003A-6A95-4002-809F-926C7C8A11E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{EB7E003A-6A95-4002-809F-926C7C8A11E9}.Release|Any CPU.Build.0 = Release .Net 4.6.1|Any CPU
|
{EB7E003A-6A95-4002-809F-926C7C8A11E9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{A5825D8E-9F81-49E0-B610-8AE5E46D02EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{A5825D8E-9F81-49E0-B610-8AE5E46D02EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{A5825D8E-9F81-49E0-B610-8AE5E46D02EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A5825D8E-9F81-49E0-B610-8AE5E46D02EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{A5825D8E-9F81-49E0-B610-8AE5E46D02EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{A5825D8E-9F81-49E0-B610-8AE5E46D02EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@@ -31,4 +31,7 @@ Global
|
|||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {7E5F981A-8918-4C9E-AC9C-A798E2F3DA69}
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
:: MSBuild and tools path
|
|
||||||
if exist "%windir%\Microsoft.Net\Framework\v4.0.30319" set MsBuildPath=%windir%\Microsoft.NET\Framework\v4.0.30319
|
|
||||||
if exist "%windir%\Microsoft.Net\Framework64\v4.0.30319" set MsBuildPath=%windir%\Microsoft.NET\Framework64\v4.0.30319
|
|
||||||
if exist "C:\Program Files (x86)\MSBuild\14.0\Bin" set MsBuildPath=C:\Program Files (x86)\MSBuild\14.0\Bin
|
|
||||||
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin" set MsBuildPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
|
|
||||||
set PATH=%MsBuildPath%;%PATH%
|
|
||||||
|
|
||||||
echo %MsBuildPath%
|
|
||||||
|
|
||||||
:: NuGet
|
|
||||||
set nuget="nuget"
|
|
||||||
if exist "%~dp0..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe" set nuget="%~dp0\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe"
|
|
||||||
|
|
||||||
:: Release .Net 3.5
|
|
||||||
Title Building Release .Net 3.5
|
|
||||||
msbuild VAR.PdfTools.csproj /t:Build /p:Configuration="Release .Net 3.5" /p:Platform="AnyCPU"
|
|
||||||
|
|
||||||
:: Release .Net 4.6.1
|
|
||||||
Title Building Release .Net 4.6.1
|
|
||||||
msbuild VAR.PdfTools.csproj /t:Build /p:Configuration="Release .Net 4.6.1" /p:Platform="AnyCPU"
|
|
||||||
|
|
||||||
:: Packing Nuget
|
|
||||||
Title Packing Nuget
|
|
||||||
%nuget% pack VAR.PdfTools.csproj -Verbosity detailed -OutputDir "NuGet" -Properties Configuration="Release .Net 4.6.1" -Prop Platform=AnyCPU
|
|
||||||
|
|
||||||
title Finished
|
|
||||||
pause
|
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace VAR.PdfTools.Maths
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace VAR.PdfTools.Maths
|
|
||||||
{
|
{
|
||||||
public class Rect
|
public class Rect
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,26 +38,50 @@ namespace VAR.PdfTools
|
|||||||
|
|
||||||
private static void ApplyFilterToStream(PdfStream stream, string filter)
|
private static void ApplyFilterToStream(PdfStream stream, string filter)
|
||||||
{
|
{
|
||||||
if (filter == "FlateDecode")
|
if(filter == "ASCIIHexDecode")
|
||||||
|
{
|
||||||
|
// TODO: Implement ASCIIHexDecode Filter
|
||||||
|
}
|
||||||
|
else if (filter == "ASCII85Decode" || filter == "A85")
|
||||||
|
{
|
||||||
|
// TODO: Implement ASCII85Decode Filter
|
||||||
|
}
|
||||||
|
else if (filter == "LZWDecode")
|
||||||
|
{
|
||||||
|
// TODO: Implement LZWDecode Filter
|
||||||
|
}
|
||||||
|
else if (filter == "FlateDecode")
|
||||||
{
|
{
|
||||||
byte[] decodedStreamData = PdfFilters.FlateDecode.Decode(stream.Data);
|
byte[] decodedStreamData = PdfFilters.FlateDecode.Decode(stream.Data);
|
||||||
stream.Data = decodedStreamData;
|
stream.Data = decodedStreamData;
|
||||||
}
|
}
|
||||||
else if (filter == "ASCII85Decode" || filter == "A85")
|
else if (filter == "RunLengthDecode")
|
||||||
{
|
{
|
||||||
// FIXME: Implement this filter
|
// TODO: Implement RunLengthDecode Filter
|
||||||
}
|
}
|
||||||
else if (filter == "CCITTFaxDecode")
|
else if (filter == "CCITTFaxDecode")
|
||||||
{
|
{
|
||||||
// FIXME: Implement this filter
|
// TODO: Implement CCITTFaxDecode Filter
|
||||||
|
}
|
||||||
|
else if (filter == "JBIG2Decode")
|
||||||
|
{
|
||||||
|
// TODO: Implement JBIG2Decode Filter
|
||||||
}
|
}
|
||||||
else if (filter == "DCTDecode")
|
else if (filter == "DCTDecode")
|
||||||
{
|
{
|
||||||
// FIXME: Implement this filter
|
// TODO: Implement DCTDecode Filter
|
||||||
|
}
|
||||||
|
else if (filter == "JPXDecode")
|
||||||
|
{
|
||||||
|
// TODO: Implement JPXDecode Filter
|
||||||
|
}
|
||||||
|
else if (filter == "Crypt")
|
||||||
|
{
|
||||||
|
// TODO: Implement Crypt Filter
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// FIXME: Implement the rest of filters
|
// TODO: Handle unknown filters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace VAR.PdfTools
|
|||||||
|
|
||||||
private void ParseSizes()
|
private void ParseSizes()
|
||||||
{
|
{
|
||||||
double glyphSpaceToTextSpace = 1000.0; // FIXME: SubType:Type3 Uses a FontMatrix that may not correspond to 1/1000th
|
double glyphSpaceToTextSpace = 1000.0; // TODO: PdfFont.ParseSizes: SubType:Type3 Uses a FontMatrix that may not correspond to 1/1000th
|
||||||
_widths = new Dictionary<char, double>();
|
_widths = new Dictionary<char, double>();
|
||||||
char firstChar = (char)_baseData.GetParamAsInt("FirstChar");
|
char firstChar = (char)_baseData.GetParamAsInt("FirstChar");
|
||||||
char lastChar = (char)_baseData.GetParamAsInt("LastChar");
|
char lastChar = (char)_baseData.GetParamAsInt("LastChar");
|
||||||
@@ -177,7 +177,7 @@ namespace VAR.PdfTools
|
|||||||
{
|
{
|
||||||
if (_toUnicode == null)
|
if (_toUnicode == null)
|
||||||
{
|
{
|
||||||
// FIXME: use standar tables
|
// TODO: PdfFont.ToUnicode: use standar tables
|
||||||
return new string(character, 1);
|
return new string(character, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -852,7 +852,7 @@ namespace VAR.PdfTools
|
|||||||
string token = ParseToken();
|
string token = ParseToken();
|
||||||
if (token == "startxref")
|
if (token == "startxref")
|
||||||
{
|
{
|
||||||
// FIXME: Ignoring startxref for now
|
// TODO: PdfParser: Ignoring startxref for now
|
||||||
SkipEndOfLine();
|
SkipEndOfLine();
|
||||||
SkipToEndOfLine();
|
SkipToEndOfLine();
|
||||||
SkipEndOfLine();
|
SkipEndOfLine();
|
||||||
@@ -863,7 +863,7 @@ namespace VAR.PdfTools
|
|||||||
}
|
}
|
||||||
if (token == "xref")
|
if (token == "xref")
|
||||||
{
|
{
|
||||||
// FIXME: Ignoring xref for now
|
// TODO: PdfParser: Ignoring xref for now
|
||||||
SkipToEndOfLine();
|
SkipToEndOfLine();
|
||||||
SkipEndOfLine();
|
SkipEndOfLine();
|
||||||
do
|
do
|
||||||
@@ -891,7 +891,7 @@ namespace VAR.PdfTools
|
|||||||
}
|
}
|
||||||
if (token == "trailer")
|
if (token == "trailer")
|
||||||
{
|
{
|
||||||
// FIXME: Ignoring trailer for now
|
// TODO: PdfParser: Ignoring trailer for now
|
||||||
SkipEndOfLine();
|
SkipEndOfLine();
|
||||||
ParseElement();
|
ParseElement();
|
||||||
SkipWhitespace();
|
SkipWhitespace();
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ namespace VAR.PdfTools
|
|||||||
}
|
}
|
||||||
else if (action.Token == "Tz")
|
else if (action.Token == "Tz")
|
||||||
{
|
{
|
||||||
// FIXME: Horizontal Scale
|
// TODO: PdfTextExtractor: Horizontal Scale
|
||||||
}
|
}
|
||||||
else if (action.Token == "Tf")
|
else if (action.Token == "Tf")
|
||||||
{
|
{
|
||||||
@@ -385,11 +385,11 @@ namespace VAR.PdfTools
|
|||||||
}
|
}
|
||||||
else if (action.Token == "Tr")
|
else if (action.Token == "Tr")
|
||||||
{
|
{
|
||||||
// FIXME: Rendering mode
|
// TODO: PdfTextExtractor: Rendering mode
|
||||||
}
|
}
|
||||||
else if (action.Token == "Ts")
|
else if (action.Token == "Ts")
|
||||||
{
|
{
|
||||||
// FIXME: Text rise
|
// TODO: PdfTextExtractor: Text rise
|
||||||
}
|
}
|
||||||
else if (action.Token == "Td")
|
else if (action.Token == "Td")
|
||||||
{
|
{
|
||||||
@@ -444,82 +444,82 @@ namespace VAR.PdfTools
|
|||||||
}
|
}
|
||||||
else if (action.Token == "re")
|
else if (action.Token == "re")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this
|
// TODO: PdfTextExtractor: Interpret this
|
||||||
}
|
}
|
||||||
else if (action.Token == "f")
|
else if (action.Token == "f")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this
|
// TODO: PdfTextExtractor: Interpret this
|
||||||
}
|
}
|
||||||
else if (action.Token == "g")
|
else if (action.Token == "g")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this
|
// TODO: PdfTextExtractor: Interpret this
|
||||||
}
|
}
|
||||||
else if (action.Token == "rg")
|
else if (action.Token == "rg")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this
|
// TODO: PdfTextExtractor: Interpret this
|
||||||
}
|
}
|
||||||
else if (action.Token == "BI")
|
else if (action.Token == "BI")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this
|
// TODO: PdfTextExtractor: Interpret this
|
||||||
}
|
}
|
||||||
else if (action.Token == "ID")
|
else if (action.Token == "ID")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this
|
// TODO: PdfTextExtractor: Interpret this
|
||||||
}
|
}
|
||||||
else if (action.Token == "EI")
|
else if (action.Token == "EI")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this
|
// TODO: PdfTextExtractor: Interpret this
|
||||||
}
|
}
|
||||||
else if (action.Token == "W")
|
else if (action.Token == "W")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this
|
// TODO: PdfTextExtractor: Interpret this
|
||||||
}
|
}
|
||||||
else if (action.Token == "n")
|
else if (action.Token == "n")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this
|
// TODO: PdfTextExtractor: Interpret this
|
||||||
}
|
}
|
||||||
else if (action.Token == "Do")
|
else if (action.Token == "Do")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this
|
// TODO: PdfTextExtractor: Interpret this
|
||||||
}
|
}
|
||||||
else if (action.Token == "m")
|
else if (action.Token == "m")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this "moveto: Begin new subpath"
|
// TODO: PdfTextExtractor: Interpret this "moveto: Begin new subpath"
|
||||||
}
|
}
|
||||||
else if (action.Token == "l")
|
else if (action.Token == "l")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this "lineto: Append straight line segment to path"
|
// TODO: PdfTextExtractor: Interpret this "lineto: Append straight line segment to path"
|
||||||
lineCount++;
|
lineCount++;
|
||||||
}
|
}
|
||||||
else if (action.Token == "h")
|
else if (action.Token == "h")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this "closepath: Close subpath"
|
// TODO: PdfTextExtractor: Interpret this "closepath: Close subpath"
|
||||||
pathCount++;
|
pathCount++;
|
||||||
}
|
}
|
||||||
else if (action.Token == "W")
|
else if (action.Token == "W")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this "clip: Set clipping path using nonzero winding number rule"
|
// TODO: PdfTextExtractor: Interpret this "clip: Set clipping path using nonzero winding number rule"
|
||||||
}
|
}
|
||||||
else if (action.Token == "W*")
|
else if (action.Token == "W*")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this "eoclip: Set clipping path using even-odd rule"
|
// TODO: PdfTextExtractor: Interpret this "eoclip: Set clipping path using even-odd rule"
|
||||||
}
|
}
|
||||||
else if (action.Token == "w")
|
else if (action.Token == "w")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this "setlinewidth: Set line width"
|
// TODO: PdfTextExtractor: Interpret this "setlinewidth: Set line width"
|
||||||
}
|
}
|
||||||
else if (action.Token == "G")
|
else if (action.Token == "G")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this "setgray: Set gray level for stroking operations"
|
// TODO: PdfTextExtractor: Interpret this "setgray: Set gray level for stroking operations"
|
||||||
}
|
}
|
||||||
else if (action.Token == "S")
|
else if (action.Token == "S")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this "stroke: Stroke path"
|
// TODO: PdfTextExtractor: Interpret this "stroke: Stroke path"
|
||||||
strokeCount++;
|
strokeCount++;
|
||||||
}
|
}
|
||||||
else if (action.Token == "M")
|
else if (action.Token == "M")
|
||||||
{
|
{
|
||||||
// FIXME: Interpret this "setmiterlimit: Set miter limit"
|
// TODO: PdfTextExtractor: Interpret this "setmiterlimit: Set miter limit"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
[assembly: AssemblyTitle("VAR.PdfTools")]
|
|
||||||
[assembly: AssemblyDescription("PdfTools Library")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("VAR")]
|
|
||||||
[assembly: AssemblyProduct("VAR.PdfTools")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © VAR 2016-2019")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
[assembly: Guid("eb7e003a-6a95-4002-809f-926c7c8a11e9")]
|
|
||||||
[assembly: AssemblyVersion("1.6.0.*")]
|
|
||||||
@@ -1,110 +1,30 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{EB7E003A-6A95-4002-809F-926C7C8A11E9}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<IsPackable>true</IsPackable>
|
||||||
<RootNamespace>VAR.PdfTools</RootNamespace>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<AssemblyName>VAR.PdfTools</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<TargetFrameworkProfile />
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug .Net 4.6.1|AnyCPU' ">
|
<PropertyGroup>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<PackageId>VAR.PdfTools</PackageId>
|
||||||
<DebugType>full</DebugType>
|
<Title>VAR.PdfTools</Title>
|
||||||
<Optimize>false</Optimize>
|
<Version>1.6.1</Version>
|
||||||
<OutputPath>bin\Debug\net461</OutputPath>
|
<Description>PdfTools Library</Description>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<Authors>VAR</Authors>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<Company>VAR</Company>
|
||||||
<WarningLevel>4</WarningLevel>
|
<Copyright>Copyright © VAR 2016-2019</Copyright>
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
|
||||||
<LangVersion>6</LangVersion>
|
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
|
||||||
</PropertyGroup>
|
<PackageProjectUrl>https://github.com/Kableado/VAR.PdfTools</PackageProjectUrl>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release .Net 4.6.1|AnyCPU' ">
|
<PackageTags>PDF;PDF Library</PackageTags>
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\net461</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug .Net 3.5|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\net35</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release .Net 3.5|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\net35</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Content Include="..\LICENSE.txt" Link="LICENSE.txt" Pack="true" PackagePath="" />
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Maths\Matrix3x3.cs" />
|
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
|
||||||
<Compile Include="Maths\Rect.cs" />
|
|
||||||
<Compile Include="PdfContentAction.cs" />
|
|
||||||
<Compile Include="PdfDocument.cs" />
|
|
||||||
<Compile Include="PdfDocumentPage.cs" />
|
|
||||||
<Compile Include="PdfElements\IPdfElement.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfArray.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfBoolean.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfDictionary.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfElementTypes.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfElementUtils.cs" />
|
|
||||||
<Compile Include="PdfFilters.cs" />
|
|
||||||
<Compile Include="PdfFont.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfInteger.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfName.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfNull.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfObject.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfObjectReference.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfReal.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfStream.cs" />
|
|
||||||
<Compile Include="PdfElements\PdfString.cs" />
|
|
||||||
<Compile Include="PdfParser.cs" />
|
|
||||||
<Compile Include="PdfPageRenderer.cs" />
|
|
||||||
<Compile Include="PdfStandar14FontMetrics.cs" />
|
|
||||||
<Compile Include="PdfTextElement.cs" />
|
|
||||||
<Compile Include="PdfTextExtractor.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="Maths\Vector3D.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<Target Name="CopyPackage" AfterTargets="Pack">
|
||||||
<None Include="NuGet\keep.txt" />
|
<Copy SourceFiles="$(OutputPath)..\$(PackageId).$(PackageVersion).nupkg" DestinationFolder="Nuget\" />
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Build.NuGet.cmd" />
|
|
||||||
<None Include="packages.config" />
|
|
||||||
<None Include="VAR.PdfTools.nuspec" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<package >
|
|
||||||
<metadata>
|
|
||||||
<id>$id$</id>
|
|
||||||
<version>$version$</version>
|
|
||||||
<title>$title$</title>
|
|
||||||
<authors>$author$</authors>
|
|
||||||
<owners>$author$</owners>
|
|
||||||
<licenseUrl>https://github.com/Kableado/VAR.PdfTools/blob/master/LICENSE.txt</licenseUrl>
|
|
||||||
<projectUrl>https://github.com/Kableado/VAR.PdfTools</projectUrl>
|
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
|
||||||
<description>$description$</description>
|
|
||||||
<copyright>Copyright VAR 2016-2017</copyright>
|
|
||||||
<tags>PDF Library</tags>
|
|
||||||
</metadata>
|
|
||||||
<files>
|
|
||||||
<file src="bin\Release\net461\VAR.PdfTools.dll" target="lib\net461\VAR.PdfTools.dll" />
|
|
||||||
<file src="bin\Release\net461\VAR.PdfTools.pdb" target="lib\net461\VAR.PdfTools.pdb" />
|
|
||||||
<file src="bin\Release\net35\VAR.PdfTools.dll" target="lib\net35\VAR.PdfTools.dll" />
|
|
||||||
<file src="bin\Release\net35\VAR.PdfTools.pdb" target="lib\net35\VAR.PdfTools.pdb" />
|
|
||||||
</files>
|
|
||||||
</package>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="NuGet.CommandLine" version="3.4.3" targetFramework="net461" developmentDependency="true" />
|
|
||||||
</packages>
|
|
||||||
Reference in New Issue
Block a user