openpdf-ivs

基于OpenPdf的ivs表意字体支持

License

License

Categories

Categories

PDF Data OpenPDF
GroupId

GroupId

com.github.doobo
ArtifactId

ArtifactId

openpdf-ivs
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

openpdf-ivs
基于OpenPdf的ivs表意字体支持
Project URL

Project URL

https://github.com/doobo/openpdf-ivs
Source Code Management

Source Code Management

https://github.com/doobo/openpdf-ivs

Download openpdf-ivs

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.doobo/openpdf-ivs/ -->
<dependency>
    <groupId>com.github.doobo</groupId>
    <artifactId>openpdf-ivs</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.doobo/openpdf-ivs/
implementation 'com.github.doobo:openpdf-ivs:1.0'
// https://jarcasting.com/artifacts/com.github.doobo/openpdf-ivs/
implementation ("com.github.doobo:openpdf-ivs:1.0")
'com.github.doobo:openpdf-ivs:jar:1.0'
<dependency org="com.github.doobo" name="openpdf-ivs" rev="1.0">
  <artifact name="openpdf-ivs" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.doobo', module='openpdf-ivs', version='1.0')
)
libraryDependencies += "com.github.doobo" % "openpdf-ivs" % "1.0"
[com.github.doobo/openpdf-ivs "1.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.github.librepdf : openpdf Optional jar 1.3.20

Project Modules

There are no modules declared in this project.

openpdf-ivs

如何添加,注意先后顺序,ivs要在前面,因为是替换openPdf里面的类

<dependency>
    <groupId>com.github.doobo</groupId>
    <artifactId>openpdf-ivs</artifactId>
    <version>1.0</version>
</dependency>
 
<dependency>
    <groupId>com.github.librepdf</groupId>
    <artifactId>openpdf</artifactId>
    <version>1.3.20</version>
</dependency>

简单使用

import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
import org.junit.jupiter.api.Test;

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

public class IvsFontsTests {

	@Test
	void testCommon() {
		FontFactory.register("pdf/Ming_MSCS_Full.ttf");
		Document document = new Document();
		try {
			PdfWriter.getInstance(document,
				new FileOutputStream("target/HelloWorld.pdf"));
			document.open();
			Font font =  FontFactory.getFont("Ming_MSCS_Full", "Identity-H",true,20,Font.BOLD,null);
			Paragraph paragraph = new Paragraph(25,
				new Chunk("拐拐\uDB40\uDD06\uDB40\uDD01,\uD846\uDE74\uD846\uDE74\uDB40\uDD01,\uD843\uDC98\uD843\uDC98\uDB40\uDD01,黙黙\uDB40\uDD02,髥髥\uDB40\uDD02,\uD85C\uDCF0\uD85C\uDCF0,飬飬\uDB40\uDD01,隶隶\uDB40\uDD04,鏆鏆\uDB40\uDD02\uDB40\uDD09,衆衆\uDB40\uDD08,录录\uDB40\uDD03,廸廸\uDB40\uDD04,啫啫\uDB40\uDD01,啚啚\uDB40\uDD05,啗啗\uDB40\uDD02,㛇㛇\uDB40\uDD02"
					,font)
			);
			paragraph.setFont(font);
			document.add(paragraph);
			document.close();
		} catch (DocumentException de) {
			System.err.println(de.getMessage());
		} catch (IOException ioe) {
			System.err.println(ioe.getMessage());
		}
	}
}

Versions

Version
1.0