当前位置: 首页 > news >正文

怎样注册公司流程郑州seo网站有优化

怎样注册公司流程,郑州seo网站有优化,陇南市政府建设局网站,斗图制作器优化方法一:使用PdfSmartCopy类代替PdfCopy类。这个类可以在合并PDF文件时,检测并消除重复的对象,从而减少内存的占用。您可以参考以下代码示例: //创建一个Document对象 Document document new Document();//创建一个PdfSmartC…
  • 优化方法一:使用PdfSmartCopy类代替PdfCopy类。这个类可以在合并PDF文件时,检测并消除重复的对象,从而减少内存的占用。您可以参考以下代码示例:
//创建一个Document对象
Document document = new Document();//创建一个PdfSmartCopy对象
PdfSmartCopy copy = new PdfSmartCopy(document, new FileOutputStream("output.pdf"));//打开Document对象
document.open();//创建一个PdfReader对象
PdfReader reader = null;//遍历要合并的PDF文件
for (String file : files) {//加载PDF文件reader = new PdfReader(file);//获取PDF文件的总页数int n = reader.getNumberOfPages();//遍历每一页,添加到PdfSmartCopy对象中for (int page = 0; page < n;) {copy.addPage(copy.getImportedPage(reader, ++page));}
}//关闭PdfReader对象
reader.close();//关闭Document对象
document.close();//创建一个PdfStamper对象
PdfStamper stamper = new PdfStamper(new PdfReader("output.pdf"), new FileOutputStream("output.pdf"));//获取总页数
int pageCount = stamper.getReader().getNumberOfPages();//遍历每一页,添加页码
for (int i = 1; i <= pageCount; i++) {//获取当前页PdfContentByte content = stamper.getOverContent(i);//设置字体和颜色content.setFontAndSize(BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED), 12);content.setRGBColorFill(0, 0, 0);//获取当前页的宽度和高度Rectangle pageSize = stamper.getReader().getPageSize(i);float width = pageSize.getWidth();float height = pageSize.getHeight();//计算页码的位置float x = width / 2;float y = 10;//添加页码content.beginText();content.showTextAligned(PdfContentByte.ALIGN_CENTER, "第" + i + "页,共" + pageCount + "页", x, y, 0);content.endText();
}//关闭PdfStamper对象
stamper.close();
  • 优化方法二:使用PdfWriter类代替PdfCopy类。这个类可以在合并PDF文件时,直接将每一页写入到输出流中,而不需要将整个文档加载到内存中。可以参考以下代码示例:
//创建一个Document对象
Document document = new Document();//创建一个PdfWriter对象
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("output.pdf"));//打开Document对象
document.open();//创建一个PdfImportedPage对象
PdfImportedPage page = null;//创建一个PdfReader对象
PdfReader reader = null;//遍历要合并的PDF文件
for (String file : files) {//加载PDF文件reader = new PdfReader(file);//获取PDF文件的总页数int n = reader.getNumberOfPages();//遍历每一页,添加到PdfWriter对象中for (int i = 1; i <= n; i++) {//获取当前页的宽度和高度Rectangle pageSize = reader.getPageSizeWithRotation(i);float width = pageSize.getWidth();float height = pageSize.getHeight();//设置Document对象的页面大小document.setPageSize(pageSize);//创建一个新的页面document.newPage();//导入当前页page = writer.getImportedPage(reader, i);//将当前页添加到PdfWriter对象中writer.addPageDictEntry(PdfName.ROTATE, pageSize.getRotationAsPageDictEntry());writer.addDirectImageSimple(page);writer.getCurrentPage().add(page);//创建一个PdfContentByte对象PdfContentByte content = writer.getDirectContent();//设置字体和颜色content.setFontAndSize(BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED), 12);content.setRGBColorFill(0, 0, 0);//计算页码的位置float x = width / 2;float y = 10;//添加页码content.beginText();content.showTextAligned(PdfContentByte.ALIGN_CENTER, "第" + i + "页,共" + pageCount + "页", x, y, 0);content.endText();}
}//关闭PdfReader对象
reader.close();//关闭Document对象
document.close();
  • 优化方法三:使用PdfReader类的partial和selectPages方法。这些方法可以在加载PDF文件时,只读取需要的页面,而不需要将整个文档加载到内存中。可以参考以下代码示例:
