  We propose the use of two-dimensional photonic crystals with engineered
defects for the generation of an arbitrary-profile beam from a focused input
beam. The cylindrical harmonics expansion of complex-source beams is derived
and used to compute the scattered wavefunction of a 2D photonic crystal via the
multiple scattering method. The beam shaping problem is then solved using a
genetic algorithm. We illustrate our procedure by generating different orders
of Hermite-Gauss profiles, while maintaining reasonable losses and tolerance to
variations in the input beam and the slab refractive index.
