Skip to content

Commit 3c2ca9d

Browse files
authored
Merge pull request #23 from synercoder/add-primitives
Removed pipeline & implemented Primitives
2 parents 65dd007 + 9f72671 commit 3c2ca9d

34 files changed

+618
-899
lines changed

.editorconfig

Lines changed: 133 additions & 48 deletions
Large diffs are not rendered by default.

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

.gitignore

Lines changed: 20 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
##
44
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
55

6+
# Bundled and minified files
7+
*.min.js
8+
*.min.css
9+
610
# User-specific files
711
*.suo
812
*.user
@@ -12,6 +16,9 @@
1216
# User-specific files (MonoDevelop/Xamarin Studio)
1317
*.userprefs
1418

19+
# Licenses
20+
#[Aa]ssets/[Ll]icenses/
21+
1522
# Build results
1623
[Dd]ebug/
1724
[Dd]ebugPublic/
@@ -23,18 +30,18 @@ bld/
2330
[Bb]in/
2431
[Oo]bj/
2532
[Ll]og/
33+
[Ll]ogs/
34+
[Aa]rtifacts/
2635

27-
# Automated build script temp directory
28-
/tools/
36+
# DLL files from different repo
37+
#[Dd][Aa][Tt][Aa]_[Dd][Ll][Ll][Ss]/
2938

30-
# Visual Studio 2015/2017 cache/options directory
39+
# Visual Studio 2015 cache/options directory
3140
.vs/
41+
.vscode/
3242
# Uncomment if you have tasks that create the project's static files in wwwroot
3343
#wwwroot/
3444

35-
# Visual Studio 2017 auto generated files
36-
Generated\ Files/
37-
3845
# MSTest test Results
3946
[Tt]est[Rr]esult*/
4047
[Bb]uild[Ll]og.*
@@ -48,29 +55,19 @@ TestResult.xml
4855
[Rr]eleasePS/
4956
dlldata.c
5057

51-
# Benchmark Results
52-
BenchmarkDotNet.Artifacts/
53-
5458
# .NET Core
5559
project.lock.json
5660
project.fragment.lock.json
5761
artifacts/
58-
**/Properties/launchSettings.json
5962

60-
# StyleCop
61-
StyleCopReport.xml
62-
63-
# Files built by Visual Studio
6463
*_i.c
6564
*_p.c
6665
*_i.h
6766
*.ilk
6867
*.meta
6968
*.obj
70-
*.iobj
7169
*.pch
7270
*.pdb
73-
*.ipdb
7471
*.pgc
7572
*.pgd
7673
*.rsp
@@ -108,9 +105,6 @@ ipch/
108105
*.vspx
109106
*.sap
110107

111-
# Visual Studio Trace Files
112-
*.e2e
113-
114108
# TFS 2012 Local Workspace
115109
$tf/
116110

@@ -131,10 +125,6 @@ _TeamCity*
131125
# DotCover is a Code Coverage Tool
132126
*.dotCover
133127

134-
# AxoCover is a Code Coverage Tool
135-
.axoCover/*
136-
!.axoCover/settings.json
137-
138128
# Visual Studio code coverage results
139129
*.coverage
140130
*.coveragexml
@@ -170,7 +160,7 @@ publish/
170160
# Publish Web Output
171161
*.[Pp]ublish.xml
172162
*.azurePubxml
173-
# Note: Comment the next line if you want to checkin your web deploy settings,
163+
# TODO: Comment the next line if you want to checkin your web deploy settings
174164
# but database connection strings (with potential passwords) will be unencrypted
175165
*.pubxml
176166
*.publishproj
@@ -183,11 +173,11 @@ PublishScripts/
183173
# NuGet Packages
184174
*.nupkg
185175
# The packages folder can be ignored because of Package Restore
186-
**/[Pp]ackages/*
176+
**/packages/*
187177
# except build/, which is used as an MSBuild target.
188-
!**/[Pp]ackages/build/
178+
!**/packages/build/
189179
# Uncomment if necessary however generally it will be regenerated when needed
190-
#!**/[Pp]ackages/repositories.config
180+
#!**/packages/repositories.config
191181
# NuGet v3's project.json files produces more ignorable files
192182
*.nuget.props
193183
*.nuget.targets
@@ -205,7 +195,6 @@ AppPackages/
205195
BundleArtifacts/
206196
Package.StoreAssociation.xml
207197
_pkginfo.txt
208-
*.appx
209198

