Hi,
A response to this post was this link
https://sdkhelp.pdf-xchange.com/vi ... ts_flatten.
But how can I open a PDF from a filepath, flatten it and save the file. Is this possible in PDFXedit?
If possible can you provide the code , I need to accomplish something similar to this.
Dim doc As PDFXEdit.IPXV_Document = Nothing
Dim strPDFFileName As String = String.Empty
Dim pSInt As PDFXEdit.IPXS_Inst
Dim inst As PDFXEdit.PXV_Inst
Dim pagesCnt, i, j As UInt64
Dim annot As PDFXEdit.IPXC_Annotation
Dim page As PDFXEdit.IPXC_Page
Dim nSquareAtom As UInteger
Dim annotsCnt As UInteger
Dim nID As Integer
Dim op As PDFXEdit.IOperation
Dim input As PDFXEdit.ICabNode
Dim options As PDFXEdit.ICabNode
Try
strPDFFileName = "C:\Files\samplefile.pdf"
oPDFCtrl.OpenDocFromPath(strPDFFileName)
doc = oPDFCtrl.Inst.Doc(0)
inst = New PDFXEdit.PXV_Inst
pSInt = inst.GetExtension("PXS")
nSquareAtom = pSInt.StrToAtom("Square")
nID = inst.Str2ID("op.annots.flatten", False)
op = inst.CreateOp(nID)
input = op.Params.Root("Input")
inst.ShowOpenFilesDlg()
pagesCnt = doc.CoreDoc.Pages.Count
For i = 0 To pagesCnt
page = doc.CoreDoc.Pages(i)
annotsCnt = page.GetAnnotsCount()
For j = 0 To annotsCnt
annot = page.GetAnnot(j)
If (annot.Type = nSquareAtom) Then
input.Add().v = annot
End If
Next
Next
options = op.Params.Root("Options")
options("NonPrintableAction").v = "Flatten"
options("FieldsAction").v = "LeftAsIs".
op.Do()
Catch ex As Exception
Throw
End Try
End Sub
Thanks,