Esempio n. 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);
        }
Esempio n. 2
0
 public ContentStreamProcessor(PdfRectangle cropBox, IResourceStore resourceStore, UserSpaceUnit userSpaceUnit, PageRotationDegrees rotation, bool isLenientParsing,
                               IPdfTokenScanner pdfScanner,
                               XObjectFactory xObjectFactory,
                               ILog log)
 {
     this.resourceStore    = resourceStore;
     this.userSpaceUnit    = userSpaceUnit;
     this.rotation         = rotation;
     this.isLenientParsing = isLenientParsing;
     this.pdfScanner       = pdfScanner;
     this.xObjectFactory   = xObjectFactory;
     this.log = log;
     graphicsStack.Push(new CurrentGraphicsState());
     ColorSpaceContext = new ColorSpaceContext(GetCurrentState);
 }
Esempio n. 3
0
 public ContentStreamProcessor(PdfRectangle cropBox, IResourceStore resourceStore, UserSpaceUnit userSpaceUnit, PageRotationDegrees rotation,
                               IPdfTokenScanner pdfScanner,
                               IPageContentParser pageContentParser,
                               IFilterProvider filterProvider,
                               ILog log)
 {
     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;
     graphicsStack.Push(new CurrentGraphicsState());
     ColorSpaceContext = new ColorSpaceContext(GetCurrentState, resourceStore);
 }