« Convert office docume… | Home | Moved to macOS Catali… »

ChartDirector PDF Output

Did you know our MBS Xojo ChartDirector Plugin can be used to output charts as PDF files?

Two ways are possible:

Vector Mode

If all parts of the chart can be drawn in a PDF with the PDF support by ChartDirector, you get a vector graphics with lines, rectangles and paths. Text is drawn in PDF, so it can be selected later and copied.

Bitmap Mode

If some features are used, which are not supported for PDF output, you get a picture rendered and this picture is placed inside the PDF wrapper. Not perfect, but it preserves some 3D graphic effects, which can't be drawn natively in the PDF. If you set bitmap flag in the output options, you can enforce the bitmap mode.

Enable PDF

To enable PDF output, please call MakeChart() function and pass the kPDF constant. If you are interested in SVG output, please pass kSVG or kSVGZ constants. The second one is for compressed output.

If you pass an optional FolderItem parameter to MakeChart, you write an image file directly to that location. The file extension on the file name in the FolderItem defines the type, so please use png, jpg, jpeg, gif, wbmp, wmp, pdf, svg or bmp.

For a draw area, you can just ask it for PDF output using the outPDF() function. Either pass a FolderItem to create a PDF file or pass no parameter to get the PDF as text back. To get a draw area, you can for example call MakeChart without parameters.

Options

You can configure the PDF output with various options and the setOutputOptions method. You pass options with key=value separated by semicolons. e.g. you can use "pagewidth=595;pageheight=842" to use A4 paper size.


PDF OptionTypeDescription
bitmapFlag Render the chart as a bitmap and output the bitmap as PDF.
widthAttribute The width of the chart in the PDF in pixel unit.

By default, ChartDirector will use the pixel width of the chart as the width of the chart in PDF. The "width" attribute can be used to specify an alternative value. The value must be a number.
heightAttribute The width of the chart in the PDF in pixel unit.

See the description on "width" above for how to use it.
pagewidthAttribute The page width in pixel unit.

By default, ChartDirector will set the page width to the same width as the chart. The "pagewidth" attribute can be used to specify an alternative value. The value must be a number.
pageheightAttribute The page height in pixel unit.

By default, ChartDirector will set the page height to the same height as the chart. The "pageheight" attribute can be used to specify an alternative value. The value must be a number.
leftxAttribute The x coordinate of the left side of the chart within the page in pixel unit.

By default, ChartDirector will center the chart in the page. The "leftx" attribute can be used to specify an alternative horizontal position. The coordinate must be a number.
topyAttribute The y coordinate of the top side of the chart within the page in pixel unit.

By default, ChartDirector will center the chart in the page. The "topy" attribute can be used to specify an alternative vertical position. The coordinate must be a number.
dpiAttribute Specify the factor for conversion from pixel to physical unit.

The PDF viewer will convert the pixel unit into physical unit (eg. inches) so that it can be layout on paper or other physical media. The default conversion factor for the chart is 96 pixels per inch. The "dpi" attribute can be used to specify an alternative value. The value must be a number.

The test PDF on the right shown as picture is available here: finance.pdf

Please do not hesitate to contact us with questions.

The biggest plugin in space...
19 06 20 - 14:55