We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Remove lines- underline- borders in PDF to word

Hi,

How can we remove lines from PDF before conversion to word because these lines don’t get translated correctly.

Example :

Education ________
Experience ________

Can I remove the underline in underlined text. And also turn off borders in the page ?

Please help.

Thanks
Aish

Hi Aish,


Thanks for your inquiry. I am afraid Aspose.Pdf for Java doesn’t support to remove lines (lines, underlines and borders in PDF. We have logged your request as PDFNEWJAVA-34004 for further investigation and resolution. We will keep you updated about the issue resolution progress via this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

Hi Aish,


Thanks for your patience. We have investigated the issue and would like to suggest following code to remove lines, underlines and broders from PDF document, it will help you to accomplish the task.

Document document = new Document(myDir + “in.pdf”);<o:p></o:p>

OperatorCollection pageOperators = document.getPages().get_Item(1).getContents();

/**

* selection and delete operators drawing line

*/

for (int i = 1; i < pageOperators.size()-3; i++)

{

System.out.println(i);

Operator op = pageOperators.get_Item(i);

Operator nextOperator = pageOperators.get_Item(op.getIndex() + 1);

Operator afterNextOperator = pageOperators.get_Item(op.getIndex() + 2);

Operator operatorAfterNextOperator = pageOperators.get_Item(op.getIndex() + 3);

//selection and delete operators drawing single lines

//but we should not delete single rectangles

//we should to check two templates for line creation

if (op instanceof Operator.MoveTo && nextOperator instanceof Operator.LineTo && !(afterNextOperator instanceof Operator.LineTo))

{

{

pageOperators.delete(new Operator[]

{

nextOperator

});

}

}else if (op instanceof Operator.MoveTo && nextOperator instanceof Operator.LineTo && afterNextOperator instanceof Operator.LineTo

&& !(operatorAfterNextOperator instanceof Operator.LineTo)

&& ((Operator.MoveTo) op).getX() == ((Operator.LineTo) nextOperator).getX()

&& ((Operator.MoveTo) op).getY() == ((Operator.LineTo) nextOperator).getY())

{

pageOperators.delete(new Operator[]

{

nextOperator

});

pageOperators.delete(new Operator[]

{

afterNextOperator

});

}

}

document.save(myDir + "out.pdf");


Best Regards