原創|產品更新|編輯:李顯亮|2020-05-15 09:55:53.100|閱讀 305 次
概述:PDF文件格式轉換處理控件Spire.PDF Java和.NET版5月同步更新,一起來看看有哪些新增功能吧!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
近日,我們更新了.NET平臺Spire.PDF v6.5.6 2020年5月更新,該版本支持添加和轉換SVG圖片到PDF,并修復了將PDF轉換為Word、提取文本以及填充TextBoxField時出現的一些問題。
與此同時Java平臺Spire.PDF迎來了5月的又一次更新,該版本支持PDF簽名添加時間戳、設置在PDF頁面是否顯示簽名信息以及繪制箭頭、云朵、橢圓、矩形和連接線條形狀等標記。另外,也修復了在提取PDF中的文本、將PDF轉為圖片時出現的一些問題,具體更新情況如下:
Spire.PDF For .NET更新內容
新功能
PdfDocument doc1 = new PdfDocument(); doc1.LoadFromSvg(inputFile_svg); PdfDocument doc2 = new PdfDocument(); doc2.LoadFromFile(inputFile_pdf); PdfTemplate template = doc1.Pages[0].CreateTemplate(); template.Draw(doc2.Pages[0].Canvas, new PointF()); doc2.SaveToFile(outputFile, FileFormat.PDF);
PdfDocument doc = new PdfDocument(); doc.LoadFromSvg("test.svg"); doc.SaveToFile("result.pdf", FileFormat.PDF);
Bug修復
Spire.PDF For Java更新內容
新功能
//配置時間戳服務器 String url = "http://freetsa.org/tsr"; signature.configureTimestamp(url);
signature.addShowConfigureText(SignatureConfigureText.Contact_Info);//顯示Contact_Info(默認顯示所有) signature.removeShowConfigureText(SignatureConfigureText.Contact_Info);//不顯示Contact_Info signature.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");
for (PdfPageBase page : (Iterable) doc.getPages()) { content.append(page.extractText(true,true,true)); }
Bug修復
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn