Skip to content

Commit 62eeca8

Browse files
authored
Merge pull request ststeiger#265 from pamapa/update-readme
update README.md
2 parents 03343c2 + 5f2490d commit 62eeca8

File tree

1 file changed

+20
-63
lines changed

1 file changed

+20
-63
lines changed

README.md

Lines changed: 20 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,47 @@
11
# PdfSharpCore
22

3+
[![NuGet Version](https://img.shields.io/nuget/v/PdfSharpCore.svg)](https://www.nuget.org/packages/PdfSharpCore/)
4+
[![CI](https://github.com/ststeiger/PdfSharpCore/actions/workflows/build.yml/badge.svg)](https://github.com/ststeiger/PdfSharpCore/actions/workflows/build.yml)
35
[![codecov.io](https://codecov.io/github/ststeiger/PdfSharpCore/coverage.svg?branch=master)](https://codecov.io/github/ststeiger/PdfSharpCore?branch=master)
46

5-
**PdfSharpCore** is a partial port of [PdfSharp.Xamarin](https://github.com/roceh/PdfSharp.Xamarin/) for .NET Standard
7+
**PdfSharpCore** is a partial port of [PdfSharp.Xamarin](https://github.com/roceh/PdfSharp.Xamarin/) for .NET Standard.
68
Additionally MigraDoc has been ported as well (from version 1.32).
7-
Images have been implemented with [ImageSharp](https://github.com/JimBobSquarePants/ImageSharp/), which is still in Alpha. They State on their readme that it is still in Alpha status and shouldn't be used in productive environments. Since I didn't find any good alternatives it's still used.
9+
Image support has been implemented with [SixLabors.ImageSharp](https://github.com/JimBobSquarePants/ImageSharp/) and Fonts support with [SixLabors.Fonts](https://github.com/SixLabors/Fonts).
810

9-
ImageSharp being Alpha isn't a big issue either since this code isn't by far done yet. So please chime in ;)
1011

11-
###### Example project
12+
## Table of Contents
1213

13-
There was an example project here. <br />
14-
I've removed it from this project, and put it into a separate solution.
15-
You can find it [here](https://github.com/ststeiger/Stammbaum).<br />
16-
There's a default font-resolver in [FontResolver.cs](https://github.com/ststeiger/PdfSharpCore/blob/master/PdfSharpCore/Utils/FontResolver.cs).<br />
17-
It should work on Windows, Linux, OSX and Azure. <br />
18-
Some limitations apply. <br />
19-
See open issues.
14+
- [Documentation](docs/index.md)
15+
- [Example](#example)
16+
- [Contributing](#contributing)
17+
- [License](#license)
2018

21-
## Example usage
19+
20+
## Example
2221

2322
```cs
24-
//See the "Example" Project for a MigraDoc example
2523
static void Main(string[] args)
2624
{
27-
GlobalFontSettings.FontResolver = new FontResolver();
28-
2925
var document = new PdfDocument();
3026
var page = document.AddPage();
3127
var gfx = XGraphics.FromPdfPage(page);
3228
var font = new XFont("OpenSans", 20, XFontStyle.Bold);
3329

34-
gfx.DrawString("Hello World!", font, XBrushes.Black, new XRect(20, 20, page.Width, page.Height), XStringFormats.Center);
30+
gfx.DrawString(
31+
"Hello World!", font, XBrushes.Black,
32+
new XRect(20, 20, page.Width, page.Height),
33+
XStringFormats.Center);
3534

3635
document.Save("test.pdf");
3736
}
38-
39-
// This implementation is obviously not very good --> Though it should be enough for everyone to implement their own.
40-
public class FontResolver : IFontResolver
41-
{
42-
public byte[] GetFont(string faceName)
43-
{
44-
using(var ms = new MemoryStream())
45-
{
46-
using(var fs = File.Open(faceName, FileMode.Open))
47-
{
48-
fs.CopyTo(ms);
49-
ms.Position = 0;
50-
return ms.ToArray();
51-
}
52-
}
53-
}
54-
public FontResolverInfo ResolveTypeface(string familyName, bool isBold, bool isItalic)
55-
{
56-
if (familyName.Equals("OpenSans", StringComparison.CurrentCultureIgnoreCase))
57-
{
58-
if (isBold && isItalic)
59-
{
60-
return new FontResolverInfo("OpenSans-BoldItalic.ttf");
61-
}
62-
else if (isBold)
63-
{
64-
return new FontResolverInfo("OpenSans-Bold.ttf");
65-
}
66-
else if (isItalic)
67-
{
68-
return new FontResolverInfo("OpenSans-Italic.ttf");
69-
}
70-
else
71-
{
72-
return new FontResolverInfo("OpenSans-Regular.ttf");
73-
}
74-
}
75-
return null;
76-
}
77-
}
78-
}
7937
```
8038

81-
## License
8239

83-
Copyright (c) 2005-2007 empira Software GmbH, Cologne (Germany)
84-
Modified work Copyright (c) 2016 David Dunscombe
40+
## Contributing
41+
42+
We appreciate feedback and contribution to this repo!
8543

86-
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:
8744

88-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
45+
## License
8946

90-
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.
47+
This software is released under the MIT License. See the [LICENSE](LICENCE.md) file for more info.

0 commit comments

Comments
 (0)