210199
# Visual Studio cache files
211200
# files ending in .cache can be ignored
@@ -224,10 +213,6 @@ ClientBin/
224213
*.publishsettings
225214
orleans.codegen.cs
226215

227-
# Including strong name files can present a security risk
228-
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
229-
#*.snk
230-
231216
# Since there are multiple workflows, uncomment next line to ignore bower_components
232217
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
233218
#bower_components/
@@ -242,8 +227,6 @@ _UpgradeReport_Files/
242227
Backup*/
243228
UpgradeLog*.XML
244229
UpgradeLog*.htm
245-
ServiceFabricBackup/
246-
*.rptproj.bak
247230

248231
# SQL Server files
249232
*.mdf
@@ -254,7 +237,6 @@ ServiceFabricBackup/
254237
*.rdl.data
255238
*.bim.layout
256239
*.bim_*.settings
257-
*.rptproj.rsuser
258240

259241
# Microsoft Fakes
260242
FakesAssemblies/
@@ -266,6 +248,9 @@ FakesAssemblies/
266248
.ntvs_analysis.dat
267249
node_modules/
268250

251+
# Typescript v1 declaration files
252+
typings/
253+
269254
# Visual Studio 6 build log
270255
*.plg
271256

@@ -305,9 +290,6 @@ __pycache__/
305290
# tools/**
306291
# !tools/packages.config
307292

308-
# Tabs Studio
309-
*.tss
310-
311293
# Telerik's JustMock configuration file
312294
*.jmconfig
313295

@@ -317,17 +299,3 @@ __pycache__/
317299
*.odx.cs
318300
*.xsd.cs
319301

320-
# OpenCover UI analysis results
321-
OpenCover/
322-
323-
# Azure Stream Analytics local run output
324-
ASALocalRun/
325-
326-
# MSBuild Binary and Structured Log
327-
*.binlog
328-
329-
# NVidia Nsight GPU debugger configuration file
330-
*.nvuser
331-
332-
# MFractors (Xamarin productivity tool) working folder
333-
.mfractor/

Directory.Build.props

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
4+
<PropertyGroup>
5+
<BaseArtifactsPath>$(MSBuildThisFileDirectory)artifacts/</BaseArtifactsPath>
6+
<BaseArtifactsPathSuffix>$(SynercodingProjectCategory)/$(MSBuildProjectName)</BaseArtifactsPathSuffix>
7+
<BaseIntermediateOutputPath>$(BaseArtifactsPath)obj/$(BaseArtifactsPathSuffix)/</BaseIntermediateOutputPath>
8+
<BaseOutputPath>$(BaseArtifactsPath)bin/$(BaseArtifactsPathSuffix)/</BaseOutputPath>
9+
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(BaseArtifactsPathSuffix)/$(Configuration)/</PackageOutputPath>
10+
</PropertyGroup>
11+
12+
<PropertyGroup>
13+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
14+
<DebugType>portable</DebugType>
15+
<DebugType Condition="'$(codecov)' != ''">full</DebugType>
16+
<Nullable>enable</Nullable>
17+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
18+
<SignAssembly>false</SignAssembly>
19+
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
20+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
21+
<Features>strict</Features>
22+
</PropertyGroup>
23+
24+
<PropertyGroup>
25+
<Authors>Gerard Gunnewijk</Authors>
26+
<Company>Synercoding</Company>
27+
<Product>Synercoding.FileFormats.Pdf</Product>
28+
<Copyright>Copyright © $(Company)</Copyright>
29+
</PropertyGroup>
30+
31+
<PropertyGroup>
32+
<VersionPrefix>0.0.1</VersionPrefix>
33+
<VersionPrefix Condition="'$(packageversion)' != ''">$(PackageVersion)</VersionPrefix>
34+
<VersionSuffix></VersionSuffix>
35+
</PropertyGroup>
36+
37+
<PropertyGroup>
38+
<NeutralLanguage>en</NeutralLanguage>
39+
<OverwriteReadOnlyFiles>true</OverwriteReadOnlyFiles>
40+
<RepositoryType>git</RepositoryType>
41+
<RestoreSources>
42+
https://api.nuget.org/v3/index.json;
43+
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
44+
</RestoreSources>
45+
<UseSharedCompilation>true</UseSharedCompilation>
46+
</PropertyGroup>
47+
48+
<PropertyGroup>
49+
<LangVersion>8.0</LangVersion>
50+
</PropertyGroup>
51+
52+
</Project>

