Comments (3)
I don't want to do that because I want this package do its job it should be, that is creating PDF. I think simple code that has one job and does that one job well is the way I like to get things done. If you want to creating PDF from HTML, you should create new package to read HTML and call gopdf for creating pdf. I think this is the way. Thank you for suggestion.
from gopdf.
i have two answers:
- can i write something without setting the ttf font?
- why can't i write image after i write text
from gopdf.
Ans
- No, to write texts, you need to set font.
- This is example for write image after write text.
package main
import (
"log"
"github.com/signintech/gopdf"
)
func main() {
pdf := gopdf.GoPdf{}
pdf.Start(gopdf.Config{Unit: "pt", PageSize: gopdf.Rect{W: 595.28, H: 841.89}}) //595.28, 841.89 = A4
pdf.AddPage()
var err error
err = pdf.AddTTFFont("loma", "../ttf/Loma.ttf")
if err != nil {
log.Print(err.Error())
return
}
err = pdf.SetFont("loma", "", 14)
if err != nil {
log.Print(err.Error())
return
}
pdf.Cell(nil, "hello")
//#1 pic
pdf.Image("../imgs/gopher.jpg", 200, 50, nil)
pdf.SetX(250)
pdf.SetY(200)
pdf.Cell(nil, "gopher and gopher")
pdf.WritePdf("image.pdf")
}
from gopdf.
Related Issues (20)
- Support Image(s) From Readers HOT 2
- Emoji Support?
- feat: pdf.Pdf(pdfFile, xSize, hSize, imgRect)
- Create QRCODE using gopdf
- Adobe 110 error after generation of document HOT 1
- AddPage now duplicating previous page.
- How to create a table? HOT 3
- (Question) Total pages
- [question] how to add header/footer? HOT 2
- MultiCellWithOption vs CellWithOption behavior is different HOT 3
- Named Layers in PDF
- Referenced gofpdi version has a bug that's fixed in master.
- Crash in pdf.AddTTFFont with Roboto-Regular.ttf font file HOT 2
- How to jump to a page
- invalid memory address or nil pointer dereference for Cell HOT 3
- How to parse the HTML file to convert to PDF
- Using mm instead of Points HOT 1
- How to merge multiple PDFS and size them into a single pdf?
- how to get ttl file that support chinese charactor well?
- I currently have a PDF file without page numbers and would like to add page numbers. Can this be achieved?
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.