I have a problem with
splitting a PDF document after adding a watermark to it.
I am having a problem with splitting a PDF document after adding a watermark to it.
Within the application, the line below will fail after adding a watermark to the document: nRet = PXCpVB_WriteDocumentW(n1stPageDocID, txt1stPage.Text, PXCp_CreationDisposition_Overwrite, PXCp_Write_NoRelease)
The application contained the following:
If IS_DS_FAILED(nRet) Then
GetErrorString nRet, True
'Create watermark document from 1stPage document
PXCpVB_WriteDocumentW nOriginalDocID, txtWatermark.Text, PXCp_CreationDisposition_Overwrite, [color=#FF0000]PXCp_Write_Release[/color]
'MsgBox "Watermark created." & txtWatermark.Text
'Release the lock
The problem exists because an attempt to delete nOriginalDocID occured twice, which may cause highly unpredictable results. Also please note that if the function PXCpVB_WriteDocumentW fails (for example destination file is locked) the document will not be deleted, so you will likely get a memory leak.
Best solution for this case - always use PXCp_Write_NoRelease flag, and then call PXCp_Delete.