2024年小升初教材变更了,但是书店买不到新教材,看到网上有电子版教材,就写了个方法将教材图片来取下来并生成PDF文档,这样方便打印学习了。在此处记录一下方法。
第一步:使用jsoup工具类抓取网页中的图片并保存本地:
可能有些无用的广告图片也一并抓取了下来,手动删除无用的图片;
第二步:使用itextpdf工具类生成PDF文档:
使用maven引入itextpdf的jar包:
将图片按照顺序生成PDF文档:
简单的两步就可以将网络上的电子版教材下载生成PDF文档了,然后打印出来给孩子学习。完美!!!