mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
Changes for annotation positions:
- Pass in the initial matrix to the annotation provider, so that it can return
the correct rectangles / quad points.
- Made a change / extensions to the Annotation class:
- ModifiedDate is now a DateTimeOffset instead of unparsed string.
If the string is invalid, ModifiedDate is set to the default value.
- Added lookup for the "appearance streams"; all the annotations should have
a "N" (normal) appearance, and optionally have a "R" (roll-over/hover)
and "D" (down/click) appearance. Did not expose the actual stream objects,
but added a flag indicating the existence of "R" / "D". At some point
we can consider doing something with the appearances.
- Changed signature of GetInitialMatrix / ContentStreamProcessor constructor
from PdfRectangle back to what it was earlier, namely MediaBox and CropBox,
to prevent accidentally mixing the two up in the caller.
This commit is contained in:
@@ -87,8 +87,8 @@
|
||||
|
||||
public ContentStreamProcessor(IResourceStore resourceStore,
|
||||
UserSpaceUnit userSpaceUnit,
|
||||
PdfRectangle mediaBox,
|
||||
PdfRectangle cropBox,
|
||||
MediaBox mediaBox,
|
||||
CropBox cropBox,
|
||||
PageRotationDegrees rotation,
|
||||
IPdfTokenScanner pdfScanner,
|
||||
IPageContentParser pageContentParser,
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
// initiate CurrentClippingPath to cropBox
|
||||
var clippingSubpath = new PdfSubpath();
|
||||
clippingSubpath.Rectangle(cropBox.BottomLeft.X, cropBox.BottomLeft.Y, cropBox.Width, cropBox.Height);
|
||||
clippingSubpath.Rectangle(cropBox.Bounds.BottomLeft.X, cropBox.Bounds.BottomLeft.Y, cropBox.Bounds.Width, cropBox.Bounds.Height);
|
||||
var clippingPath = new PdfPath() { clippingSubpath };
|
||||
clippingPath.SetClipping(FillingRule.EvenOdd);
|
||||
|
||||
@@ -120,13 +120,13 @@
|
||||
|
||||
[System.Diagnostics.Contracts.Pure]
|
||||
internal static TransformationMatrix GetInitialMatrix(UserSpaceUnit userSpaceUnit,
|
||||
PdfRectangle mediaBox,
|
||||
PdfRectangle cropBox,
|
||||
MediaBox mediaBox,
|
||||
CropBox cropBox,
|
||||
PageRotationDegrees rotation)
|
||||
{
|
||||
// Cater for scenario where the cropbox is larger than the mediabox.
|
||||
// If there is no intersection (method returns null), fall back to the cropbox.
|
||||
var viewBox = mediaBox.Intersect(cropBox) ?? cropBox;
|
||||
var viewBox = mediaBox.Bounds.Intersect(cropBox.Bounds) ?? cropBox.Bounds;
|
||||
|
||||
if (rotation.Value == 0
|
||||
&& viewBox.Left == 0
|
||||
|
||||
Reference in New Issue
Block a user