Directory.Build.targets

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
4+
<!-- Settings that append the existing setting value -->
5+
<PropertyGroup>
6+
<DefineConstants>$(DefineConstants);$(OS)</DefineConstants>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Update="Aspose.PDF" Version="20.1.0" />
11+
<PackageReference Update="iTextSharp" Version="5.5.13.1" NoWarn="NU1701" />
12+
<PackageReference Update="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta0007" />
13+
<PackageReference Update="xunit.assert" Version="2.4.1" />
14+
</ItemGroup>
15+
16+
</Project>

README.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# FileFormats.Pdf
2-
[![Build Status](https://synercoding.visualstudio.com/Synercoding.FileFormats.Pdf/_apis/build/status/synercoder.FileFormats.Pdf?branchName=master)](https://synercoding.visualstudio.com/Synercoding.FileFormats.Pdf/_build/latest?definitionId=7&branchName=master)
3-
42
[![NuGet][nuget-badge]][nuget]
53

64
[nuget]: https://www.nuget.org/packages/Synercoding.FileFormats.Pdf/
@@ -41,25 +39,19 @@ using (var writer = new PdfWriter(fs))
4139
writer
4240
.AddPage(page =&gt;
4341
{
44-
var bleed = _mmToPts(3);
45-
// Mediabox = A4 Portrait with 3mm bleed all around
46-
page.MediaBox = new Primitives.Rectangle(0, 0, _mmToPts(216), _mmToPts(303));
47-
page.TrimBox = new Primitives.Rectangle(
48-
page.MediaBox.LLX + bleed,
49-
page.MediaBox.LLY + bleed,
50-
page.MediaBox.URX - bleed,
51-
page.MediaBox.URY - bleed
52-
);
42+
var bleed = new Spacing(3, Unit.Millimeters);
43+
page.MediaBox = Sizes.A4Portrait.Expand(bleed).AsRectangle();
44+
page.TrimBox = page.MediaBox.Contract(bleed);
5345

5446
using (var eyeStream = File.OpenRead("Pexels_com/adult-blue-blue-eyes-865711.jpg"))
5547
{
5648
var scale = 3456d / 5184;
5749

58-
var width = _mmToPts(100);
59-
var height = _mmToPts(100 * scale);
50+
var width = 100;
51+
var height = 100 * scale;
6052

61-
var offSet = _mmToPts(6);
62-
page.AddImage(eyeStream, new Primitives.Rectangle(offSet, offSet, width + offSet, height + offSet));
53+
var offSet = 6;
54+
page.AddImage(eyeStream, new Rectangle(offSet, offSet, width + offSet, height + offSet, Unit.Millimeters));
6355
}
6456
});
6557
}</code></pre>

0 commit comments

Comments
 (0)