using DinkToPdf.Contracts;
using Microsoft.AspNetCore.Mvc;
using System.IO;
+using System;
using PdfService.Utility;
using PdfService.Models;
namespace PdfService.Controllers
GlobalSettings = globalSettings,
Objects = { objectSettings }
};
-
+
var file = _converter.Convert(pdf);
- return File(file, "application/pdf");
+ if(Request.Headers["Accept"] == "application/base64")
+ return Content(Convert.ToBase64String(file));
+ else
+ return File(file, "application/pdf");
}
}
- return: pdf file
`POST`: `/generatePDF/` Generates a pdf report for the given terms
-- param: Term[] as Content-Type: `application/json`
-e.g. body of request
+- Header: `Content-Type`: `application/json`
+(optional) `Accept`: `application/base64` if the pdf should be in base64 instead of `application/pdf`
+- Body of request: Term[] e.g.
```json
[
{
```
- return: pdf file
-### Tweet model
+### Term model
Term(string `Name`, double `Sentiment`)
## run with docker