Java版企业级文档开发套包Spire.Office v3.5.0全新上线!PDF控件新增4大新功能

Spire.Office for Java v3.5.0已正式发布。该版本带来了一些不错的新功能,例如,Spire.PDF支持数字签名时添加时间戳,支持各种形状的注释框到PDF;Spire.Presetation 支持获取形状中文本输入区域的最大宽度。

你在寻找支持在Java中用编程方法处理各类格式文档的API吗巧,Java版企业级文档管理组合套包Spire.Office 2020全新上线!Word、Excel、PPT、PDF、条形码等格式一网打尽。

目前,

新功能及问题修复详情,请参阅如下内容。


Spire.PDF for Java()

新功能

  • 支持PDF签名添加时间戳
    //配置时间戳服务器String url = "https://freetsa.org/tsr";signature.configureTimestamp(url);
  • 支持设置在PDF页面上显示/不显示签名信息
    signature.addShowConfigureText(SignatureConfigureText.Contact_Info);//显示Contact_Info(默认显示所有)signature.removeShowConfigureText(SignatureConfigureText.Contact_Info);//不显示Contact_Infosignature.setShowConfigureText(EnumSet.of(SignatureConfigureText.Contact_Info));//只显示Contact_Info
  • 支持创建箭头、云朵、椭圆、矩形和连接线条形状的标记
    PdfDocument pdf = new PdfDocument();PdfPageBase page = pdf.getPages().add();//箭头String text1 = "this is Arrow annotation";PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 20);PdfSolidBrush brush1 = new PdfSolidBrush(new PdfRGBColor(Color.blue));PdfStringFormat leftAlignment = new PdfStringFormat(PdfTextAlignment.Left, PdfVerticalAlignment.Middle);page.getCanvas().drawString(text1, font, brush1, 50, 50, leftAlignment);Dimension2D dimension = font.measureString(text1);Rectangle2D.Float bounds = new Rectangle2D.Float(50, 50, (float) dimension.getWidth(), (float) dimension.getHeight());int[] linePoints = new int[]{92, (int) (page.getSize().getHeight() - bounds.getY() - 60),        (int) (92 + bounds.getWidth()), (int) (page.getSize().getHeight() - bounds.getY() - 60)};PdfLineAnnotation annotation1 = new PdfLineAnnotation(linePoints, "LineArrow annotation test");annotation1.setBeginLineStyle(PdfLineEndingStyle.OpenArrow);annotation1.setEndLineStyle(PdfLineEndingStyle.OpenArrow);annotation1.setBackColor(new PdfRGBColor(Color.red));annotation1.setCaptionType(PdfLineCaptionType.Inline);annotation1.setLineCaption(true);((PdfNewPage) page).getAnnotations().add(annotation1);//云朵String text2 = "this is Cloud annotation";PdfBrush brush2 = PdfBrushes.getBlue();page.getCanvas().drawString(text2, font, brush2, 50, 200);Point2D point2D[] = new Point2D[]{        new Point2D.Float(30, 200),        new Point2D.Float(300, 180),        new Point2D.Float(300, 250),        new Point2D.Float(30, 220),        new Point2D.Float(30, 200)};PdfPolygonAnnotation annotation2 = new PdfPolygonAnnotation(page, point2D);annotation2.setText("PolygonCloud annotation test");annotation2.setAuthor("E-iceblue");annotation2.setSubject("test");annotation2.setModifiedDate(new Date());annotation2.setBorderEffect(PdfBorderEffect.Big_Cloud);annotation2.setLocation(new Point2D.Float(190, 230));annotation2.setColor(new PdfRGBColor(Color.GRAY));((PdfNewPage) page).getAnnotations().add(annotation2);//椭圆String text3 = "this is Circle annotation";PdfBrush brush3 = PdfBrushes.getBlue();Dimension2D dimension2D = font.measureString(text3);dimension2D.setSize(dimension2D.getWidth() + 35, dimension2D.getHeight() + 20);page.getCanvas().drawString(text3, font, brush3, 50, 300);Rectangle2D.Float annotationBounds1 = new Rectangle2D.Float();annotationBounds1.setFrame(new Point2D.Float(36, (float) 290), dimension2D);PdfSquareAndCircleAnnotation annotation3 = new PdfSquareAndCircleAnnotation(annotationBounds1);annotation3.setSubType(PdfSquareAndCircleAnnotationType.Circle);float[] f1 = {0.5f, 0.5f, 0.5f, 0.5f};annotation3.setRectangularDifferenceArray(f1);annotation3.setText("Circle annotation test");annotation3.setColor(new PdfRGBColor(Color.RED));annotation3.setModifiedDate(new Date());annotation3.setName("*****");LineBorder border1 = new LineBorder();border1.setBorderWidth(2);annotation3.setLineBorder(border1);((PdfNewPage) page).getAnnotations().add(annotation3);//矩形String text4 = "this is Square annotation";PdfBrush brush4 = PdfBrushes.getBlue();Dimension2D dimension4 = font.measureString(text4);dimension2D.setSize(dimension2D.getWidth() + 80, dimension2D.getHeight() + 20);page.getCanvas().drawString(text4, font, brush4, 50, 400);Rectangle2D.Float annotationBounds2 = new Rectangle2D.Float();annotationBounds2.setFrame(new Point2D.Float(30, (float) 400), dimension4);PdfSquareAndCircleAnnotation annotation4 = new PdfSquareAndCircleAnnotation(annotationBounds2);annotation4.setSubType(PdfSquareAndCircleAnnotationType.Square);float[] f2 = {0.5f, 0.5f, 0.5f, 0.5f};annotation4.setRectangularDifferenceArray(f2);annotation4.setText("Square annotation test");annotation4.setColor(new PdfRGBColor(Color.RED));annotation4.setModifiedDate(new Date());annotation4.setName("*****");LineBorder border2 = new LineBorder();border2.setBorderWidth(2);annotation4.setLineBorder(border2);((PdfNewPage) page).getAnnotations().add(annotation4);//连接线String text5 = "this is Connected lines annotation";PdfBrush brush5 = PdfBrushes.getBlue();page.getCanvas().drawString(text5, font, brush5, 50, 465);Point2D pointzd[] = new Point2D[]{        new Point2D.Float(30, 470),        new Point2D.Float(300, 450),        new Point2D.Float(300, 520),        new Point2D.Float(30, 490),        new Point2D.Float(30, 470)};PdfPolygonAnnotation annotation5 = new PdfPolygonAnnotation(page, pointzd);annotation5.setText("Connected Lines annotation test");annotation5.setAuthor("冰蓝");annotation5.setSubject("test");annotation5.setModifiedDate(new Date());annotation5.setBorderEffect(PdfBorderEffect.None);annotation5.setLocation(new Point2D.Float(190, 230));annotation5.setColor(new PdfRGBColor(Color.GRAY));((PdfNewPage) page).getAnnotations().add(annotation5);pdf.saveToFile("output/annotation.pdf");
  • 新增 optimizingTextLine 和 optimizingGridText参数优化从PDF页面提取表格文本时的文本格式
    for (PdfPageBase page : (Iterable) doc.getPages()) {    content.append(page.extractText(true,true,true));}

