itext将html转pdf

pom文件

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
    <groupId>org.thymeleaf.extras</groupId>
    <artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
<dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>html2pdf</artifactId>
</dependency>

工具类 pdf类

CommonUtils

字体方法

public static FontProvider getFontProvider(){
    FontProvider fontProvider = new FontProvider();
    fontProvider.addFont(fontProvider.getClass().getClassLoader().getResource("font/simsun.ttf").getPath());
    fontProvider.addFont(fontProvider.getClass().getClassLoader().getResource("font/simhei.ttf").getPath());
    fontProvider.addStandardPdfFonts();
    return fontProvider;
}

设置编码为utf-8

public static ConverterProperties getConverterProperties(FontProvider fontProvider){
    ConverterProperties converterProperties = new ConverterProperties();
    converterProperties.setFontProvider(fontProvider);
    converterProperties.setCharset("utf-8");
    return converterProperties;
}

pdf方法

public static List<Attachment> generate2PDF(List<Dictionary> dictionaries,Object object,TemplateEngine templateEngine) throws IOException {
        List<Attachment> attachmentList = new ArrayList<>();
        //插入Order 中英PDF文件 Attachment
        Attachment attachmentZh = new Attachment();
        Attachment attachmentEn = new Attachment();

        //中英字典数据
        Map<String,String> dictionaryMapZh = new HashMap<>();
        Map<String,String> dictionaryMapEn = new HashMap<>();

        dictionaries.stream().forEach(dictionary -> {
            dictionary.getDictionaryItems().stream().forEach(dictionaryItem -> {
                dictionaryMapZh.put(dictionaryItem.getItemCode(),dictionaryItem.getItemValue());
                dictionaryMapEn.put(dictionaryItem.getItemCode(),dictionaryItem.getItemValueEn());
            });
        });
        //生成中英发票PDF
        if(object instanceof Invoice && object != null){
            Invoice invoice = (Invoice) object;

            FontProvider fontProvider = getFontProvider();


            ConverterProperties converterProperties = new ConverterProperties();
            converterProperties.setFontProvider(fontProvider);
            converterProperties.setCharset("utf-8");

            Context ctx = new Context();
            ctx.setVariable("invoice", invoice);
            ctx.setVariable("timeStr",CommonUtils.getCurrentTimeFormat());
            ctx.setVariable("timeEnStr",CommonUtils.getCurrentTimeEnFormat());
//            ctx.setVariable("orderConfirmDateStr",CommonUtils.getDateFormat(order.getConfirmDate()));
            ctx.setVariable("dictionaryZh",dictionaryMapZh);
            ctx.setVariable("dictionaryEn",dictionaryMapEn);

            File invoiceFileEn = new File(dictionaryMapEn.get("uploadPath") + invoice.getPdfIdEn() + ".pdf");
            Document documentEn = new Document(new PdfDocument(new PdfWriter(new FileOutputStream(invoiceFileEn))), PageSize.A4);
            documentEn.setMargins(10, 20, 10, 20);
            HtmlConverter.convertToElements(templateEngine.process("invoicePDF/en", ctx), converterProperties)
                    .stream().forEach(iElement -> documentEn.add((IBlockElement) iElement));

            documentEn.close();

            attachmentEn.setId(invoice.getPdfIdEn());
            attachmentEn.setFileName("invoice_"+invoice.getInvoiceNo()+".pdf");
            attachmentEn.setSize(invoiceFileEn.length());
            attachmentEn.setPath(invoice.getInvoiceNo()+"_invoiceEn.pdf");
            attachmentEn.setSuffix("pdf");

            //中文Invoice
            File invoiceFileZh = new File(dictionaryMapZh.get("uploadPath") + invoice.getPdfId() + ".pdf");
            Document documentZh = new Document(new PdfDocument(new PdfWriter(new FileOutputStream(invoiceFileZh))), PageSize.A4);
            documentZh.setMargins(10, 20, 10, 20);
            HtmlConverter.convertToElements(templateEngine.process("invoicePDF/zh", ctx), converterProperties)
                    .stream().forEach(iElement -> documentZh.add((IBlockElement) iElement));

            documentZh.close();

            attachmentZh.setId(invoice.getPdfId());
            attachmentZh.setFileName("发票_"+invoice.getInvoiceNo()+".pdf");
            attachmentZh.setSize(invoiceFileZh.length());
            attachmentZh.setPath(invoice.getInvoiceNo()+"_invoiceZh.pdf");
            attachmentZh.setSuffix("pdf");

        }
       
        attachmentList.add(attachmentZh);
        attachmentList.add(attachmentEn);
        return attachmentList;
    }

}

