Switch to multipart upload of PDF to lob, move backend to using that.
This commit is contained in:
parent
2c0aa980e7
commit
dc3cce0b8a
5 changed files with 64 additions and 51 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"flag"
|
||||
"log"
|
||||
|
|
@ -25,12 +26,21 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
if *file == "" {
|
||||
log.Printf("you must specify a file with -file")
|
||||
os.Exit(1)
|
||||
}
|
||||
content, err := os.ReadFile(*file)
|
||||
if err != nil {
|
||||
log.Printf("read file: %v", err)
|
||||
os.Exit(2)
|
||||
}
|
||||
client := lob.NewLob(key)
|
||||
ctx := context.TODO()
|
||||
req := lob.RequestLetterCreate{
|
||||
To: *to,
|
||||
From: *from,
|
||||
File: *file,
|
||||
File: bytes.NewReader(content),
|
||||
Color: *color,
|
||||
UseType: *use_type,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue