I have this HTTP api
http://localhost:1111/myApi/Test
and that supports JSON and xml as outout format. How can I get pdf as output?
I am using itext and the following code. It does gives me pdf back but stores in root directory of the application. How can I get the pdf open in new window and ask for Open or save dialogue. I am using Chrome Rest Client to test.
public void Generatepdf (string content)
{
Document document = new Document();
PdfWriter.GetInstance(document, new FileStream("pdfResponses.pdf", FileMode.Create));
HttpContext.Current.Response.ContentType = "application/pdf";
WebOperationContext.Current.OutgoingResponse.Headers.Add("Content-disposition", "attachment; filename=someReport.pdf");
document.Open();
document.Add(new Paragraph(content));
document.Close();
}