业务逻辑调用pdf方法

@Override
    @Transactional(rollbackFor = Exception.class)
    public void add(Delivery delivery) throws IOException {
        delivery.setId(CommonUtils.uuid());

        delivery.setDeliveryNo(CommonUtils.deliveryNo());
        deliveryMapper.insert(delivery);
        delivery.getOrder().setLastShipmentDate(new Date());
        orderMapper.update(delivery.getOrder());
        Optional.ofNullable(delivery.getDeliveryItems()).orElse(new ArrayList<>()).forEach(deliveryItem -> {
            deliveryItem.setId(CommonUtils.uuid());
            deliveryItem.setDelivery(delivery);
        });
        deliveryItemMapper.batchInsertDeliveryItem(delivery.getDeliveryItems());
        deliveryMapper.UpdatePoAndInStock(delivery);

        Invoice invoice = new Invoice();
        invoice.setId(CommonUtils.uuid());
        invoice.setOrder(delivery.getOrder());
        invoice.setInvoiceNo("I" + String.valueOf(new Date().getTime()));
        invoice.setPdfId(invoice.getInvoiceNo() + "invoiceZh");
        invoice.setPdfIdEn(invoice.getInvoiceNo() + "invoiceEn");
        invoice.setDelivery(delivery);
        BigDecimal total = deliveryMapper.selectCountAndPrice(delivery);
        invoice.setTotal(total);
        invoice.setAmountDue(total);



/******************生成INVOICE pdf****************************/


        //字典
        List<Dictionary> dictionaries = dictionaryMapper.findByNames(new String[]{"addrType", "orderType", "unit", "paymentMethod", "deliveryMethod", "exchangeRate", "country"});

        //把path存入字典
        DictionaryItem dictionaryItem = new DictionaryItem();
        dictionaryItem.setItemCode("uploadPath");
        dictionaryItem.setItemValue(uploadPath);
        dictionaryItem.setItemValueEn(uploadPath);
        dictionaries.get(0).getDictionaryItems().add(dictionaryItem);

        Order order = orderMapper.genOrderReportPDF(delivery.getOrder().getId());

        List<CompanyAddress> companyAddresses = companyAddressMapper.selectCompanyAdressById(order.getCompany().getId());


        if ("INV".equals(companyAddresses.get(0).getAddrType())) {
            Collections.swap(companyAddresses, 0, 1);
        }
        order.setCompanyAddressList(companyAddresses);
        invoice.setOrder(order);

        Map<String, OrderItem> map = new HashMap<>();

        List<OrderItem> orderItemsByOrderId = orderItemMapper.getOrderItemsByOrderId(order.getId());

        orderItemsByOrderId.stream().forEach(orderItem -> {
            map.put(orderItem.getId(), orderItem);
        });

        //组装数据
        delivery.getDeliveryItems().stream().forEach(deliveryItem -> {
            InvoicePdfTableInfo invoicePdfTableInfo = new InvoicePdfTableInfo();
            OrderItem orderItem = map.get(deliveryItem.getOrderItem().getId());
            Product product = orderItem.getProduct();
            invoicePdfTableInfo.setProductNo(product.getProductNo());
            invoicePdfTableInfo.setProductName(product.getProductName());
            invoicePdfTableInfo.setProductNameEn(product.getProductNameEn());
            invoicePdfTableInfo.setDescription(product.getDescription());
            invoicePdfTableInfo.setDescriptionEn(product.getDescriptionEn());
            invoicePdfTableInfo.setQuantity(deliveryItem.getCount());
            invoicePdfTableInfo.setQuantityUnit(product.getUnit());
            invoicePdfTableInfo.setPrice(orderItem.getPrice());
            invoicePdfTableInfo.setTotal(orderItem.getPrice().multiply(new BigDecimal(deliveryItem.getCount())));
            invoicePdfTableInfo.setDeliveryTime(CommonUtils.getTimeFormat(delivery.getDeliveryDate()));//YYYYMMdd



            invoice.getInvoicePdfTableInfoList().add(invoicePdfTableInfo);
        });

        Date date = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(Calendar.MONTH,1);
        Date dateAddMonth = calendar.getTime();

        invoice.setInvoiceDate(date);
        invoice.setDuDate(dateAddMonth);

        List<Attachment> attachmentList = CommonUtils.generate2PDF(dictionaries, invoice, templateEngine);

        attachmentList.stream().forEach( attachment->{
            attachment.setPath(uploadPath+attachment.getPath());
        });
        //先插入文件表
        attachmentMapper.batchInsertAttachment(attachmentList);
        //后插入invoice表
        invoiceMapper.insert(invoice);

    }

