Hi! I got a trouble to merge 2 documents when the size of the pages are different.
func main() {
file1, err := os.ReadFile("test1.pdf") //page size A4
if err != nil {
panic(err)
}
file2, err := os.ReadFile("test2.pdf") //page size A3
if err != nil {
panic(err)
}
pdf := &gopdf.GoPdf{}
pdf.Start(gopdf.Config{PageSize: *gopdf.PageSizeA4})
pdf.ImportPagesFromSource(file1, "/MediaBox")
pdf.ImportPagesFromSource(file2, "/MediaBox")
err = pdf.WritePdf("test3.pdf") // page A3 is cropped
if err != nil {
panic(err)
}
}
Could you please in the method GoPdf.ImportPagesFromSource change instead of gp.AddPage() to put the next one
gp.AddPageWithOption(PageOption{
PageSize: &Rect{
W: size["w"],
H: size["h"],
},
})
Many thanks.
Hi! I got a trouble to merge 2 documents when the size of the pages are different.
Could you please in the method GoPdf.ImportPagesFromSource change instead of
gp.AddPage()to put the next oneMany thanks.