make cropbox public

This commit is contained in:
Eliot Jones
2019-12-06 17:34:51 +00:00
parent e38da0a403
commit 75a6260501
4 changed files with 23 additions and 10 deletions

View File

@@ -1,20 +1,30 @@
namespace UglyToad.PdfPig.Content
{
using System;
using Geometry;
using Util.JetBrains.Annotations;
/// <summary>
/// Defines the visible region, contents expanding beyond the crop box should be clipped.
/// Defines the visible region of a page, contents expanding beyond the crop box should be clipped.
/// </summary>
internal class CropBox
public class CropBox
{
[NotNull]
/// <summary>
/// Defines the clipping of the content when the page is displayed or printed. The page's contents are to be clipped (cropped) to this rectangle
/// and then imposed on the output medium.
/// </summary>
public PdfRectangle Bounds { get; }
public CropBox(PdfRectangle? bounds)
/// <summary>
/// Create a new <see cref="CropBox"/>.
/// </summary>
public CropBox(PdfRectangle bounds)
{
Bounds = bounds ?? throw new ArgumentNullException(nameof(bounds));
Bounds = bounds;
}
/// <inheritdoc />
public override string ToString()
{
return Bounds.ToString();
}
}
}

View File

@@ -27,9 +27,12 @@
/// </summary>
public int Number { get; }
internal MediaBox MediaBox { get; }
/// <summary>
/// Defines the visible region of the page, content outside the <see cref="CropBox"/> is clipped/cropped.
/// </summary>
public CropBox CropBox { get; }
internal CropBox CropBox { get; }
internal MediaBox MediaBox { get; }
internal PageContent Content { get; }

View File

@@ -138,7 +138,6 @@
private PageContent GetContent(IReadOnlyList<byte> contentBytes, CropBox cropBox, UserSpaceUnit userSpaceUnit, PageRotationDegrees rotation, bool isLenientParsing)
{
var txt = OtherEncodings.BytesAsLatin1String(contentBytes);
var operations = pageContentParser.Parse(new ByteArrayInputBytes(contentBytes));
var context = new ContentStreamProcessor(cropBox.Bounds, resourceStore, userSpaceUnit, rotation, isLenientParsing, pdfScanner,