发票英文.html

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<style>
    body {
        font-family: SimSun;
        font-size: 14px;
        border: 0px solid red;
        margin-bottom: 50px;
        height: auto;
    }
    ul {
        list-style-type:none;
        margin: 0px;
        padding: 0px;
    }
    .left {
        float: left;
        width: 45%;
    }
    .right {
        float: right;
        width: 45%;
    }
    .font-size-large {
        font-size: 22px;
    }
    .clear {
        clear: both;
    }
    .label {
        font-family: SimHei;
        font-weight: bold;
        font-size: 12px;
    }
    .data-address {
        margin: 5px auto;
        width:90%;
        border: 0px solid red;
    }
    .data-row {
        width:90%;
        border: 0px solid red;
        margin: 1px auto;
    }
    .data-row ul li {
        float: left;
    }
    .data-row .label {
        width: 180px;
    }
</style>
<body>
<div style=" border:0px solid red">
    <div style="border:0px solid black;margin-bottom: 50px">
        <div class="left font-size-large">LOGO</div>
        <div class="right">
            <span style="margin-right: 20px;" class="font-size-large">INVOICE</span>
            [[ ${invoice.invoiceNo} ]]
        </div>
        <div class="clear"></div>
    </div>

    <div class="data-address" style="margin-top: 100px">
        <div class="left">
            <div class="label" style="line-height: 20px;border-bottom: 2px solid black;font-size: 14px;margin-bottom: 5px">[[ ${dictionaryEn[invoice.order.companyAddressList[0].addrType]} ]]</div>
            <div style="font-size: 12px;height: 20px"><span class="label">Name:</span> [[ ${invoice.order.companyAddressList[0].addrName} ]]</div>
            <div style="font-size: 12px;height: 20px"><span class="label">Address:</span> [[ ${invoice.order.companyAddressList[0].partOne} ]]</div>
            <div style="font-size: 12px;height: 20px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [[ ${invoice.order.companyAddressList[0].partTwo} ]]</div>
            <div style="font-size: 12px;height: 20px"><span class="label">City:</span> [[ ${invoice.order.companyAddressList[0].postalCodeCity} ]]</div>
            <div style="font-size: 12px;height: 20px"><span class="label">Country:</span> [[ ${dictionaryEn[invoice.order.companyAddressList[0].country]} ]]</div>
            <div style="font-size: 12px;height: 20px"><span class="label">VAT-nr:</span> [[ ${invoice.order.companyAddressList[0].vatNr} ]]</div>
        </div>
        <div class="right">
            <div class="label" style="line-height: 20px;border-bottom: 2px solid black;font-size: 14px;margin-bottom: 5px">[[ ${dictionaryEn[invoice.order.companyAddressList.get(1).addrType]} ]]</div>
            <div style="font-size: 12px;height: 20px"><span class="label">Name:</span> [[ ${invoice.order.companyAddressList[1].addrName} ]]</div>
            <div style="font-size: 12px;height: 20px"><span class="label">Address:</span> [[ ${invoice.order.companyAddressList[1].partOne} ]]</div>
            <div style="font-size: 12px;height: 20px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [[ ${invoice.order.companyAddressList[1].partTwo} ]]</div>
            <div style="font-size: 12px;height: 20px"><span class="label">City:</span> [[ ${invoice.order.companyAddressList[1].postalCodeCity} ]]</div>
            <div style="font-size: 12px;height: 20px"><span class="label">Country:</span> [[ ${dictionaryEn[invoice.order.companyAddressList[1].country]} ]]</div>
            <div style="font-size: 12px;height: 20px"><span class="label">VAT-nr:</span> [[ ${invoice.order.companyAddressList[1].vatNr} ]]</div>
        </div>
        <div class="clear"></div>
    </div>

    <div class="data-row" >
        <ul class="left">
            <li class="label">Terms of payment</li>
            <li style="font-size: 12px;">[[ ${dictionaryEn[invoice.order.deliveryMethod]} ]]</li>
        </ul>
        <ul class="right">
            <li class="label">Invoice number</li>
            <li style="font-size: 12px;">[[ ${invoice.invoiceNo} ]]</li>
        </ul>
        <div class="clear"></div>
    </div>

    <div class="data-row" >
        <ul class="left">
            <li class="label">Terms of delivery</li>
            <li style="font-size: 12px;">[[ ${dictionaryEn[invoice.order.paymentMethod]} ]]</li>
        </ul>
        <ul class="right">
            <li class="label">Invoice date</li>
            <li style="font-size: 12px;" th:text="${#dates.format(invoice.getInvoiceDate(), 'yyyyMMdd')}"></li>
        </ul>
        <div class="clear"></div>
    </div>

    <div class="data-row" >
        <ul class="left">
            <li class="label">Forwarder</li>
            <li style="font-size: 12px;">[[ ${invoice.delivery.forwarder} ]]</li>
        </ul>
        <ul class="right">
            <li class="label">Invoice due date</li>
            <li style="font-size: 12px;" th:text="${#dates.format(invoice.getDuDate(), 'yyyyMMdd')}"></li>
        </ul>
        <div class="clear"></div>
    </div>

    <div class="data-row" >
        <ul class="left">
            <li class="label">Delivery date</li>
            <li style="font-size: 12px;" th:text="${#dates.format(invoice.getDelivery().getDeliveryDate(), 'yyyyMMdd')}"></li>
        </ul>
        <ul class="right">
            <li class="label">Customer number</li>
            <li style="font-size: 12px;">[[ ${invoice.order.company.companyNo} ]]</li>
        </ul>
        <div class="clear"></div>
    </div>

    <div class="data-row" >
        <ul class="left">
            <li class="label">Your reference</li>
            <li style="font-size: 12px;">[[ ${invoice.order.reference} ]]</li>
        </ul>
        <ul class="right">
            <li class="label">Our ordernr.</li>
            <li style="font-size: 12px;">[[ ${invoice.order.orderNo} ]]</li>
        </ul>
        <div class="clear"></div>
    </div>

    <div class="data-row" >
        <ul class="left">
            <li class="label"></li>
            <li></li>
        </ul>
        <ul class="right">
            <li class="label">Phone:</li>
            <li style="font-size: 12px;">[[ ${invoice.order.company.tel} ]]</li>
        </ul>
        <div class="clear"></div>
    </div>

    <table border="0" cellpadding="0" cellspacing="0" style="width:90%;border: 0px solid black;margin: 50px auto">
        <thead>
        <tr>
            <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 5%">Row</td>
            <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 10%">Nr</td>
            <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 30%">Description</td>
            <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 10%">Quantity</td>
            <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 10%">Price</td>
            <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 10%">Amount USD</td>
        </tr>
        </thead>
        <tbody>
        <tr th:each="invoicePdfTableInfo,invoicePdfTableInfoStat:${invoice.getInvoicePdfTableInfoList()}">
            <td style="font-size: 12px;border-bottom: 1px solid black" th:text="${invoicePdfTableInfoStat.count}"></td>
            <td style="font-size: 12px;border-bottom: 1px solid black" th:text="${invoicePdfTableInfo.getProductNo()}"></td>
            <td style="font-size: 12px;border-bottom: 1px solid black" th:text="${invoicePdfTableInfo.getDescriptionEn()}"></td>
            <td style="font-size: 12px;border-bottom: 1px solid black" th:text="${invoicePdfTableInfo.getQuantity()+' '+dictionaryEn[invoicePdfTableInfo.getQuantityUnit()]}"></td>
            <td style="font-size: 12px;border-bottom: 1px solid black" th:text="${#numbers.formatDecimal(invoicePdfTableInfo.getPrice().multiply(dictionaryEn['CNY/USD']),1,'COMMA',5,'POINT')}"></td>
            <td style="font-size: 12px;border-bottom: 1px solid black" th:text="${#numbers.formatDecimal(invoicePdfTableInfo.getTotal().multiply(dictionaryEn['CNY/USD']),1,'COMMA',2,'POINT')}"></td>
        </tr>
        </tbody>
        <tfoot style="margin-top: 50px">
        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td style="border-bottom: 1px solid black"></td>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td style="font-size: 13px;"><b>NET VALUE.:</b></td>
            <td></td>
            <td></td>
            <td style="font-size: 13px;" th:text="${#numbers.formatDecimal(invoice.getTotal().multiply(dictionaryEn['CNY/USD']),1,'COMMA',2,'POINT')}"></td>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td style="font-size: 14px;"><b>TOT. AMOUNT.:</b></td>
            <td></td>
            <td style="font-size: 14px;">USD</td>
            <td style="font-size: 14px;" th:text="+${#numbers.formatDecimal(invoice.getAmountDue().multiply(dictionaryEn['CNY/USD']),1,'COMMA',2,'POINT')}"></td>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td style="font-size: 14px;"><b>********************</b></td>
        </tr>
        </tfoot>
    </table>
