Doc Delete Function. Deletes an object previously added to the document. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

Deletes an object previously added to the document.

 

   
Syntax  

[C#]
void Delete(int id)

[Visual Basic]
Sub Delete(id As Integer)

 

   

Params
 
Name Description
id

The Object ID of the object to be deleted.

 

   

Notes
 

Use this method to delete an object previously added to the document.

Deletion is most commonly applied to pages to remove them from the document. For example to delete the current page you might use the following code:

theDoc.Delete theDoc.Page

 

   

Example
 

The following code snippet illustrates how one might add an image and then delete it if the image color space is CMYK.

[C#]
Doc theDoc = new Doc();
string thePath = Server.MapPath("../mypics/mypic.jpg");
int theID1 = theDoc.AddImageFile(thePath, 1);
int theID2 = theDoc.GetInfoInt(theID1, "XObject");
int theComps = theDoc.GetInfoInt(theID2, "Components");
if (theComps == 4) theDoc.Delete(theID1);
theDoc.Save(Server.MapPath("docdelete.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
Dim thePath As String = Server.MapPath("../mypics/mypic.jpg")
Dim theID1 As Integer = theDoc.AddImageFile(thePath, 1)
Dim theID2 As Integer = theDoc.GetInfoInt(theID1,"XObject")
Dim theComps As Integer = theDoc.GetInfoInt(theID2,"Components")
If theComps = 4 Then theDoc.Delete(theID1)
theDoc.Save(Server.MapPath("docdelete.pdf"))
theDoc.Clear()


docdelete.pdf