Common Reference > Document Class > RenderPdf Method

Document.RenderPdf Method

Return document as a PDF stream.

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.

Overloads

Result

Document as PDF.

Example

  // Render un-compressed PDF, showing bookmarks
   pdf = doc.RenderPdf(PdfMode.ShowOutlines,false);

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 FullScreen here, which causes the Acrobat Reader to occupy the entire frame set up by the <embed> tag with no toolbars or scrollbars. If you render a multipage PDF here, set the flag to ShowOutlines and allow enough extra space for the outline pane and Acrobat Reader toolbars. You will probably need to experiment to get the height and width to look correct.

See also ...

SharpPlot.RenderPdf Method | SharpLeaf.RenderPdf Method | Document.Members | Document.SavePdf Method


Send comments on this topic
© Dyalog Ltd 2021