</div>
<div style="width:98%;position:absolute;bottom: 120px;border-bottom: 2px solid black">
    <p style="margin-left: 10px;font-size: 14px;">
        UPON ORDER DELIVERY, PLEASE CONTACT US IF ANY PROBLEM NOT LATER THAN
        7 DAYS, <br/>OTHERWISE, NO CLAIM WILL BE RECOGNIZED.
    </p>
</div>
<footer style="width:98%;border-top:1px solid black;position:absolute;bottom: 0px">
    <p th:text="${'Wanruite Clothing Signs Co., Ltd.'}"></p>
    <p>Contact information: <a href="#">12345678</a></p>
</footer>
</body>
</html>

发票中文

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<style>
    body {
        font-family: SimSun;
        font-size: 14px;
        border: 0px solid red;
        margin-bottom: 50px;
        height: auto;
    }
    ul {
        list-style-type:none;
        margin: 0px;
        padding: 0px;
    }
    .left {
        float: left;
        width: 45%;
    }
    .right {
        float: right;
        width: 45%;
    }
    .font-size-large {
        font-size: 22px;
    }
    .clear {
        clear: both;
    }
    .label {
        font-family: SimHei;
        font-weight: bold;
        font-size: 12px;
    }
    .data-address {
        margin: 5px auto;
        width:90%;
        border: 0px solid red;
    }
    .data-row {
        width:90%;
        border: 0px solid red;
        margin: 1px auto;
    }
    .data-row ul li {
        float: left;
    }
    .data-row .label {
        width: 180px;
    }
