Skip to content

Meeting invitation letter (formal correspondence) — generate this PDF with Java (Layout)

JQuick-PdfBiz Demo

Layout1 页 A4 · 37 KB

An invitation from an industry association to its member companies: centred title and salutation, indented body paragraphs, a three-column agenda, three attendee info boxes, a right-aligned sign-off and contact details in the footer.

Download the PDFView raw template fileBack to all demos

Meeting invitation letter (formal correspondence) — Layout
Rendered output

Output specs

PDF pages
1
Chart type
Layout
Template lines
88
Source lines
62

Java source · JQuickBiz52InvitationLetterTest.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.demo.biz;

import com.github.paohaijiao.config.JPdfConfig;
import com.github.paohaijiao.demo.constant.JQuickConstant;
import com.github.paohaijiao.executor.JQuickPdfFactory;
import org.junit.Test;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 邀请函 Demo 52:会议邀请函(正式函件场景)
 *
 * <p>业务场景:行业协会向会员单位发出会议邀请,需以正式函件格式呈现主办单位、
 * 称谓、邀请事由、会议议程、参会信息与落款日期。</p>
 *
 * <p>版式:函件结构——居中大标题(字距拉开)+ 左对齐称谓 + 两个全角空格缩进的正文段落 +
 * 三列会议议程表 + 三栏参会信息盒 + 右对齐落款 + 页脚联络方式。</p>
 *
 * <p>本模板为纯版式 Demo,不含图表,因此不需要绑定 {@code svg} 变量;
 * 模板:{@code report/biz/52_invitation_letter.txt},输出:{@code D:\test\biz\52_invitation_letter.pdf}。</p>
 *
 * @author Martin
 * @version 1.0.0
 */
public class JQuickBiz52InvitationLetterTest {

    public static final String path = JQuickConstant.path;

    @Test
    public void biz52InvitationLetter() throws IOException {
        File dir = new File(path + "biz");
        if (!dir.exists()) {
            dir.mkdirs();
        }
        FileOutputStream fileOutputStream = new FileOutputStream(path + "biz/52_invitation_letter.pdf");
        JPdfConfig config = new JPdfConfig();
        // 开启 flex 行布局,使模板中的 display:flex 生效(参会信息三栏、页脚联络方式两端对齐)
        config.getLayoutConfig().setFlexLayout(true);
        JQuickPdfFactory factory = new JQuickPdfFactory(config);
        byte[] bytes = factory.executeResource("report/biz/52_invitation_letter.txt");
        fileOutputStream.write(bytes);
        fileOutputStream.close();
    }
}

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("report/biz/52_invitation_letter.txt");

