Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

java - Remove page from PDF

I'm currently using iText and I'm wondering if there is a way to delete a page from a PDF file?

I have opened it up with a reader etc., and I want to remove a page before it is then saved back to a new file; how can I do that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The 'better' way to 'delete' pages is doing

reader.selectPages("1-5,10-12");

Which means we only select pages 1-5, 10-12 effectively 'deleting' pages 6-9.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...