</style>
<body>
<div style=" border:0px solid red">
<div style="border:0px solid black;margin-bottom: 50px">
    <div class="left font-size-large">LOGO</div>
    <div class="right">
        <span style="margin-right: 20px;" class="font-size-large">发票编号</span>
        [[ ${invoice.invoiceNo} ]]
    </div>
    <div class="clear"></div>
</div>

<div class="data-address" style="margin-top: 100px">
    <div class="left">
        <div class="label" style="line-height: 20px;border-bottom: 2px solid black;font-size: 14px;margin-bottom: 5px">[[ ${dictionaryZh[invoice.order.companyAddressList[0].addrType]} ]]</div>
        <div style="font-size: 12px;height: 20px"><span class="label">名称:</span> [[ ${invoice.order.companyAddressList[0].addrName} ]]</div>
        <div style="font-size: 12px;height: 20px"><span class="label">地址:</span> [[ ${invoice.order.companyAddressList[0].partOne} ]]</div>
        <div style="font-size: 12px;height: 20px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [[ ${invoice.order.companyAddressList[0].partTwo} ]]</div>
        <div style="font-size: 12px;height: 20px"><span class="label">城市:</span> [[ ${invoice.order.companyAddressList[0].postalCodeCity} ]]</div>
        <div style="font-size: 12px;height: 20px"><span class="label">国家:</span> [[ ${dictionaryZh[invoice.order.companyAddressList[0].country]} ]]</div>
        <div style="font-size: 12px;height: 20px"><span class="label">税号:</span> [[ ${invoice.order.companyAddressList[0].vatNr} ]]</div>
    </div>
    <div class="right">
        <div class="label" style="line-height: 20px;border-bottom: 2px solid black;font-size: 14px;margin-bottom: 5px">[[ ${dictionaryZh[invoice.order.companyAddressList.get(1).addrType]} ]]</div>
        <div style="font-size: 12px;height: 20px"><span class="label">名称:</span> [[ ${invoice.order.companyAddressList[1].addrName} ]]</div>
        <div style="font-size: 12px;height: 20px"><span class="label">地址:</span> [[ ${invoice.order.companyAddressList[1].partOne} ]]</div>
        <div style="font-size: 12px;height: 20px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [[ ${invoice.order.companyAddressList[1].partTwo} ]]</div>
        <div style="font-size: 12px;height: 20px"><span class="label">城市:</span> [[ ${invoice.order.companyAddressList[1].postalCodeCity} ]]</div>
        <div style="font-size: 12px;height: 20px"><span class="label">国家:</span> [[ ${dictionaryZh[invoice.order.companyAddressList[1].country]} ]]</div>
        <div style="font-size: 12px;height: 20px"><span class="label">税号:</span> [[ ${invoice.order.companyAddressList[1].vatNr} ]]</div>
    </div>
    <div class="clear"></div>
