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:
- 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.
- Try to avoid using
<table>elementy, ale raczej użyj<div>tagi. - If you want to center images specifically avoid using the CSS declaration “margin: auto” but rather use “text-align: center”
- Don’t use Google Fonts. The built-in Czcionka DejaVu obsługuje szeroką gamę znaków, w tym alfabety grecki, cyrylicę, hebrajski i arabski.
- Try to avoid nesting elements e.g.
<div>
<div>Some content</div>
<div> - Don’t use the CSS declaration “display: block” on images as it might hide the image in some cases.
- If you don’t want an element to stretch over two pages, add the declaration “page-break-inside: avoid;”
- If you are nesting elements then apply CSS padding on the inner container and not the outer container.
- Use paths for images instead of URLs like in regular HTML.
- Add a closing </body> tylko tag, a nie zamknięcie </html> dla wielu stron PDF
- Don’t use the CSS “float” property on a tag that is nested inside another floated tag
- 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.