Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace pages or Delete and Insert pages in PDF via VB

Status
Not open for further replies.

djpula

Programmer
Dec 29, 2005
1
IT
I want create a batch in VB that delete last page in a PDF file and insert in it a page from another PDF file. I've seen I could use Replace or Delete/Insert but I don't know how to do it.
I tried with :
Dim oAcroPdDOC As New AcroPDDoc

bRET1 = oAcroPdDOC.Open(App.Path & "\XXX.pdf")
bRET2 = oAcroPdDOC.DeletePages(oAcroPdDOC.GetNumPages, oAcroPdDOC.GetNumPages)
bRET3 = oAcroPdDOC.Close
but bRET2 return a false value...
can anyone help me?
 
GetNumPages counts pages from 1, while pdDoc counts from 0, therefore use
GetNumPages -1
Similar concept with replacepages call. FYI use the pddoc object from the source insertion pdf in replace pages call.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top