</div>

<div class="data-row" >
    <ul class="left">
        <li class="label">交货方式</li>
        <li>[[ ${dictionaryZh[invoice.order.deliveryMethod]} ]]</li>
    </ul>
    <ul class="right">
        <li class="label">发票编号</li>
        <li>[[ ${invoice.invoiceNo} ]]</li>
    </ul>
    <div class="clear"></div>
</div>

<div class="data-row" >
    <ul class="left">
        <li class="label">付款方式</li>
        <li>[[ ${dictionaryZh[invoice.order.paymentMethod]} ]]</li>
    </ul>
    <ul class="right">
        <li class="label">发票日期</li>
        <li th:text="${#dates.format(invoice.getInvoiceDate(), 'yyyyMMdd')}"></li>
    </ul>
    <div class="clear"></div>
</div>

<div class="data-row" >
    <ul class="left">
        <li class="label">货运代理</li>
        <li>[[ ${invoice.delivery.forwarder} ]]</li>
    </ul>
    <ul class="right">
        <li class="label">发票到期日</li>
        <li th:text="${#dates.format(invoice.getDuDate(), 'yyyyMMdd')}"></li>
    </ul>
    <div class="clear"></div>
</div>

    <div class="data-row" >
        <ul class="left">
            <li class="label">发货日期</li>
            <li th:text="${#dates.format(invoice.getDelivery().getDeliveryDate(), 'yyyyMMdd')}"></li>
        </ul>
        <ul class="right">
            <li class="label">客户编号</li>
            <li>[[ ${invoice.order.company.companyNo} ]]</li>
        </ul>
        <div class="clear"></div>
    </div>

    <div class="data-row" >
        <ul class="left">
            <li class="label">客户参考信息</li>
            <li>[[ ${invoice.order.reference} ]]</li>
        </ul>
        <ul class="right">
            <li class="label">订单编号</li>
            <li>[[ ${invoice.order.orderNo} ]]</li>
        </ul>
        <div class="clear"></div>
    </div>

    <div class="data-row" >
        <ul class="left">
            <li class="label"></li>
            <li></li>
        </ul>
        <ul class="right">
            <li class="label">电话</li>
            <li>[[ ${invoice.order.company.tel} ]]</li>
        </ul>
        <div class="clear"></div>
    </div>

    <table border="0" cellpadding="0" cellspacing="0" style="width:90%;border: 0px solid black;margin: 50px auto">
        <thead>
            <tr>
                <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 5%">序号</td>
                <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 10%">产品编号</td>
                <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 30%">描述</td>
                <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 10%">发货数量</td>
                <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 10%">价格</td>
                <td class="label" style="border-bottom: 2px solid rebeccapurple;width: 10%">金额</td>
            </tr>
        </thead>
        <tbody>
            <tr th:each="invoicePdfTableInfo,invoicePdfTableInfoStat:${invoice.getInvoicePdfTableInfoList()}">
                <td style="font-size: 12px;border-bottom: 1px solid black" th:text="${invoicePdfTableInfoStat.count}"></td>
                <td style="font-size: 12px;border-bottom: 1px solid black" th:text="${invoicePdfTableInfo.getProductNo()}"></td>
                <td style="font-size: 12px;border-bottom: 1px solid black" th:text="${invoicePdfTableInfo.getDescription()}"></td>
                <td style="font-size: 12px;border-bottom: 1px solid black" th:text="${invoicePdfTableInfo.getQuantity()+dictionaryZh[invoicePdfTableInfo.getQuantityUnit()]}"></td>
                <td style="font-size: 12px;border-bottom: 1px solid black" th:text="'¥'+${#numbers.formatDecimal(invoicePdfTableInfo.getPrice(),1,'COMMA',3,'POINT')}"></td>
                <td style="font-size: 12px;border-bottom: 1px solid black" th:text="'¥'+${#numbers.formatDecimal(invoicePdfTableInfo.getTotal(),1,'COMMA',2,'POINT')}"></td>
            </tr>
        </tbody>
        <tfoot>
            <tr >
                <td></td>
                <td></td>
                <td style="font-size: 14px;"><b>净额:</b></td>
                <td></td>
                <td></td>
                <td style="font-size: 14px;" th:text="'¥'+${#numbers.formatDecimal(invoice.getTotal(),1,'COMMA',2,'POINT')}"></td>
            </tr>
            <tr >
                <td></td>
                <td></td>
                <td style="font-size: 14px;"><b>应付金额:</b></td>
                <td></td>
                <td style="font-size: 14px;">CNY</td>
                <td style="font-size: 14px;" th:text="'¥'+${#numbers.formatDecimal(invoice.getAmountDue(),1,'COMMA',2,'POINT')}"></td>
            </tr>
            <tr>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td style="font-size: 14px;"><b>********************</b></td>
            </tr>
        </tfoot>
    </table>
