Exemple #1
0
        public string GeneratePDF(string title, string image, string text)
        {
            string outputPath = System.IO.Path.Combine(AppContext.BaseDirectory, "PDF");

            AwesomePDF.PDFGenerator generator = new AwesomePDF.PDFGenerator(outputPath);
            return(generator.GeneratePDF(title, image, text));
        }
Exemple #2
0
        public string GeneratePDF(string title, string image, string text)
        {
            string location   = typeof(MyPDFGenerator).Assembly.CodeBase;
            string httpClient = typeof(System.Net.Http.HttpClient).Assembly.CodeBase;

            var generator = new AwesomePDF.PDFGenerator("PDF");

            return(generator.GeneratePDF(title, image, text));
        }
Exemple #3
0
        public string GeneratePDF(string title, string image, string text)
        {
            string location   = typeof(MyPDFGenerator).Assembly.CodeBase;
            string httpClient = typeof(System.Net.Http.HttpClient).Assembly.CodeBase;

            System.Console.ForegroundColor = System.ConsoleColor.Red;
            System.Console.WriteLine($"MyPDFGenerator: {location}");
            System.Console.WriteLine($"System.Net.Http.HttpClient: {httpClient}");
            System.Console.ResetColor();

            var generator = new AwesomePDF.PDFGenerator("PDF");

            return(generator.GeneratePDF(title, image, text));
        }
Exemple #4
0
        public async Task <IActionResult> Report(int?id)
        {
            if (id == null)
            {
                return(View("Index"));
            }

            var place = await _context.Places
                        .FirstOrDefaultAsync(m => m.ID == id);

            if (place != null)
            {
                AwesomePDF.PDFGenerator generator = new AwesomePDF.PDFGenerator("PDF");
                var result = generator.GeneratePDF(place.Name, place.Image, place.Text);
                return(new FileContentResult(System.IO.File.ReadAllBytes(result), "application/pdf"));
            }

            return(View("Index"));
        }