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.
Syntax
[DocReplacePages(char* fullPath,
long startDestPage,
char* sourcePath,
long startSourcePage,
long endSourcePage)]
Argument
fullPath [char*] |
Full path in updated PDF file. It is necessary already to be opened by the Acrobat application. |
startDestPage [long] |
Beginning page of replacement of PDF file specified by the first argument. |
sourcePath [char*] |
Full path file name of source PDF file. This file doesn’t have the necessity that has been opened. |
startSourcePage [long] |
Replacement beginning page number of source PDF file origin. |
endSourcePage [long] |
Replacement end page number of source PDF file origin. |
Returns
true | The pages are replaced successfully. |
false | Otherwise. |
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.
Sub DDE_DocReplacePages()
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.
DDETerminate lChanNo
End Sub
Execution result
It is a result of the comparison on page thumbnail screen of Acrobat.
The content of 3, 4, and page 5 has changed places.
Before |
After |
DocReplacePages(Before) |
] DocReplacePages(Aftrer) |
Remarks
- 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