Comments (6)
As far as I know, separate font files are needed for difference weight.
However, file size will not be that large since only the glyphs that actually use will be embedded in the file.
from gopdf.
Thank you to your quick response.
Yes, it's not very large. We need both bold and normal font style to generate contract. For example, the PDF file generated by gopdf which embed two font files is 204 KB, but itextpdf (java) can shrink PDF file to 102 KB by only use one font and get bold font style by code.
We love golang and want to use it to replace all java code. We even hope golang can have a better performance in file size(Please forgive my greed). We have millions of users and the number is growing, so we want contract files can be as small as possible.
from gopdf.
Can you send me a sample pdf file that created from itextpdf.
from gopdf.
https://zcmlccontract.zcmlc.com/TransferPDF/2020/20200206/hgypdf/pt_xwyswsqtxwuwyvxutrt.pdf
Don't click it directly, please copy it to address bar first.
from gopdf.
Did you use the code like this to bold the font ( in itextpdf )?
Chunk chunk = new Chunk("ABCDE", arial12);
chunk.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE, 0.5f, null);
from gopdf.
I only use code to create bold font:
public static final Font getChineseSectionFont() {
Font FontChinese = null;
try {
BaseFont bfChinese = BaseFont.createFont("STSong-Light",
"UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
FontChinese = new Font(bfChinese, 12, Font.BOLD);
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
return FontChinese;
}
then use it like:
content = new Paragraph("一、借款", PDFFront.getChineseSectionFont());
from gopdf.
Related Issues (20)
- pdf file size issue HOT 1
- Error while inserting a random PDF to another PDF
- Is the rectangle with round corner REAL ROUND?
- Write Chinese garbled characters HOT 2
- support negative x and y? HOT 2
- Please help me understand why this PDF file was imported with an error message HOT 2
- [Question] Remove or Find & Replace Text HOT 1
- Requires timeout control
- Add MaxPageSize in gopdf.Config or gopdf.PageOption.
- Accessibility Issues with PDF Content Order HOT 3
- html and css layout support HOT 1
- panic en AddChars HOT 1
- 不支持书签的吗? HOT 4
- go1.13不支持 HOT 1
- how set page index? HOT 1
- stream write of content using WriteTo rewrites entire content HOT 1
- Right to Left does not work properly on multicell, Works correctly on Text HOT 3
- pageNumber / TotalPages in each page HOT 3
- HIndi Rendering Problem HOT 4
- Split text cannot handle Unicode HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gopdf.