signintech / pdft

Creating PDF using existing PDF as template for GO (golang).
MIT License
264 stars 44 forks source link

Hi I can't fix this bug #7

Open pathbox opened 5 years ago

pathbox commented 5 years ago

This is my code

package main

import (
    "fmt"
    "io/ioutil"

    "github.com/signintech/pdft"
)

func main() {

    target := "out_pdf.pdf"
    pdfsource := "Bussiness.pdf"
    picPath :=  "17.jpg"

    var ipdf pdft.PDFt
    err := ipdf.Open(pdfsource)
    if err != nil {
        panic(err)
    }

    pic, err := ioutil.ReadFile(picPath)
    if err != nil {
        panic("Couldn't read pic.")
    }

    //insert image to pdf
    err = ipdf.InsertImg(pic, 1, 1.0, 1.0, 600.0, 600.0)
    if err != nil {
        panic("Couldn't insert image")
    }

    err = ipdf.Save(target)
    if err != nil {
        fmt.Println(err)
        panic("Couldn't save pdf.")
    }
}
not found /Resources in /Type/Pages
panic: Couldn't save pdf.

goroutine 1 [running]:
main.main()
    /Users/pathbox/code/learning-go/src/pdf-power/pdft-example.go:36 +0x1bf
exit status 2

Can you help me

signintech commented 5 years ago

Can you give me the pdf source file (Bussiness.pdf), so I can further check.

pathbox commented 5 years ago

@signintech Can you give me you email please? I email to you. The PDF file is a word docx file then save to PDF file with windows office 2010

oneplus1000 commented 5 years ago

oneplus1000@gmail.com