Jak zmodyfikować istniejący szablon FooEvents Ticket Theme lub utworzyć własny szablon PDF lub HTML Ticket Theme?

Ten artykuł przeprowadzi Cię przez proces tworzenia własnej aplikacji. FooEvents Ticket Theme które zalecamy przeczytać przed kontynuowaniem:
Bądź kreatywny dzięki motywom biletów FooEvents - część 1
Bądź kreatywny dzięki motywom biletów FooEvents - część 2

Ważne jest, aby pamiętać, że sposób generowania biletów PDF różni się nieco od zwykłego HTML i CSS. Istnieją pewne style i elementy, które mogą działać dobrze podczas renderowania wiadomości e-mail lub pliku HTML, ale te style mogą nie być kompatybilne z biblioteką używaną do generowania plików PDF.

Oto kilka ważnych rzeczy, o których należy pamiętać podczas tworzenia lub modyfikowania plików PDF Ticket Theme:

  1. You can use either JPG lub PNG obrazy. Jeśli obrazy PNG z przezroczystością nie są renderowane zgodnie z przeznaczeniem, należy włączyć rozszerzenie "imagick" w PHP. Jeśli nie masz pewności, jak to zrobić, Twój host może być w stanie pomóc.
  2. Try to avoid using <table> elementy, ale raczej użyj <div> tagi.
  3. If you want to center images specifically avoid using the CSS declaration “margin: auto” but rather use “text-align: center”
  4. Don’t use Google Fonts. The built-in Czcionka DejaVu obsługuje szeroką gamę znaków, w tym alfabety grecki, cyrylicę, hebrajski i arabski.
  5. Try to avoid nesting elements e.g.
    <div>
    <div>Some content</div>
    <div>
  6. Don’t use the CSS declaration “display: block” on images as it might hide the image in some cases.
  7. If you don’t want an element to stretch over two pages, add the declaration “page-break-inside: avoid;”
  8. If you are nesting elements then apply CSS padding on the inner container and not the outer container.
  9. Use paths for images instead of URLs like in regular HTML.
  10. Add a closing </body> tylko tag, a nie zamknięcie </html> dla wielu stron PDF
  11. Don’t use the CSS “float” property on a tag that is nested inside another floated tag
  12. If a customer is buying more than one ticket for the same event then most PDF ticket themes will display the header and event information followed by 3 tickets, per page. If the PDF ticket looks broken then it might be because all this information does not fit on one page. To fix this you can use a log and/or header image that are not as high, remove padding, margins or text or set it so that only 1 or 2 tickets are shown on one page.

Potrzebujesz pomocy?

Nie możesz znaleźć potrzebnej odpowiedzi? Nasz zespół jest tutaj, aby Ci pomóc, skontaktuj się!