1
- using ImageSharp = SixLabors . ImageSharp ;
2
1
using SixLabors . ImageSharp . PixelFormats ;
3
2
using Synercoding . FileFormats . Pdf . Helpers ;
4
3
using Synercoding . FileFormats . Pdf . PdfInternals . Objects ;
5
4
using Synercoding . FileFormats . Pdf . PdfInternals . XRef ;
6
5
using Synercoding . FileFormats . Pdf . Primitives ;
7
6
using Synercoding . FileFormats . Pdf . Primitives . Matrices ;
8
7
using System . Collections . Generic ;
9
- using System . Collections . ObjectModel ;
10
8
using System . IO ;
9
+ using ImageSharp = SixLabors . ImageSharp ;
11
10
12
11
namespace Synercoding . FileFormats . Pdf
13
12
{
@@ -17,33 +16,34 @@ public class PdfPage
17
16
private readonly Dictionary < string , Image > _images = new Dictionary < string , Image > ( ) ;
18
17
private readonly TableBuilder _tableBuilder ;
19
18
19
+ private Rectangle _trimBox = Rectangle . Zero ;
20
+ private Rectangle _bleedBox = Rectangle . Zero ;
21
+ private Rectangle _cropBox = Rectangle . Zero ;
22
+
20
23
internal PdfPage ( TableBuilder tableBuilder )
21
24
{
22
25
_tableBuilder = tableBuilder ;
23
26
ContentStream = new ContentStream ( tableBuilder . ReserveId ( ) ) ;
24
27
}
25
28
26
- internal IReadOnlyDictionary < string , Image > Images { get { return new ReadOnlyDictionary < string , Image > ( _images ) ; } }
29
+ internal IReadOnlyDictionary < string , Image > Images => _images ;
27
30
28
31
internal ContentStream ContentStream { get ; }
29
32
30
33
public Rectangle MediaBox { get ; set ; } = Sizes . A4Portrait ;
31
34
32
- private Rectangle _cropBox = Rectangle . Zero ;
33
35
public Rectangle CropBox
34
36
{
35
37
get => _cropBox . Equals ( Rectangle . Zero ) ? MediaBox : _cropBox ;
36
38
set => _cropBox = value ;
37
39
}
38
40
39
- private Rectangle _bleedBox = Rectangle . Zero ;
40
41
public Rectangle BleedBox
41
42
{
42
43
get => _bleedBox . Equals ( Rectangle . Zero ) ? CropBox : _bleedBox ;
43
44
set => _bleedBox = value ;
44
45
}
45
46
46
- private Rectangle _trimBox = Rectangle . Zero ;
47
47
public Rectangle TrimBox
48
48
{
49
49
get => _trimBox . Equals ( Rectangle . Zero ) ? CropBox : _trimBox ;
@@ -100,7 +100,7 @@ private string _addImageToResources(ImageSharp.Image<Rgba32> image, bool clone)
100
100
var key = "Im" + System . Threading . Interlocked . Increment ( ref _pageCounter ) . ToString ( ) . PadLeft ( 6 , '0' ) ;
101
101
var id = _tableBuilder . ReserveId ( ) ;
102
102
103
- if ( clone )
103
+ if ( clone )
104
104
{
105
105
image = image . Clone ( ) ;
106
106
}
0 commit comments