How to automatically add classes when importing Illustrator files or PDFs
Design Huddle can automatically add classes to imported elements when your Illustrator file or PDF includes preserved layer names. This allows you to prepare your layer structure before import and avoid manually assigning classes afterward.
This is helpful when you want imported design elements to receive consistent classes automatically.
When to use this
This workflow is useful when:
- Importing Illustrator files or PDFs with a defined layer structure
- Applying consistent classes to imported elements
- Preparing files for repeatable template or automation workflows
- Reducing manual setup after import
How it works
When layer names are preserved in the file being imported, Design Huddle can map those layer names to classes during import.
For example, if an element is placed on a specifically named layer in the source file, that layer name can be mapped to the corresponding class in Design Huddle. When the file is imported, the class is added automatically.
The important requirement is that the layer names must be preserved in the Illustrator file or generated PDF. If the layer information is available during import and the layer names are mapped, no additional class assignment is required afterward.
How to prepare your file
To use automatic class mapping:
- Open the source file in Illustrator.
- Name the relevant layers using the layer names you want to map to classes.
- Export or save the Illustrator file or PDF while preserving those layer names.
- Configure the layer name mappings so each relevant layer name corresponds to the appropriate class.
- Import the file into Design Huddle.
Once imported, elements associated with the mapped layer names will automatically receive the corresponding classes.
Alternate workflow when layer names cannot be preserved
If your PDF generation process cannot preserve standard layer names, classes can instead be added after import using the API.
In this workflow, you can retrieve the Project metadata after the file is imported, identify the relevant elements, and use the API to add the appropriate classes to those elements.
This approach requires additional implementation compared with preserving layer names, so using mapped layer names during import is the simpler option when your file-generation workflow supports it.
Best practices
For best results, use consistent and predictable layer names in your source files and preserve them throughout the PDF generation process.
This can help ensure that imported elements are mapped to the correct classes without requiring additional processing after import.