Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Para eliminar las tablas, necesitamos usar la clase TableAbsorber para obtener las tablas en el PDF existente y luego llamar a Remove.
El siguiente fragmento de código también funciona con la biblioteca Aspose.PDF.Drawing.
Hemos agregado una nueva función, es decir, Remove() a la clase TableAbsorber existente para eliminar la tabla del documento PDF. Una vez que el absorbedor encuentra con éxito tablas en la página, se vuelve capaz de eliminarlas. Consulte el siguiente fragmento de código que muestra cómo eliminar una tabla de un documento PDF:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void RemoveTable()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Tables();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "Table_input.pdf"))
{
// Create TableAbsorber object to find tables
var absorber = new Aspose.Pdf.Text.TableAbsorber();
// Visit first page with absorber
absorber.Visit(document.Pages[1]);
// Get first table on the page
Aspose.Pdf.Text.AbsorbedTable table = absorber.TableList[0];
// Remove the table
absorber.Remove(table);
// Save PDF document
document.Save(dataDir + "RemoveTable_out.pdf");
}
}
A veces, un documento PDF puede contener más de una tabla y puede surgir la necesidad de eliminar múltiples tablas de él. Para eliminar múltiples tablas de un documento PDF, utilice el siguiente fragmento de código:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void RemoveMultipleTables()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Tables();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "Table_input2.pdf"))
{
// Create TableAbsorber object to find tables
var absorber = new Aspose.Pdf.Text.TableAbsorber();
// Visit second page with absorber
absorber.Visit(document.Pages[1]);
// Get copy of table collection
Aspose.Pdf.Text.AbsorbedTable[] tables = new Aspose.Pdf.Text.AbsorbedTable[absorber.TableList.Count];
absorber.TableList.CopyTo(tables, 0);
// Loop through the copy of collection and removing tables
foreach (var table in tables)
{
absorber.Remove(table);
}
// Save PDF document
document.Save(dataDir + "RemoveMultipleTables_out.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.