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

Free Support Forum - aspose.com

Issue while deleteing page from attached pdf

Hi, I am trying to delete 1st page of this pdf document using the following code.

Blockquote
originalDocument.getPages().delete(1);

But, it is taking too long to execute it. Screen Shot 2019-05-27 at 5.00.37 PM.png (92.3 KB)
Mai Thuy Portfolio 2018 lowRes.pdf.zip (9.3 MB)
Please find the attached document.

@divya13

Thank you for contacting support.

We have used below code snippet and are unable to notice any delay or exception as the generated PDF file has been attached for your kind reference. Mai Thuy_19.4.pdf (9.6 MB)

java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy/MM/dd HH:mm:ss:SSS"); 
String dateStart = "";
String dateStop = "";
java.util.Date d1 = null;
java.util.Date d2 = null;
dateStart = sdf.format(new java.util.Date());

Document originalDocument = new Document(dataDir + "Mai Thuy Portfolio 2018 lowRes.pdf");
originalDocument.getPages().delete(1);
originalDocument.save(dataDir + "Mai Thuy_19.4.pdf");

dateStop = sdf.format(new java.util.Date());
d1 = sdf.parse(dateStart);
d2 = sdf.parse(dateStop);
long diff = d2.getTime() - d1.getTime();
long diffSeconds = diff / 1000 % 60;
long diffMinutes = diff / (60 * 1000) % 60;
System.out.println(diffMinutes + " mins, "+ diffSeconds + " secs.");

Please ensure using Aspose.PDF for Java 19.4 in your environment and then share your kind feedback with us.