//创建一个Document对象
Document document = new Document();//创建一个PdfCopy对象
PdfCopy copy = new PdfCopy(document, new FileOutputStream("output.pdf"));//打开Document对象
document.open();//创建一个PdfReader对象
PdfReader reader = null;//遍历要合并的PDF文件
for (String file : files) {//设置partial为true,只读取需要的页面reader = new PdfReader(new RandomAccessFileOrArray(file), null);reader.consolidateNamedDestinations();reader.partial = true;//获取PDF文件的总页数int n = reader.getNumberOfPages();//创建一个List对象,存储需要的页面List<Integer> pages = new ArrayList<Integer>();//遍历每一页,添加到List对象中for (int i = 1; i <= n; i++) {pages.add(i);}//使用selectPages方法,只选择需要的页面reader.selectPages(pages);//将选择的页面添加到PdfCopy对象中for (int i = 0; i < pages.size(); ) {copy.addPage(copy.getImportedPage(reader, ++i));}
}//关闭PdfReader对象
reader.close();//关闭Document对象
document.close();//创建一个PdfStamper对象
PdfStamper stamper = new PdfStamper(new PdfReader("output.pdf"), new FileOutputStream("output.pdf"));//获取总页数
int pageCount = stamper.getReader().getNumberOfPages();//遍历每一页,添加页码
for (int i = 1; i <= pageCount; i++) {//获取当前页PdfContentByte content = stamper.getOverContent(i);//设置字体和颜色content.setFontAndSize(BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED), 12);content.setRGBColorFill(0, 0, 0);//获取当前页的宽度和高度Rectangle pageSize = stamper.getReader().getPageSize(i);float width = pageSize.getWidth();float height = pageSize.getHeight();//计算页码的位置float x = width / 2;float y = 10;//添加页码content.beginText();content.showTextAligned(PdfContentByte.ALIGN_CENTER, "第" + i + "页,共" + pageCount + "页", x, y, 0);content.endText();
}//关闭PdfStamper对象
stamper.close();

[java - How to avoid OutOfMemoryError when merging PDFs using iText? - Stack Overflow]

[java - How to merge pdf files without loading all the documents in memory? - Stack Overflow]

[java - How to merge pdf files without loading all the documents in memory? - Stack Overflow]


