Ejemplo n.º 1
0
        public void DoTask()
        {
            var api = new LovePdfApi("PUBLIC_KEY", "SECRET_KEY");

            //create watermark task
            var task = api.CreateTask <WaterMarkTask>();

            //file variable contains server file name
            var file = task.AddFile("path/to/file/document.pdf");


            //parameters that will be posted
            var parameters = new WaterMarkParams(
                new WatermarkModeText("watermark text"))
            {
                Pages                        = "1-5,7",
                VerticalPosition             = WaterMarkVerticalPositions.Top,
                HorizontalPosition           = WaterMarkHorizontalPositions.Right,
                VerticalPositionAdjustment   = 100,
                HorizontalPositionAdjustment = 100,
                FontFamily                   = "Arial",
                FontStyle                    = FontStyles.Italic,
                FontSize                     = 12,
                FontColor                    = "#ff0000",
                Transparency                 = 50,
                Layer                        = Layer.Below,
                OutputFileName               = "watermarked"
            };

            //proces added files
            //time var will contains information about time spent in process
            var time = task.Process(parameters);

            task.DownloadFile("path");
        }
Ejemplo n.º 2
0
 public WaterMarkTests()
 {
     TaskParams = new WaterMarkParams(new WatermarkModeText(Settings.WaterMarkText))
     {
         OutputFileName = @"result.pdf"
     };
 }
Ejemplo n.º 3
0
        public ExecuteTaskResponse Process(WaterMarkParams parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentException("Parameters should not be null", nameof(parameters));
            }

            return(base.Process(parameters));
        }