Template file · 52_invitation_letter.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>

  // ---------- 函件头:主办单位 + 居中大标题 + 编号 ----------
  <div style="marginBottom:12px">
    <p style="fontSize:9pt; color:#6c757d; textAlignment:center; marginBottom:10px">'××省数字经济产业协会'</p>
    <h1 style="fontSize:20pt; bold:true; color:#1F4E79; textAlignment:center; characterSpacing:8pt; marginBottom:6px">'邀 请 函'</h1>
    <p style="fontSize:9pt; color:#8a939b; textAlignment:center">'编号:YQ-2024-0086'</p>
  </div>
  <lineSeparator style="strokeColor:#1F4E79"></lineSeparator>

  // ---------- 称谓 ----------
  <p style="fontSize:11pt; bold:true; color:#1A2733; marginTop:14px; marginBottom:10px">'尊敬的 ××× 先生 / 女士:'</p>

  // ---------- 正文:三段,段首用两个全角空格缩进 ----------
  <p style="fontSize:10pt; color:#333333; marginBottom:9px">'  为深入贯彻落实全省数字经济高质量发展工作部署,推动数据要素与实体产业深度融合,我会定于 2025 年 1 月 18 日举办「2025 数字产业协同创新大会」。大会将围绕指标体系治理、数据资产入表、企业数字化转型路径等议题开展交流。'</p>
  <p style="fontSize:10pt; color:#333333; marginBottom:9px">'  鉴于贵单位在数据治理与平台建设领域积累了丰富实践经验,特诚挚邀请您拨冗出席本次大会,并作主题分享。您的参与将为与会单位提供宝贵借鉴,也将进一步促进产业界的交流与合作。'</p>
  <p style="fontSize:10pt; color:#333333; marginBottom:12px">'  现将会议有关事项函告如下,敬请查收并按期反馈参会回执。'</p>

  // ---------- 会议议程:三列表 ----------
  <h3 style="fontSize:11pt; bold:true; color:#1F4E79; marginBottom:5px">'一、会议议程'</h3>
  <table style="width:540px; fontSize:9pt">
    <tr>
      <th style="width:120px; padding:5px; backgroundColor:#1F4E79; color:white; textAlign:center; border:1px solid #1F4E79">'时间'</th>
      <th style="width:290px; padding:5px; backgroundColor:#1F4E79; color:white; textAlign:center; border:1px solid #1F4E79">'议程内容'</th>
      <th style="width:130px; padding:5px; backgroundColor:#1F4E79; color:white; textAlign:center; border:1px solid #1F4E79">'主讲 / 主持'</th>
    </tr>
    <tr>
      <td style="padding:5px; textAlign:center; border:1px solid #D3DCE5">'09:00 - 09:30'</td>
      <td style="padding:5px; border:1px solid #D3DCE5">'签到入场、参观成果展区'</td>
      <td style="padding:5px; textAlign:center; border:1px solid #D3DCE5">'会务组'</td>
    </tr>
    <tr>
      <td style="padding:5px; textAlign:center; border:1px solid #D3DCE5">'09:30 - 10:15'</td>
      <td style="padding:5px; border:1px solid #D3DCE5">'主旨报告:全省数字经济发展形势与政策解读'</td>
      <td style="padding:5px; textAlign:center; border:1px solid #D3DCE5">'李×× 研究员'</td>
    </tr>
    <tr>
      <td style="padding:5px; textAlign:center; border:1px solid #D3DCE5">'10:15 - 11:30'</td>
      <td style="padding:5px; border:1px solid #D3DCE5">'企业实践分享:指标体系治理与数据资产入表'</td>
      <td style="padding:5px; textAlign:center; border:1px solid #D3DCE5">'贵单位等 4 家'</td>
    </tr>
    <tr>
      <td style="padding:5px; textAlign:center; border:1px solid #D3DCE5">'11:30 - 12:00'</td>
      <td style="padding:5px; border:1px solid #D3DCE5">'圆桌对话与自由交流'</td>
      <td style="padding:5px; textAlign:center; border:1px solid #D3DCE5">'协会秘书长'</td>
    </tr>
  </table>

  // ---------- 参会信息盒:三栏并列 ----------
  <h3 style="fontSize:11pt; bold:true; color:#1F4E79; marginTop:12px; marginBottom:5px">'二、参会信息'</h3>
  <div style="border:1px solid #9FB3C8; background:#F7F9FC; padding:8px 10px">
    <div style="display:flex; justifyContent:space-between">
      <div style="width:170px">
        <p style="fontSize:9pt; color:#1F4E79; bold:true; marginBottom:2px">'会议时间'</p>
        <p style="fontSize:9pt; color:#333333">'2025年1月18日 09:00'</p>
      </div>
      <div style="width:200px">
        <p style="fontSize:9pt; color:#1F4E79; bold:true; marginBottom:2px">'会议地点'</p>
        <p style="fontSize:9pt; color:#333333">'××国际会议中心 三楼多功能厅'</p>
      </div>
      <div style="width:170px">
        <p style="fontSize:9pt; color:#1F4E79; bold:true; marginBottom:2px">'参会回执截止'</p>
        <p style="fontSize:9pt; color:#333333">'2025年1月12日 17:00'</p>
      </div>
    </div>
  </div>

  // ---------- 结语与落款:落款整体右对齐 ----------
  <p style="fontSize:10pt; color:#333333; marginTop:14px; marginBottom:4px">'  特此邀请,敬请拨冗出席。'</p>
  <p style="fontSize:10pt; color:#333333; textAlignment:right; marginTop:10px; marginBottom:3px">'××省数字经济产业协会'</p>
  <p style="fontSize:10pt; color:#333333; textAlignment:right">'2025年1月6日'</p>

  // ---------- 联络方式 ----------
  <div style="marginTop:16px">
    <lineSeparator style="strokeColor:#C3CDD8"></lineSeparator>
    <div style="display:flex; justifyContent:space-between; marginTop:6px">
      <div style="width:270px">
        <p style="fontSize:8pt; color:#8a939b">'会务联络:张×× 电话:138-0000-0000'</p>
      </div>
      <div style="width:270px; textAlignment:right">
        <p style="fontSize:8pt; color:#8a939b">'回执邮箱:[email protected] 传真:0000-66666666'</p>
      </div>
    </div>
  </div>
</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.