New Forum | Previous | Next | (P-PDF) Developers
Topic: How can I crop part of a document
Conf: (P-PDF) Developers, Msg: 78287
Date: 12/17/2002 03:31 AM
I'm working with Acrobat SDK in a Visual Basic project.
I need to select part of the PDF document and create a new page with the selected section.
I'm using CropPage function of CAcroPDPage object and my code is as follows:
Private Sub CropDocument()
Dim acroPage As CAcroPDPage, acroRect As CAcroRect
' set page object
Set acroPage = acrPDF(1).AcquirePage(1)
' set rect object
Set acroRect = CreateObject("AcroExch.rect")
acroRect.Top = 100
acroRect.Bottom = 1000
acroRect.Left = 100
acroRect.Right = 1000
' crop document
If acroPage.CropPage(acroRect) > 0 Then
MsgBox "Page cropped correctly."
MsgBox "Page not cropped."
I keep getting the message "Page not cropped." with the returned value of CropPage function always set to -1.
Could you please tell me where is my code failing? Or is there another instruction to add to make the function work properly?
Thanks in advance