예제 #1
0
        public static void AddMargins(string packagedFile, Package package, Config config)
        {
            PdfFileEditor fileEditor = new PdfFileEditor();
            var           pageMargin = PageSetting.GetBodyMargin(package, config);

            fileEditor.AddMargins(packagedFile, packagedFile, null, pageMargin.LeftPoints, pageMargin.RightPoints, pageMargin.TopPoints, pageMargin.BottomPoints);
        }
        private static void AddLineSeparator(Page page, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, Config config, Package package)
        {
            if (package.LineSeparator.ImageStream == null)
            {
                return;
            }

            // for drawing line separator between headerfooter and body, we need to add header/footer offsets to page margins
            var bodyMargin = PageSetting.GetBodyMargin(package, config);

            ImageStamp imageStamp = new ImageStamp(package.LineSeparator.ImageStream)
            {
                TopMargin           = bodyMargin.TopPoints,
                BottomMargin        = bodyMargin.BottomPoints,
                LeftMargin          = bodyMargin.LeftPoints,
                RightMargin         = bodyMargin.RightPoints,
                HorizontalAlignment = horizontalAlignment,
                VerticalAlignment   = verticalAlignment,
                Width  = page.PageInfo.Width - bodyMargin.LeftPoints - bodyMargin.RightPoints,
                Height = 1
            };

            page.AddStamp(imageStamp);
        }