DynamicComponentExtensions.cs 616 B

12345678910111213141516171819
  1. using QuestPDF.Elements;
  2. using QuestPDF.Infrastructure;
  3. namespace QuestPDF.Fluent
  4. {
  5. public static class DynamicComponentExtensions
  6. {
  7. public static void Dynamic<TState>(this IContainer element, IDynamicComponent<TState> dynamicElement) where TState : struct
  8. {
  9. var componentProxy = DynamicComponentProxy.CreateFrom(dynamicElement);
  10. element.Element(new DynamicHost(componentProxy));
  11. }
  12. public static void Element(this IContainer element, IDynamicElement child)
  13. {
  14. ElementExtensions.Element(element, child);
  15. }
  16. }
  17. }