3

I have samples to create PDF, however for the server side creation of PDF there is no documentation about SharpPDF. I think it is about stream concept, which I have no information about it.

pdfDocument myDoc = new pdfDocument("TUTORIAL", "ME");
pdfPage myPage = myDoc.addPage();

myPage.addText("Hello World!", 200, 450, sharpPDF.Enumerators.predefinedFont.csHelvetica, 12);
myDoc.createPDF(@"c:\test.pdf");
myDoc.
myPage = null;
myDoc = null; 
efirat
  • 3,679
  • 2
  • 39
  • 43

1 Answers1

5

There is an overload for createPDF that takes a Stream. You can use this to create the PDF in memory on the server and then stream it back to the client.

Here is an example (tried with ShartPDF version 1.3.1):

PdfDocument myDoc = new pdfDocument("TUTORIAL", "ME");
pdfPage myPage = myDoc.addPage();
myPage.addText("Hello World!", 200, 450, predefinedFont.csHelvetica, 12);

Response.ContentType = "application/pdf";
myDoc.createPDF(Response.OutputStream);
Response.Flush();
Filip Ekberg
  • 36,033
  • 20
  • 126
  • 183