</div>
    <div style="width:98%;position:absolute;bottom: 120px;border-bottom: 2px solid black">
        <p style="margin-left: 10px;font-size: 14px;">
            订购后,如有任何其他问题,请与我们联系
            否则7天,我们将不予赔偿。
        </p>
    </div>
<footer style="width:98%;border-top:1px solid black;position:absolute;bottom: 0px">
    <p th:text="${'万瑞特服饰标牌有限公司'}"></p>
    <p>Contact information: <a href="#">12345678</a></p>
</footer>
</body>
</html>

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏23号杂货铺

Springboot之整合ElasticSearch使用

(来自infoq)据外媒报道,1月22日,美国一家网上赌场集团泄露了超过 1.08 亿笔投注信息,包括客户个人资料,存取款记录、家庭住址、电话号码、电子邮件地址...

19140
来自专栏腾讯技术工程官方号的专栏

腾讯计费:亿万级大促活动自动化保障体系

? 9月14-15日,GOPS全球运维大会上海站圆满举行,为期两天的运维盛宴,为各位运维人带来了相互交流和学习的绝佳平台,来自腾讯技术工程事业群(TEG)计费...

9530
来自专栏Java程序员那些事

Mysql的事务的隔离级别

mysql事务,依次为Read uncommitted(读未提交) 、Read committed(读已提交) 、Repeatable read(可重复读) 、...

