Search code examples
objective-cmacoscocoasvgcgpath

How to save CGPath in svg or pdf?


Hi, i am still new at mac and objective-c.

I searched a few hours to answer my question, but i did not get anywhere.

I want to draw some simple 2D path / object and save it to a svg or pdf file.

My plan was to create a CGPath (i already know how to do that) and afterwards export it to svg or pdf file on my disk.

I would be very thankful if anyone has some kind of code snippet or tutorial, where this is explained.

Hopefully, NL.


Solution

  • You can create a CGPDFContext and draw into it using Core Graphics commands (like CGPath stuff).