Document Layout Tutorials
Text Flow Tutorials
PageElement Abstract Class
Frame : PageElement Class
TextBlock : PageElement Class
ImageBlock : PageElement Class
Box : PageElement Class
Rule : PageElement Class
Return completed chart rendered through through PDF engine.
The default is to have the document open in the user’s default mode, to embed all non-standard TrueType fonts and to compress the PDF content. You can set the PdfMode to open the outlines window, or to start with the document in full-screen view (useful for presentations).
By default, all fonts except the ‘base-14’ set will be embedded in the document automatically. If you are sure that all your potential viewers will have the fonts you have used, then set the noembed list to the names of the safe fonts, for example “Verdana,Perpetua” would be typical. This will make the document very much smaller, and the Acrobat Reader will usually be quite successful in substituting missing fonts if you are unlucky.
Compression is standard in PDF production (as well as reducing the document size it makes the material much harder to tamper with) but you may turn it off, either to assist in debugging a rendering problem or to preserve comments added with AddComment . Typically this would be to have a post-processing job catalogue the documents using tags saved in the comments.
string mypdf = sp.RenderPdf();
The result of this call is a string representation of an Adobe PDF. This may be written to file as text or returned via HTTP as type “application/pdf” to have it displayed by a web-browser.
// Create a PDF and write the chart to it ... StreamWriter sw = new StreamWriter("Chart1.pdf",false,System.Text.Encoding.ASCII); string chart = sp.RenderPdf(PdfMode.ShowOutlines); sw.Write(chart); sw.Close();
Embedding the PDF into a webpage
If you want to write the PDF content directly into a webpage, you should give it the correct content type “application/pdf”, and link to it with an appropriate <embed> tag such as:
<embed src="makepdf.aspx" height=300 width=640 type="application/pdf" >
The PdfMode parameter of RenderPDF should be set to
See also ...