phpdave11 / gofpdi

Go Free PDF Document Importer
MIT License
118 stars 59 forks source link

problem to import two pdf files' page #34

Closed ghiewa closed 4 years ago

ghiewa commented 4 years ago

per check it is imported only one pdf files' page. is it a bug?

` var tp_i_page int var flag_i_page int var tp_page int var flag_page int for ....... { // FLAGxxx, like FLAG018 FLAG2 if strings.HasPrefix(fi, "FLAG") { fg, := strconv.Atoi(strings.Replace(_fi, "FLAG", "", -1))

                if flag_fil != "" && fg != flag_i_page {
                    flag_i_page = fg
                    flag_page = pdf.ImportPage(flag_fil, flag_i_page, "/MediaBox")
                    pdf.UseImportedTemplate(flag_page, PT_(_sz[0]), PT_(_sz[1]), 0, 0)
                }
                continue
            }

            // PAGExxx, like  PAGE18   PAGE2
            if strings.HasPrefix(_fi, "PAGE") {
                pg, _ := strconv.Atoi(strings.Replace(_fi, "PAGE", "", -1))
                if pg != tp_i_page {
                    tp_i_page = pg
                    tp_page = pdf.ImportPage(fil, tp_i_page, "/MediaBox")
                    log.Println(tp_page, "PAGE")
                }
            }

            pdf.UseImportedTemplate(tp_page, PT_(_sz[0]), PT_(_sz[1]), 0, 0)
        }

`

ghiewa commented 4 years ago

find similar problem. LINK

wdrai commented 4 years ago

I think you should not use pdf.UseImportedTemplate but gofpdi.UseImportedTemplate(pdf, ...)

ghiewa commented 4 years ago

I think you should not use pdf.UseImportedTemplate but gofpdi.UseImportedTemplate(pdf, ...)

I used gofpdi in gopdf