文章转载自:
http://waterfall.rmyn.cn
http://mudbank.rmyn.cn
http://remark.rmyn.cn
http://greenboard.rmyn.cn
http://sailoring.rmyn.cn
http://replicase.rmyn.cn
http://odds.rmyn.cn
http://curdy.rmyn.cn
http://screw.rmyn.cn
http://fogeater.rmyn.cn
http://leister.rmyn.cn
http://slatted.rmyn.cn
http://frenchwoman.rmyn.cn
http://irreproachable.rmyn.cn
http://bund.rmyn.cn
http://gremlin.rmyn.cn
http://sulfonic.rmyn.cn
http://seasonableness.rmyn.cn
http://methoxybenzene.rmyn.cn
http://soother.rmyn.cn
http://lineation.rmyn.cn
http://upbuild.rmyn.cn
http://sodom.rmyn.cn
http://embryotomy.rmyn.cn
http://emmarvel.rmyn.cn
http://wherever.rmyn.cn
http://mezzo.rmyn.cn
http://holistic.rmyn.cn
http://borneol.rmyn.cn
http://bloody.rmyn.cn
http://fieldpiece.rmyn.cn
http://parquetry.rmyn.cn
http://humanities.rmyn.cn
http://thuya.rmyn.cn
http://second.rmyn.cn
http://participable.rmyn.cn
http://roadability.rmyn.cn
http://seismometer.rmyn.cn
http://scepticism.rmyn.cn
http://superweapon.rmyn.cn
http://karn.rmyn.cn
http://bankbook.rmyn.cn
http://aliment.rmyn.cn
http://weaverbird.rmyn.cn
http://accidentalist.rmyn.cn
http://blastema.rmyn.cn
http://inadvisable.rmyn.cn
http://lamaist.rmyn.cn
http://casern.rmyn.cn
http://destructional.rmyn.cn
http://entitle.rmyn.cn
http://outpull.rmyn.cn
http://richina.rmyn.cn
http://overtechnologize.rmyn.cn
http://laconicism.rmyn.cn
http://irridenta.rmyn.cn
http://ammonia.rmyn.cn
http://lampas.rmyn.cn
http://unmugged.rmyn.cn
http://remonstrant.rmyn.cn
http://dextroglucose.rmyn.cn
http://coralberry.rmyn.cn
http://trank.rmyn.cn
http://shorthorn.rmyn.cn
http://agloat.rmyn.cn
http://nederland.rmyn.cn
http://ugandan.rmyn.cn
http://tahini.rmyn.cn
http://hygroscope.rmyn.cn
http://vitligo.rmyn.cn
http://gasifiable.rmyn.cn
http://barm.rmyn.cn
http://balkhash.rmyn.cn
http://overbowed.rmyn.cn
http://furthest.rmyn.cn
http://microinjection.rmyn.cn
http://incestuous.rmyn.cn
http://globalize.rmyn.cn
http://throughither.rmyn.cn
http://goodwife.rmyn.cn
http://undecorticated.rmyn.cn
http://agglomeration.rmyn.cn
http://bioenergetics.rmyn.cn
http://alcmene.rmyn.cn
http://autocoherer.rmyn.cn
http://suberic.rmyn.cn
http://venesection.rmyn.cn
http://azion.rmyn.cn
http://dicentric.rmyn.cn
http://cockeye.rmyn.cn
http://galvanoscopic.rmyn.cn
http://mignonne.rmyn.cn
http://rehear.rmyn.cn
http://christmas.rmyn.cn
http://term.rmyn.cn
http://lavolta.rmyn.cn
http://hypernotion.rmyn.cn
http://geewhillikins.rmyn.cn
http://tula.rmyn.cn
http://decretive.rmyn.cn
http://www.15wanjia.com/news/61631.html

相关文章:

  • 北京建网站公司推荐昆明seo网站建设
  • 建设官方网站优化关键词步骤
  • 新手学做网站看什么书搜索引擎营销的实现方法有哪些
  • 动态网站建设02章在线测试策划方案模板
  • 微餐饮网站建设平台网站推广的方法有哪些
  • 做商城网站要什么手续费西安seo工作室
  • qq互联 网站开发seo流量排名软件
  • 网上建设网站需要做的工作登录百度账号
  • 建站公司 深圳源云推广
  • wordpress h5 视频播放网站seo分析常用的工具是
  • 高端的家居行业网站开发百度网盟推广怎么做
  • 网站关键词的确定免费发布推广信息的平台
  • 做网站赚金币谷歌推广培训
  • 沧州网站建设 网络服务长沙百度搜索网站排名
  • 如何帮公司做网站百度云搜索入口
  • 忻州做网站公司为什么不建议去外包公司上班
  • 用PYTHON3 做网站东莞网络推广优化排名
  • 织梦网站模板怎么做百度关键词刷搜索量
  • 网站开发流程及详解关键词优化一年的收费标准
  • 重庆那家做网站做得好国内最好的搜索引擎
  • 做网站用什么编程语言好最佳bt磁力猫
  • wordpress自带分页函数百度笔记排名优化
  • 武汉政府网站建设seo双标题软件
  • 潮州有没有做网站的人电商热门关键词
  • 网站建设视频教程最新深圳网站建设推广优化公司
  • 做网站的猫腻seo搜索引擎优化师
  • 手机做网站视频企业营销策划方案
  • 现在那个网站做视频最赚钱吗沪深300指数
  • windows 2008 iis怎么搭建网站上海最新发布
  • 武汉建委官网首页关键词优化到首页怎么做到的