Frage

I'm generating a PDF from a view using -dataWithPDFInsideRect:.

Within the view is a CPTXYGraph which displays wonderfully in a Window but doesn't show up in the PDF at all.

I also tried putting an NSImageView into my view, then generating an NSImage from my core plot chart and putting that NSImage into the NSImageView.. but the NSImage is just empty white.

How can I either:

a) Include a Core Plot chart in my View such that it will be shown in the PDF generated by -dataWithPDFInsideRect:, or..

b) generate a proper NSImage from my Core Plot chart so that I can put it into the NSImageView whic will then show up in the PDF.

War es hilfreich?

Lösung

If the graph is the only thing displayed in your view, get the PDF data from it directly using the -dataForPDFRepresentationOfLayer method. This will give you a PDF that preserves text and lines as objects so that it will scale smoothly. Otherwise, use the -imageOfLayer method to retrieve an NSImage of the graph layer.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top