Skip to content

Bid-winning notice — generate this PDF with Java (Template)

JQuick-PdfGovernment Demos

Template2 页 A4 · 31 KB

Bid-winning notice / tender registration receipt.

Download the PDFView raw template fileBack to all demos

Bid-winning notice — Template
Rendered output

Output specs

PDF pages
2
Chart type
Template
Template lines
175
Source lines
128

Java source · JQuickBiz163BidWinNotice.java

This is the complete test class that produced the PDF above — copy it and run as-is; see the quick-start section for the Maven dependency.

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Copyright (c) [2025-2099] Martin ([email protected])
 */
package com.github.paohaijiao.biz.gov;

import com.github.paohaijiao.config.JPdfConfig;
import com.github.paohaijiao.executor.JQuickPdfFactory;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 单据 163:中标通知书 / 投标报名回执(gov 领域第 9 项)。
 *
 * <p>本类为独立可运行 Demo:自带 {@code main} 方法、不依赖任何公共工具类或实体类,
 * 数据以 key-value 形式通过 {@link JQuickPdfFactory#bindAll(Map)} 注入,
 * 版式全部落在模板文件 {@code demo/biz/gov/163_bid_win_notice.txt} 中。</p>
 *
 * <p>视觉主题「宝蓝·密排·下线」:主色 #183DA9、辅色 #914527、浅底 #F0F2F7;
 * 版式为 underline 抬头 + kv 信息区 + compact 明细表 + three 签章区 + right 落款,
 * 与同领域其它单据互不重样。</p>
 *
 * <p>中标通知书 / 投标报名回执:招标项目与编号、招标方式与中标人、</p>
 * <p>各投标人报价与评审得分排名、中标结果与签约提示、三方签章栏。</p>
 *
 * <p>运行后输出:{@code D:/test/pdf/163_bid_win_notice.pdf}。</p>
 *
 * @author Martin
 * @version 1.0.0
 */
public class JQuickBiz163BidWinNotice {

    private static final String PDF_DIR = "D:/test/pdf/";
    private static final String OUT_FILE = PDF_DIR + "163_bid_win_notice.pdf";
    private static final String TEMPLATE = "demo/biz/gov/163_bid_win_notice.txt";

    /** 模板固定明细行数,不足时补空行,避免占位符原样输出。 */
    private static final int ITEM_ROWS = 6;

    public static void main(String[] args) throws IOException {
        new File(PDF_DIR).mkdirs();

        // ---------- 1. 数据(无实体类,直接 bind)----------
        String[][] items = {
                {"1", "××建设工程有限公司", "1860.00", "420", "93.86", "第 1 名 / 中标"},
                {"2", "××建工集团有限公司", "1912.00", "430", "90.12", "第 2 名"},
                {"3", "××建筑安装有限公司", "1948.00", "450", "87.45", "第 3 名"},
                {"4", "××市政工程有限公司", "2016.00", "420", "82.30", "第 4 名"},
                {"5", "××装饰工程有限公司", "2088.00", "480", "76.18", "第 5 名"},
                {"6", "××钢结构有限公司", "2140.00", "400", "71.05", "第 6 名"}
        };

        Map<String, Object> data = new LinkedHashMap<String, Object>();
        data.put("noticeNo", "ZB-20261026-0071");
        data.put("issueDate", "2026年10月26日");
        data.put("tenderee", "××城市投资开发有限公司");
        data.put("agencyName", "××工程咨询有限公司");
        data.put("projectName", "××产业园 3 号厂房施工总承包");
        data.put("bidNo", "GC-2026-0713 / 一标段");
        data.put("bidMethod", "公开招标(资格后审)");
        data.put("winner", "××建设工程有限公司");
        data.put("bidPrice", "¥18,600,000.00");
        data.put("durationInfo", "420 日历天 / 合格,争创优质工程");
        data.put("managerInfo", "路承志 / 一级建造师 苏 1322026××××");
        data.put("signupNo", "SIGN-20260912-0188");
        data.put("resultNote", "经评标委员会评审并公示无异议,确定 ××建设工程有限公司为中标人,中标价人民币壹仟捌佰陆拾万元整。");
        data.put("signNote", "中标人应自收到中标通知书之日起 30 日内,按照招标文件和中标人的投标文件订立书面合同。");
        data.put("tendereeSign", "××城市投资开发有限公司");
        data.put("agencySign", "××工程咨询有限公司");
        data.put("winnerSign", "路承志");

        // 明细逐格展开
        for (int i = 0; i < ITEM_ROWS; i++) {
            int n = i + 1;
            if (i >= items.length) {
                data.put("itemName" + n, "—");
                data.put("itemSpec" + n, "—");
                data.put("itemUnit" + n, "—");
                data.put("itemQty" + n, "—");
                data.put("itemPrice" + n, "—");
                data.put("itemAmount" + n, "—");
                continue;
            }
            data.put("itemName" + n, items[i][0]);
            data.put("itemSpec" + n, items[i][1]);
            data.put("itemUnit" + n, items[i][2]);
            data.put("itemQty" + n, items[i][3]);
            data.put("itemPrice" + n, items[i][4]);
            data.put("itemAmount" + n, items[i][5]);
        }

        // ---------- 2. 渲染 ----------
        JPdfConfig config = new JPdfConfig();
        config.getLayoutConfig().setFlexLayout(true);
        config.getDoc().setMargins(Arrays.asList(48, 48, 48, 48));
        config.getFontConfig().setDefaultFontName("Noto Sans CJK SC");
        config.getHeaderConfig().setEnabled(true);
        config.getHeaderConfig().setText("××城市投资开发有限公司 中标通知书 ZB-20261026-0071");
        config.getHeaderConfig().setFontSize(8f);
        config.getHeaderConfig().setHeight(30);
        config.getFooterConfig().setEnabled(true);
        config.getFooterConfig().setFontSize(8);
        config.getFooterConfig().setPageNumberFormat("— %d —");

        JQuickPdfFactory factory = new JQuickPdfFactory(config);
        factory.bindAll(data);
        byte[] pdf = factory.executeResource(TEMPLATE);
        Files.write(new File(OUT_FILE).toPath(), pdf);
        System.out.println("已生成:" + OUT_FILE + "(" + pdf.length + " 字节)");
    }
}

Minimal invocation (3 lines)

Skip the full test class — the core is these three lines: bind the chart SVG, execute the template, get the PDF bytes. Copy them straight into your project.

// config 可省略;svg 来自 JChartRendererFactory.renderChart(...),见下方完整源码
byte[] pdf = new JQuickPdfFactory(config).executeResource("demo/biz/gov/163_bid_win_notice.txt");

Template file · 163_bid_win_notice.txt

An HTML-like template with inline CSS that renders to PDF once bound to data. The full template is below — copy it or download the raw file.

<pdf>
<body>
  // 163 中标通知书 / 投标报名回执(gov 领域第 9 项) 视觉主题:宝蓝·密排·下线
  // 版式组合:抬头=underline 信息区=kv 明细表=compact 段落=box 签章=three 落款=right
  // 主色 #183DA9 辅色 #914527 浅底 #F0F2F7
  // 招投标中标通知书与投标报名回执:中标价、工期、评审得分与签约提示。

  // 抬头:underline
  <table style="width:100%; marginBottom:1px">
    <tr>
      <td style="width:62%; padding:2px; bold:true; fontSize:15pt; color:#062683; characterSpacing:3pt">'中标通知书 / 投标报名回执'</td>
      <td style="padding:2px; textAlign:right; fontSize:7.5pt; color:#78838C">'通知书编号 '${noticeNo}'  发出日期 '${issueDate}'  招标人 '${tenderee}</td>
    </tr>
  </table>
  <lineSeparator style="color:#183DA9; thickness:2.5f; marginBottom:8px"></lineSeparator>

  // 信息区:kv
  <table style="width:100%; fontSize:9pt; marginBottom:8px">
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'通知书编号 / NO.'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${noticeNo}</td>
    </tr>
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'发出日期 / DATE'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${issueDate}</td>
    </tr>
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'招标人 / TENDEREE'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${tenderee}</td>
    </tr>
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'招标代理机构'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${agencyName}</td>
    </tr>
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'招标项目名称'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${projectName}</td>
    </tr>
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'招标编号 / 标段'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${bidNo}</td>
    </tr>
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'招标方式'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${bidMethod}</td>
    </tr>
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'中标人 / WINNER'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${winner}</td>
    </tr>
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'中标价'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${bidPrice}</td>
    </tr>
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'工期 / 质量目标'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${durationInfo}</td>
    </tr>
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'项目经理 / 证书'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${managerInfo}</td>
    </tr>
    <tr>
      <td style="width:22%; padding:5px; backgroundColor:#F0F2F7; bold:true; border:1px solid #BCC3DA">'投标报名编号'</td>
      <td style="padding:5px; border:1px solid #BCC3DA">${signupNo}</td>
    </tr>
  </table>

  <p style="fontSize:10pt; bold:true; color:#183DA9; marginBottom:3px; characterSpacing:2pt">'中标内容与投标情况明细'</p>
  <table style="width:100%; fontSize:7.5pt; marginBottom:8px">
    <tr>
      <th style="width:7%; padding:2px; backgroundColor:#062683; color:white; bold:true; textAlign:center; border:1px solid #062683">'序号'</th>
      <th style="width:24%; padding:2px; backgroundColor:#062683; color:white; bold:true; textAlign:center; border:1px solid #062683">'分部分项 / 投标单位'</th>
      <th style="width:15%; padding:2px; backgroundColor:#062683; color:white; bold:true; textAlign:center; border:1px solid #062683">'投标报价(万元)'</th>
      <th style="width:13%; padding:2px; backgroundColor:#062683; color:white; bold:true; textAlign:center; border:1px solid #062683">'工期(日历天)'</th>
      <th style="width:12%; padding:2px; backgroundColor:#062683; color:white; bold:true; textAlign:center; border:1px solid #062683">'评审得分'</th>
      <th style="padding:2px; backgroundColor:#062683; color:white; bold:true; textAlign:center; border:1px solid #062683">'排名 / 结论'</th>
    </tr>
    <tr>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemName1}</td>
      <td style="padding:2px; textAlign:left; border:1px solid #DFE0E5">${itemSpec1}</td>
      <td style="padding:2px; textAlign:right; border:1px solid #DFE0E5">${itemUnit1}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemQty1}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemPrice1}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemAmount1}</td>
    </tr>
    <tr>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemName2}</td>
      <td style="padding:2px; textAlign:left; border:1px solid #DFE0E5">${itemSpec2}</td>
      <td style="padding:2px; textAlign:right; border:1px solid #DFE0E5">${itemUnit2}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemQty2}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemPrice2}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemAmount2}</td>
    </tr>
    <tr>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemName3}</td>
      <td style="padding:2px; textAlign:left; border:1px solid #DFE0E5">${itemSpec3}</td>
      <td style="padding:2px; textAlign:right; border:1px solid #DFE0E5">${itemUnit3}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemQty3}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemPrice3}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemAmount3}</td>
    </tr>
    <tr>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemName4}</td>
      <td style="padding:2px; textAlign:left; border:1px solid #DFE0E5">${itemSpec4}</td>
      <td style="padding:2px; textAlign:right; border:1px solid #DFE0E5">${itemUnit4}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemQty4}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemPrice4}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemAmount4}</td>
    </tr>
    <tr>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemName5}</td>
      <td style="padding:2px; textAlign:left; border:1px solid #DFE0E5">${itemSpec5}</td>
      <td style="padding:2px; textAlign:right; border:1px solid #DFE0E5">${itemUnit5}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemQty5}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemPrice5}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemAmount5}</td>
    </tr>
    <tr>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemName6}</td>
      <td style="padding:2px; textAlign:left; border:1px solid #DFE0E5">${itemSpec6}</td>
      <td style="padding:2px; textAlign:right; border:1px solid #DFE0E5">${itemUnit6}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemQty6}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemPrice6}</td>
      <td style="padding:2px; textAlign:center; border:1px solid #DFE0E5">${itemAmount6}</td>
    </tr>
  </table>

  // 段落:box
  <table style="width:100%; marginBottom:6px">
    <tr>
      <td style="width:150px; padding:5px; backgroundColor:#F0F2F7; bold:true; fontSize:9.5pt; color:#062683; border:1px solid #BCC3DA">'中标结果'</td>
      <td style="padding:5px; fontSize:9pt; border:1px solid #BCC3DA">${resultNote}</td>
    </tr>
  </table>
  <table style="width:100%; marginBottom:6px">
    <tr>
      <td style="width:150px; padding:5px; backgroundColor:#F0F2F7; bold:true; fontSize:9.5pt; color:#062683; border:1px solid #BCC3DA">'签约提示'</td>
      <td style="padding:5px; fontSize:9pt; border:1px solid #BCC3DA">${signNote}</td>
    </tr>
  </table>

  // 签章区:three
  <!-- 签章占位区:后续加盖电子公章 / 骑缝章 / 打印二维码 -->
  <table style="width:100%; fontSize:8pt; marginBottom:8px">
    <tr>
      <td style="width:33%; padding:4px; bold:true; textAlign:center; color:#183DA9; border:1px dashed #183DA9">'(行政审批专用章 / 公章占位)'</td>
      <td style="width:33%; padding:4px; bold:true; textAlign:center; color:#183DA9; border:1px dashed #183DA9">'(骑缝章 / 二维码占位)'</td>
      <td style="width:33%; padding:4px; bold:true; textAlign:center; color:#183DA9; border:1px dashed #183DA9">'(二维码占位)'</td>
    </tr>
    <tr>
      <td style="width:33%; padding:4px; textAlign:center; color:#78838C; border:1px dashed #183DA9">'受理机关:'${tenderee}</td>
      <td style="width:33%; padding:4px; textAlign:center; color:#78838C; border:1px dashed #183DA9">'骑缝章沿右边线骑缝加盖'</td>
      <td style="width:33%; padding:4px; textAlign:center; color:#78838C; border:1px dashed #183DA9">'扫码验真'</td>
    </tr>
    <tr>
      <td style="width:33%; padding:4px; textAlign:center; color:#78838C; border:1px dashed #183DA9">'办结日期:'${issueDate}</td>
      <td style="width:33%; padding:4px; textAlign:center; color:#78838C; border:1px dashed #183DA9">'二维码打印于右上角方框内'</td>
      <td style="width:33%; padding:4px; textAlign:center; color:#78838C; border:1px dashed #183DA9">'尺寸 22mm×22mm'</td>
    </tr>
  </table>

  // 落款:right
  <!-- 落款栏 -->
  <table style="width:100%; fontSize:9pt; marginTop:6px">
    <tr>
      <td style="width:24%; padding:4px">' '</td>
      <td style="width:38%; padding:4px; textAlign:center; color:#062683">'招标人签章:'${tendereeSign}</td>
      <td style="width:38%; padding:4px; textAlign:center; color:#062683">'代理机构签章:'${agencySign}</td>
      <td style="padding:4px; textAlign:center; color:#062683">'中标人签收:'${winnerSign}</td>
    </tr>
  </table>
</body>
</pdf>

More demos in this group

The PDF, preview image, template and source code on this page were all produced by a real JQuick-Pdf run and are free to copy into your own project.