I am trying to use PXCp_PlaceContents from VB6, the demo VB project does not contain a declaration for this function, so here I created one (not sure if it is correct):
Code: Select all
'For Document Overlay
Public Declare Function PXCp_PlaceContents Lib "xcpro35" (ByVal destDoc As Long, ByVal sourceDoc As Long, ByVal OverLayCount As Long, ByRef placeInfo As PXCp_ContentPlaceInfo)
Type PXCp_ContentPlaceInfo
DestPage As Long
SrcPage As Long
Alignment As PXCp_ContentPlaceInfo_Allignment
End Type
Enum PXCp_ContentPlaceInfo_Allignment
CPA_HorLeft = &H0 'Align placed content to the left.
CPA_HorCenter = &H1 'Center placed content.
CPA_HorRigth = &H2 'Align placed content to the right.
CPA_HorFit = &H3 'Fit source page width to destination page width.
CPA_VerBottom = &H0 'Align placed content to the bottom.
CPA_VerCenter = &H10 'Center placed content.
CPA_VerTop = &H20 'Align placed content to the top.
CPA_VerFit = &H30 'Fit source page height to destination page height.
CPA_Foreground = &H100 'Place source page content as foreground if set, otherwise placed as background
CPA_KeepAspect = &H200 'Keep source page aspect ratio.
End Enum
Code: Select all
Private mSource As Long
Private mDestination As Long
Private Sub Command1_Click()
Dim lReturn As Long
lReturn = PXCp_Init(mSource, g_initstr, g_initDevCode)
lReturn = PXCpVB_ReadDocumentW(mSource, "d:\z_Temp\WaterMark1.pdf", 0)
lReturn = PXCp_Init(mDestination, g_initstr, g_initDevCode)
lReturn = PXCpVB_ReadDocumentW(mDestination, "d:\z_Temp\WaterMark2.pdf", 0)
Dim lTemp As PXCp_ContentPlaceInfo
lTemp.SrcPage = 1
lTemp.DestPage = 1
lTemp.Alignment = CPA_HorFit Or CPA_VerFit
lReturn = PXCp_PlaceContents(mDestination, mSource, 1, lTemp)
If IS_DS_SUCCESSFUL(lReturn) Then
lReturn = PXCpVB_WriteDocumentW(mDestination, "d:\z_Temp\output.pdf", PXCp_CreationDisposition_Overwrite, PXCp_Write_Release)
Else
lReturn = PXCp_Delete(mDestination)
End If
lReturn = PXCp_Delete(mSource)
End Sub
I have also attached the 2 source PDF files (they are very simple PDF files with only 1 page each). I also tested doing an overlay with Adobe Acrobat to make sure it works between the two files.
Thanks
Mark