简体   繁体   中英

watermark - background image - php

First of all i want to say hello to any of you,

Some time ago i have changed my accounting office company, but i have some problem with invoice. I want to set up watermark (as background-image) in my invoice theme, but my php skills are equal to 0.

here is the code sample:

<style>
    page {
        padding: 20 15 20 15;
        font-size: 8;
        font-family: LiberationSans;
    }

    td, th {
        padding: 0.5 1 0 1;
    }

    translation {
    <? if ($invoice['Invoice']['translation_language_id']): ?> font-size: 6;
        font-style: italic;
        display: inline;
    <? else: //?> display: none;
    <? endif ?>
    }
</style>

<? foreach ((array)$parameters['pages'] as $page): ?>
    <page>
        <header height="85">
            <? if (isset($invoice['footerCreator'])): ?>
                <div position="absolute" x="12" y="267" font-size="6" text-align="center">
                    <?= $invoice['footerCreator']; ?>
                </div>
            <? endif; ?>

            <style>
                .invoice-header {
                    position: absolute;
                    y: -10;
                    text-align: center;
                }

                /* logo */
                .invoice-logo {
                    width: 45%;
                    height: 40;
                    float: left;
                }

                /* main info - start */
                .invoice-main-info {
                    width: 48%;
                    float: right;
                }

                .invoice-main-info tr th {
                    padding: 1.5 0 1.5 0;
                }

                .invoice-main-info tr td {
                    padding: 1 0 1 1;
                }

                .invoice-main-info tr:child(0) {
                    font-size: 9;
                    text-align: center;
                    background-gradient-type: linear;
                    background-gradient-color1: white;
                    background-gradient-color2: lightgrey;
                }

                .invoice-main-info tr td div:child(0) {
                    width: 49%;
                    float: left;
                }

                .invoice-main-info tr td div:child(1) {
                    width: 49%;
                    float: right;
                }

                .invoice-main-info tr td div div:child(0) {
                    width: 57%;
                    float: left;
                }

                .invoice-main-info tr td div div:child(1) {
                    width: 42%;
                    float: right;
                }

                /* main info - stop */

                /* transaction sides - start */
                <? if ($invoice['ContractorDetailReceiver']['id']): ?>
                .invoice-transaction-side:child(0) {
                    width: 38%;
                    float: left;
                }

                .invoice-transaction-side:child(1) {
                    width: 31%;
                    float: left;
                }

                .invoice-transaction-side:child(2) {
                    width: 30%;
                    float: right;
                }

                <? else: ?>
                .invoice-transaction-side:child(0) {
                    width: 48%;
                    float: left;
                }

                .invoice-transaction-side:child(1) {
                    width: 48%;
                    float: right;
                }

                <? endif ?>
                /* transaction sides - stop */

                .invoice-bar {
                    position: absolute;
                    y: 71;
                    font-size: 10;
                    text-align: right;
                    padding: 0 1 -0.5 0;
                    margin-top: 4;
                    border-bottom: 1px;
                    background-gradient-type: linear;
                    background-gradient-color1: white;
                    background-gradient-color2: lightgrey;
                    background-gradient-coordinates: 0 0 1 0;
                }
            </style>

            <? if ($invoice['Invoice']['header']): ?>
                <p class="invoice-header"><?= $xml->sanitize($invoice['Invoice']['header']); ?></p>
            <? endif ?>

            <div class="invoice-logo">
                <? if ($parameters['logo_path']): ?>
                    <img width="80" src="<?= $parameters['logo_path'] ?>"/>
                <? endif ?>
            </div>

            <div class="invoice-main-info">
                <table>
                    <tr>
                        <th>Faktura<?= $xml->sanitize($parameters['document_name_suffix']) ?>
                            nr <?= $xml->sanitize($invoice['Invoice']['fullnumber']) ?></th>
                    </tr>
                    <tr>
                        <td>
                            <div>
                                <div>Data wystawienia:<br/>
                                    <translation><?= $translation->get('Invoice:Data wystawienia') ?></translation>
                                </div>
                                <div><?= $xml->sanitize($invoice['Invoice']['date']) ?></div>
                                <div clear="both"/>
                            </div>

                            <div>
                                <? if (!$invoice['Invoice']['disposaldate_empty']): ?>
                                    <div>Data sprzedaży:<br/>
                                        <translation><?= $translation->get('Invoice:Data sprzedaży') ?></translation>
                                    </div>
                                    <div><?= $invoice['Invoice']['disposaldate'] ?></div>
                                <? endif ?>
                                <div clear="both"/>
                            </div>

                            <div clear="both"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div>
                                <div>Termin płatności:<br/>
                                    <translation><?= $translation->get('Invoice:Termin płatności') ?></translation>
                                </div>
                                <div><?= $xml->sanitize($invoice['Invoice']['paymentdate']) ?></div>
                                <div clear="both"/>
                            </div>

                            <div>
                                <div>Metoda płatności:<br/>
                                    <translation><?= $translation->get('Invoice:Metoda płatności') ?></translation>
                                </div>
                                <div>
                                    <?= $xml->sanitize($invoice['Invoice']['paymentmethod']) ?><br/>
                                    <translation><?= $xml->sanitize($translation->get('Invoice:' . $invoice['Invoice']['paymentmethod'])) ?></translation>
                                </div>
                                <div clear="both"/>
                            </div>

                            <div clear="both"/>
                        </td>
                    </tr>
                </table>
            </div>
    </page>
    <? endif ?>

I tried to add background-image and opacity property to, i tried to change css, but all that seems to not work.

Im aware that this is a really newbie question but i gave up. Can anyone help me with that watermark?

i do not see the watermark in your code, but for your information you can create a "watermark" in css like this:

.watermark{
    opacity: 0.5; /* Firefox, Chrome, Safari, Opera, IE >= 9 (preview) */
    filter:alpha(opacity=50); /* for <= IE 8 */
}
.rotate45{
    transform: rotate(-45deg);
    -webkit-transform: rotate(-45deg);    /* Safari */
    -moz-transform: rotate(-45deg);       /* Firefox */
    -ms-transform: rotate(-45deg);        /* IE */
    -o-transform: rotate(-90deg);         /* Opera */
}

<div class="rotate45 watermark"> Watermark text </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM