Exemple #1
0
        public ContentStreamProcessor(PdfRectangle cropBox, IResourceStore resourceStore, UserSpaceUnit userSpaceUnit, PageRotationDegrees rotation,
                                      IPdfTokenScanner pdfScanner,
                                      IPageContentParser pageContentParser,
                                      IFilterProvider filterProvider,
                                      ILog log,
                                      bool clipPaths)
        {
            this.resourceStore     = resourceStore;
            this.userSpaceUnit     = userSpaceUnit;
            this.rotation          = rotation;
            this.pdfScanner        = pdfScanner ?? throw new ArgumentNullException(nameof(pdfScanner));
            this.pageContentParser = pageContentParser ?? throw new ArgumentNullException(nameof(pageContentParser));
            this.filterProvider    = filterProvider ?? throw new ArgumentNullException(nameof(filterProvider));
            this.log       = log;
            this.clipPaths = clipPaths;

            // initiate CurrentClippingPath to cropBox
            var clippingSubpath = new PdfSubpath();

            clippingSubpath.Rectangle(cropBox.BottomLeft.X, cropBox.BottomLeft.Y, cropBox.Width, cropBox.Height);
            var clippingPath = new PdfPath()
            {
                clippingSubpath
            };

            clippingPath.SetClipping(FillingRule.NonZeroWinding);

            graphicsStack.Push(new CurrentGraphicsState()
            {
                CurrentClippingPath = clippingPath
            });
            ColorSpaceContext = new ColorSpaceContext(GetCurrentState, resourceStore);
        }
Exemple #2
0
        /// <summary>
        /// Create a clone with no Subpaths.
        /// </summary>
        internal PdfPath CloneEmpty()
        {
            PdfPath newPath = new PdfPath();

            if (IsClipping)
            {
                newPath.SetClipping(FillingRule);
            }
            else
            {
                if (IsFilled)
                {
                    newPath.SetFilled(FillingRule);
                    newPath.FillColor = FillColor;
                }

                if (IsStroked)
                {
                    newPath.SetStroked();
                    newPath.LineCapStyle    = LineCapStyle;
                    newPath.LineDashPattern = LineDashPattern;
                    newPath.LineJoinStyle   = LineJoinStyle;
                    newPath.LineWidth       = LineWidth;
                    newPath.StrokeColor     = StrokeColor;
                }
            }
            return(newPath);
        }
        public void BeginSubpath()
        {
            if (CurrentPath != null && CurrentPath.Commands.Count > 0 && !paths.Contains(CurrentPath))
            {
                paths.Add(CurrentPath);
            }

            CurrentPath = new PdfPath();
        }
Exemple #4
0
        public void BeginSubpath()
        {
            if (CurrentPath == null)
            {
                CurrentPath = new PdfPath();
            }

            AddCurrentSubpath();
            CurrentSubpath = new PdfSubpath();
        }
        public void BeginSubpath()
        {
            if (CurrentPath != null && CurrentPath.Commands.Count > 0 && !currentPathAdded)
            {
                paths.Add(CurrentPath);
            }

            CurrentPath      = new PdfPath();
            currentPathAdded = false;
        }
Exemple #6
0
 public void AddPath(PdfPath path)
 {
     top?.AddPath(path);
 }
Exemple #7
0
 public void AddPath(PdfPath path)
 {
     paths.Add(path);
 }
 public void BeginSubpath()
 {
     CurrentPath = new PdfPath(CurrentTransformationMatrix);
 }
Exemple #9
0
 public void BeginSubpath()
 {
     CurrentPath = new PdfPath();
 }