6930
来自专栏布谷科技

直播系统开发后端是前端功能实现的基础

直播的热潮还未褪去,使得直播系统开发行业持续发展,一套完整的直播系统包括安卓端,iOS端以及后端设置,后端是前端功能实现的基础,那么后端都应该有哪些功能呢?

16420
来自专栏程序员一一涤生

目标检测中常提到的IoU和mAP究竟是什么?

intersect over union,中文:交并比。指目标预测框和真实框的交集和并集的比例。

12660
来自专栏FreeBuf

冰蝎动态二进制加密WebShell特征分析

冰蝎一款新型加密网站管理客户端,在实际的渗透测试过程中有非常不错的效果,能绕过目前市场上的大部分WAF、探针设备。本文将通过在虚拟环境中使用冰蝎,通过wires...

21920
来自专栏优惠券代金券

云服务器

云服务器(Cloud Virtual Machine,CVM)为您提供安全可靠的弹性计算服务。 只需几分钟,您就可以在云端获取和启用 CVM,来实现您的计算需求...

50930
来自专栏云服务器哪家好

云服务器哪家好?国内品牌云服务器综合评价

云服务器哪家好?如今云服务在国内的应用越来越广泛,不仅仅是企业和站长,很多办公软件和应用平台也在使用云。而主机市场上目前的云服务商众多,以至于用户在选择的时候不...

34530
来自专栏古时的风筝

JDK 13 都已经发布了,Java 8 依然是最爱

在 JDK 版本的世界里,从来都是 Oracle 发他的新版本,我们继续用我们的老版本。三年之前用 JDK 7,后来终于升级到了 JDK 8。自从升级了没多久,...

28930
来自专栏中小企业选择云服务器

中小企业如何选择腾讯云服务器的价格与配置?

腾讯云中小企业服务器如何选择价格配置?今天有企业朋友问笔者,我们中小企业建站的话,应该如何选择云服务器配置啊,价钱大概是多少的合适,能放几个网站,性能怎么样? ...

18630

扫码关注云+社区

领取腾讯云代金券

年度创作总结 领取年终奖励