Bug修复

  • 修复了提取文本时,空格与源文档不一致的问题
  • 修复了设置“setCertificated(true)”不生效的问题
  • 修复了提取表格文本时,存在多余的空行的问题
  • 修复了调用“dispose()”方法后,“File.delete()”方法无法删除文件的问题
  • 优化了PDF转换到图片耗时较长的问题

Spire.Presentation for Java()

新功能

支持获取形状中文本输入区域宽度最大时文本的起始坐标

IAutoShape shape = (IAutoShape) ppt.getSlides().get(0).getShapes().get(0);double x = shape.getTextFrame().getStartLocationAtMaxWidth().getX();double y = shape.getTextFrame().getStartLocationAtMaxWidth().getY();

支持获取形状中文本输入区域的最大宽度

IAutoShape shape = (IAutoShape) ppt.getSlides().get(0).getShapes().get(0);float maxWidth = shape.getTextFrame().getMaxWidth();

Bug修复

  • 修复了在CentOS中转换PPTX文档到图片,白色文本变成黑色的问题
  • 修复了”getColor()”方法获取到的表格单元格文本颜色错误的问题
  • 修复了“shape.IsTextBox()”方法返回值不正确的问题
  • 修复了加载文档时抛异常“未将对象引用设置到对象的实例”的问题
  • 修复了设置图表的数据表边框后未正确显示的问题

Spire.Doc for Java()

Bug修复

  • 修复了加载文档抛出的Unknown format异常。
  • 修复了加载文档抛出的IndexOutOfBoundsException异常。
  • 修复了加载文档抛出的NullPointerException异常。
  • 修复了加载文档抛出的IllegalStateException异常。
  • 修复了加载文档抛出的ArrayIndexOutOfBoundsException异常。
  • 修复了加载文档抛出的No have this value 5异常。
  • 修复了进行更新目录域报错Input string was not in the correct format。
  • 修复了进行更新目录域报错StackOverflowError。
  • 修复了转换HTML到Word文档格式不正确的问题。
  • 修复了移除分节符保存文档抛出的NullPointerException异常。
  • 修复了公式域更新不正确的问题。


还想要更多吗可以点击阅读【2019 · E-iceblue最新资源整合】查找需要的教程资源。如果您有任何疑问或需求,请随时联系客服,我们很高兴为您提供查询和咨询
标签:

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年4月24日
下一篇 2020年4月24日

相关推荐

发表回复

登录后才能评论