How to recognize group and layer of *.ai file?

I’m trying to import *.ai file generated from Adobe Illustrator.
I want that all of the ‘e_path’ know which group and layer including them, when PDFDoc is sought from ElementReader loop.

1. Find at the begin of layer while ElementReader loop.

I figured out that ‘e_marked_content_begin’ is correspond of layer’s begin, right?
The number of e_path’s between ‘e_marked_content_begin’ and ‘e_marked_content_end’ ensure that they are in same layer?

2. Find layer_name while ElementReader loop.

In PDFLayersTest sample, there is the way to get layer_name from OCG::Config object.
But there is noway while ElementReader loop. Is there any suggestion?

3. Find group while ElementReader loop.

It seems there is no way ‘e_path’ to figure out what group is. (group in Adobe Illustrator)

Since .AI files are simply PDF files, you should be able to simply open them as with any other PDF documents. Could you kindly clarify what you’re trying to accomplish? What problem are you trying to solve?

In PDFLayersTest sample, there is the way to get layer_name from OCG::Config
object. But there is noway while ElementReader loop. Is there any
suggestion?

You can specify an OCG context when calling ElementReader.Begin (for example, https://www.pdftron.com/pdfnet/docs/PDFNet/html/M_pdftron_PDF_ElementReader_Begin_1.htm).

Please let me know whether that helps and if you have any questions.

I’m parsing *.ai file and refer to the example, ‘ElementReaderAdvTest’.

I can gather all path elements by check the element type ‘e_path’.

Furthermore, I want to parse group of *.ai file but there is no element type representing ‘group of Illustrator’.

For the code example, I want to make group of path like below.

std::vectorElement::Path groups;

How could I parse group of Illustrator?

p.s.

  • There are few misinterpretable types which are e_group_begin, e_group_end, e_marked_content_begin and e_marked_content_end.

  • e_group_begin - graphic state? I don’t know exactly, but not a group of Illustrator.

  • e_group_end - graphic state? I don’t know exactly, but not a group of Illustrator.

  • e_marked_content_begin - layer of Illustrator.

  • e_marked_content_end - layer of Illustrator.

2016년 8월 6일 토요일 오전 3시 7분 24초 UTC+9, Aaron 님의 말:

Since .AI files are simply PDF files, you should be able to simply open them as with any other PDF documents. Could you kindly clarify what you’re trying to accomplish? What problem are you trying to solve?

In PDFLayersTest sample, there is the way to get layer_name from OCG::Config
object. But there is noway while ElementReader loop. Is there any
suggestion?

You can specify an OCG context when calling ElementReader.Begin (for example, https://www.pdftron.com/pdfnet/docs/PDFNet/html/M_pdftron_PDF_ElementReader_Begin_1.htm).

Please let me know whether that helps and if you have any questions.

You are correct that “group_begin” and “group_end” refer to the graphics state stack. Illustrator encodes its groups/layers as marked content, which as you’ve noted can be consumed with ElementReader with marked_content_begin and marked_content_end. You can search this forum for more information about parsing marked content groups: https://groups.google.com/forum/#!searchin/pdfnet-sdk/marked$20content