| ||
SharpPlot Tutorials General Tutorials Chart Samples Style Examples SharpLeaf Tutorials Document Layout Tutorials Text Flow Tutorials Table Tutorials Visual Glossaries SharpPlot Class SharpPlot Properties SharpPlot Structures SharpPlot Enumerations PageMap Class SharpLeaf Reference SharpLeaf Class SharpLeaf Properties SharpLeaf Methods Table Class Table Properties Table Methods SharpLeaf Structures FontType Structure ParagraphStyle Structure BoxStyle Structure SharpLeaf Enumerations DocumentLayout Classes DocumentLayout Class PageLayout Class PageElement Abstract Class Frame : PageElement Class TextBlock : PageElement Class ImageBlock : PageElement Class Box : PageElement Class Rule : PageElement Class Common Reference Document Class VectorMath Class DbUtil Class Download Release Notes Licensing |
SharpPlot Reference > SharpPlot Methods > RenderPdf Method SharpPlot.RenderPdf MethodReturn 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. Examplestring mypdf = sp.RenderPdf(); Return ValueThe 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(); Overloads
Embedding the PDF into a webpageIf 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 ...SharpPlot Members | SharpPlot.SavePdf Method | PdfMode Enumeration |