The page is replaced by using the page for which it is specified from source PDF document with specification PDF document.
It doesn’t operate in Acrobat Reader.
|Full path in updated PDF file. It is necessary already to be opened by the Acrobat application.|
|Beginning page of replacement of PDF file specified by the first argument.|
|Full path file name of source PDF file. This file doesn’t have the necessity that has been opened.|
|Replacement beginning page number of source PDF file origin.|
|Replacement end page number of source PDF file origin.|
|true||The pages are replaced successfully.|
Notes: The return value cannot be acquired with DDE of VBA of Excel.
Sample: VBA of Excel
Page 3 on page 1 of ‘E:\Test02.pdf’ on the second page of ‘E:\Test01.pdf’ is replaced.
- Please confirm the test by the step execution with F8 key.
Dim lChanNo As Long ‘DDE channel number
‘A double quotation mark is added for blank starting full path.
Const CON_PDF_PATH = “””E:\Test01.pdf”””
‘The Acrobat application is Started.
‘Shell “C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe”
Shell “C:\Program Files\Adobe\Acrobat 8.0\Acrobat\Acrobat.exe”
‘Open of DDE channel
lChanNo = DDEInitiate(“Acroview”, “Control”)
‘Open of PDF file
DDEExecute lChanNo, “[DocOpen(“ & CON_PDF_PATH & “)]”
‘Page 3 on page 1 of ‘E:\Test02.pdf’ on the second page of ‘E:\Test01.pdf’ is replaced.
DDEExecute lChanNo, “[DocReplacePages(“ & _
CON_PDF_PATH & “,2,E:\Test02.pdf,1,3)]”
‘Saves an the PDF file to a new path. Note) Optimization is done.
DDEExecute lChanNo, “[DocSaveAs(“ & _
CON_PDF_PATH & “,E:\test03.pdf)]”
‘The Acrobat applicaton is ended..
‘If this is not done, the Acrobat process remains.
DDEExecute lChanNo, “[AppExit()]”
‘The DDE channel is shut.
It is a result of the comparison on page thumbnail screen of Acrobat.
The content of 3, 4, and page 5 has changed places.
- It doesn’t operate in Acrobat Reader.
Environment to confirm the operation
- WindowsXP + SP3 + WindowsUpdate
- Adobe Acrobat Pro 8.1.4 + Office Pro 2003
- Adobe Acrobat Pro 9.1.0 + Office Pro 2003