Some test text!

Hamburger Icon

Go / Guides / Split pages

Split PDF pages in Go

To split a PDF document into multiple pages.

doc := NewPDFDoc(filename)
pageNum = doc.GetPageCount()
for i := 1; i <= pageNum; i ++ {
    newDoc.InsertPages(0, doc, i, i, PDFDocE_none)
    newDoc.Save(outputPath + "_split_page_" + i + ".pdf", uint(SDFDocE_linearized))

Merge, Copy, Delete, and Rearrange PDF Pages
Full code sample which illustrates how to copy pages from one document to another, how to delete, and rearrange pages and how to use ImportPages().

Get the answers you need: Chat with us