Spire.PDF for Android via Java 9.7.1 已发布。该版本新增支持转换 PDF 为 PPTX 以及压缩图片。该版本还更改了获取元数据的方式。此外,本次更新还包含问题修复。详情请阅读以下内容。
新功能:
String input = "data/JavaPDFSample_1.pdf";
String output = "output/toPPTX.pptx";
//Load a pdf document
PdfDocument doc = new PdfDocument();
doc.loadFromFile(input);
//Convert to pptx file.
doc.saveToFile(output, FileFormat.PPTX);
doc.close();PdfCompressor compressor = new PdfCompressor(inputFile);
compressor.getOptions().getImageCompressionOptions().setCompressImage(true);
compressor.getOptions().getImageCompressionOptions().setResizeImages(true);
compressor.getOptions().getImageCompressionOptions().setImageQuality(ImageQuality.High);
compressor.compressToFile(outputFile);PdfDocument doc = new PdfDocument();
doc.loadFromFile(inputFile);
StringBuilder builder = new StringBuilder();
builder.append("Author:" + doc.getDocumentInformation().getAuthor() + "\r\n");
builder.append("Title: " + doc.getDocumentInformation().getTitle() + "\r\n");
builder.append("Creation Date: " + doc.getDocumentInformation().getCreationDate() + "\r\n");
builder.append("Subject: " + doc.getDocumentInformation().getSubject() + "\r\n");
builder.append("Producer: " + doc.getDocumentInformation().getProducer() + "\r\n");
builder.append("Creator: " + doc.getDocumentInformation().getCreator() + "\r\n");
builder.append("Keywords: " + doc.getDocumentInformation().getKeywords() + "\r\n");
builder.append("Modify Date: " + doc.getDocumentInformation().getModificationDate() + "\r\n");
builder.append("Customed Property's value: " + doc.getDocumentInformation().getCustomProperty("Field1"));
FileWriter fw = new FileWriter(new File(outputFile), true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(builder.toString());
bw.flush();
bw.close();
fw.close();问题修复:
https://www.e-iceblue.cn/Downloads/pdf-for-android-via-java.html
Spire.Presentation for .NET 8.7.2已发布。本次更新新增了用于重置文档转换默认字体列表的方法,还新增了用于设置在转换pdf或者图片等格式并且系统未安装文档需要的字体时优先使用的字体的方法。同时,该版本还增强了PPT文档到图片的转换。此外,一些已知问题也在该版本中被成功修复,如修复了操作图表数据后结果文件打开失败的问题。详情请阅读以下内容。
新功能:
presentation.setDefaultFontName("华文行楷");presentation.resetDefaultFontName();问题修复:
https://www.e-iceblue.cn/Downloads/Spire-Presentation-NET.html
Spire.PDF 9.7.14 已发布。本次更新新增支持在将 PDF 转换为 Word 时保留相同的字体名字以及在加密 PDF 文档时使用新接口设置加密选项。本次更新还增强了 PDF 到图片的转换功能。此外,一些已知问题也在本次更新中被修复,如文件添加水印时获得的 PDF 页数不正确的问题。详情请阅读以下内容。
新功能:
PdfDocument doc = new PdfDocument();
//Add a new page
PdfPageBase page = doc.Pages.Add();
PdfGrid grid = new PdfGrid();
grid.Columns.Add(1);
PdfGridRow headerRow1 = grid.Headers.Add(1)[0];
//HEADER WITHOUT UNCICODE SUPPORT BUT VALID WORD FONT
headerRow1.Style.Font = new PdfTrueTypeFont(new Font("Arial", 11f, FontStyle.Regular), true);
headerRow1.Cells[0].Value = "Spire.PDF for .NET";
headerRow1.Cells[0].StringFormat = new PdfStringFormat(PdfTextAlignment.Center, PdfVerticalAlignment.Middle);
grid.Draw(page, new PointF(0, 10));
//Save the document to stream
MemoryStream stream = new MemoryStream();
doc.SaveToStream(stream, FileFormat.PDF);
stream.Position = 0L;
PdfToWordConverter converter = new PdfToWordConverter(stream);
converter.SaveToDocx(@"out.docx");PdfDocument doc = new PdfDocument();
doc.LoadFromFile(@"in.pdf");
PdfSecurityPolicy securityPolicy = new PdfPasswordSecurityPolicy(userPassword, ownerPassword);
securityPolicy.EncryptMetadata = false;
securityPolicy.EncryptionAlgorithm = PdfEncryptionAlgorithm.AES_128;
securityPolicy.DocumentPrivilege = PdfDocumentPrivilege.AllowAll;
securityPolicy.DocumentPrivilege.AllowPrint = false;
doc.Encrypt(securityPolicy);
doc.SaveToFile(@"out.pdf");问题修复:
Spire.Office for Java 8.7.2 已发布。在该版本中,Spire.Doc for Java支持了以流的形式创建PrivateFontPath对象的功能;Spire.PDF for Java新增了转换PDF到Word的新接口以及转换PDF到HTML时的新方法;Spire.XLS for Java增强了 Excel 到 PDF 和图片的转换,Spire.Presentation for Java支持了获取多边形的顶点个数和位置的功能。此外,许多已知问题也在该版本中被成功修复。详情请阅读以下内容。
获取 Spire.Office for Java 8.7.2请点击:https://www.e-iceblue.cn/Downloads/Spire-Office-JAVA.html
新功能:
// Constructor
PrivateFontPath(String fontName,InputStream fontStream); PrivateFontPath(String fontName,int fontStyle,InputStream fontStream);
// getter setter
setFontStream(InputStream value);
getFontStream();ToPdfParameterList parms = new ToPdfParameterList();
parms.useAuthorNameToDisplayCommentLabel(true);问题修复:
新功能:
PdfToWordConverter converter(inputPath);
converter.saveToDocx(OutputPath);
converter.dispose();pdfDocument.getConvertOptions().setPdfToHtmlOptions(bool useEmbeddedSvg, bool useEmbeddedImg)
pdfDocument.getConvertOptions().setPdfToHtmlOptions(bool useEmbeddedSvg, bool useEmbeddedImg, int maxPageOneFile)问题修复:
问题修复:
新功能:
Presentation ppt = new Presentation();
ppt.loadFromFile(inputFile);
IAutoShape shape = (IAutoShape)ppt.getSlides().get(0).getShapes().get(0);
ArrayList<Point2D> points = shape.getPoints();
String text1 = "point count:" + " " + points.size() + "\r\n";
FileWriter writer1 = new FileWriter(outputFile, true);
writer1.append(text1);
writer1.close();
for (int i = 0; i < points.size(); i++)
{
String text2 = "point" + i + " " + points.get(i) + "\r\n";
FileWriter writer2 = new FileWriter(outputFile, true);
writer2.append(text2);
writer2.close();
}问题修复:
Spire.XLS for Java 13.7.3 已发布。本次更新增强了 Excel 到 PDF 和图片的转换,同时还优化了获取页数的时间消耗。此外,一些已知问题也在该版本中被成功修复,如获取的页数不正确的问题。详情请阅读以下内容。
问题修复:
Word 文档中的图表是一种有价值的工具,可以以直观易懂的格式显示和分析数据。它们有助于总结数据中的关键趋势、模式或关系,这在创建公司报告、业务提案或研究论文时尤其实用。在本文中,您将学习如何使用 Spire.Doc for .NET 以编程方式将折线图添加到 Word 文档中。
首先,您需要将 Spire.Doc for.NET 包含的 DLL 文件作为引用添加到您的 .NET 项目中。DLL 文件可以从此链接下载,也可以通过 NuGet 安装。
PM> Install-Package Spire.Doc折线图是一种常见的图表类型,它用一条连续的线连接一系列数据点。为了在 Word 中添加折线图,Spire.Doc for .NET 提供了 Paragraph.AppendChart(ChartType.Line, float width, float height) 方法。以下是详细步骤。
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields.Shapes.Charts;
using Spire.Doc.Fields;
namespace WordLineChart
{
class Program
{
static void Main(string[] args)
{
//创建一个Document对象
Document document = new Document();
//添加一个节
Section section = document.AddSection();
//在该节中添加一个段
Paragraph newPara = section.AddParagraph();
//将指定大小的折线图添加到段落中
ShapeObject shape = newPara.AppendChart(ChartType.Line, 460, 300);
//获取图表
Chart chart = shape.Chart;
//设置图表标题
chart.Title.Text = "销售报表";
//清除图表的默认系列数据
chart.Series.Clear();
//将具有指定系列名称、类别名称和系列值的三个自定义系列添加到图表中
string[] categories = { "1月", "2月", "3月", "4月" };
chart.Series.Add("A组", categories, new double[] { 1000, 2000, 2500, 4200 });
chart.Series.Add("B组", categories, new double[] { 1500, 1800, 3500, 4000 });
chart.Series.Add("C组", categories, new double[] { 1200, 2500, 2900, 3600 });
//设置图例位置
chart.Legend.Position = LegendPosition.Bottom;
//保存结果文档
document.SaveToFile("添加折线图.docx", FileFormat.Docx);
document.Dispose();
}
}
}Imports Spire.Doc
Imports Spire.Doc.Documents
Imports Spire.Doc.Fields.Shapes.Charts
Imports Spire.Doc.Fields
Namespace WordLineChart
Friend Class Program
Private Shared Sub Main(ByVal args As String())
'创建一个Document对象
Dim document As Document = New Document()
'添加一个节
Dim section As Section = document.AddSection()
'在该节中添加一个段
Dim newPara As Paragraph = section.AddParagraph()
'将指定大小的折线图添加到段落中
Dim shape As ShapeObject = newPara.AppendChart(ChartType.Line, 460, 300)
'获取图表
Dim chart As Chart = shape.Chart
'设置图表标题
chart.Title.Text = "销售报表"
'清除图表的默认系列数据
chart.Series.Clear()
'将具有指定系列名称、类别名称和系列值的三个自定义系列添加到图表中
Dim categories = {"1月", "2月", "3月", "4月"}
chart.Series.Add("A组", categories, New Double() {1000, 2000, 2500, 4200})
chart.Series.Add("B组", categories, New Double() {1500, 1800, 3500, 4000})
chart.Series.Add("C组", categories, New Double() {1200, 2500, 2900, 3600})
'设置图例位置
chart.Legend.Position = LegendPosition.Bottom
'保存结果文档
document.SaveToFile("添加折线图.docx", FileFormat.Docx)
document.Dispose()
End Sub
End Class
End Namespace
如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。
Spire.Doc for Java 11.7.0 已发布。该版本支持以流的形式创建PrivateFontPath对象的功能并且支持了将Word转换到PDF后批注用户信息显示效果与Word文件保持一致的功能。此外,该版本增强了 Word 到 PDF的转换。许多已知问题也在本次更新中被修复,如修复了加载文件后保存为新文档水印丢失的问题。详情请阅读以下内容。
新功能:
// Constructor
PrivateFontPath(String fontName,InputStream fontStream); PrivateFontPath(String fontName,int fontStyle,InputStream fontStream);
// getter setter
setFontStream(InputStream value);
getFontStream();ToPdfParameterList parms = new ToPdfParameterList();
parms.useAuthorNameToDisplayCommentLabel(true);问题修复:
Spire.Office 8.7.0 已发布。在本次更新中,Spire.Doc 支持了锁定文本框和图片的纵横比;Spire.XLS 支持了 NETWORKDAYS.INTL 函数;Spire.Presentation 支持了 PPTX 2016 和 PPTX 2019 文件格式;Spire.PDF 支持了创建含结构化表的标签 PDF 文件。此外,本次更新还成功修复了大量已知问题。详情请阅读以下内容。
该版本涵盖了最新版的 Spire.Doc,Spire.PDF,Spire.XLS,Spire.Email,Spire.DocViewer, Spire.PDFViewer,Spire.Presentation,Spire.Spreadsheet, Spire.OfficeViewer, Spire.DocViewer, Spire.Barcode, Spire.DataExport。
版本信息如下:
https://www.e-iceblue.cn/Downloads/Spire-Office-NET.html
新功能:
paragraph.ParagraphFormat.FirstLineIndentChars = value;
注意:
value为正数:设置的是首行缩进
value为负数:设置的是悬挂缩进
value为0时,用paragraph.Format.SetFirstLineIndentChars(0);方法设置textBox.AspectRatioLocked = true;//添加文本框时默认不锁定纵横比picture.AspectRatioLocked = true;//添加图片时默认锁定纵横比问题修复:
新功能:
问题修复:
新功能:
Spire.Presentation.FileFormat.Pptx2016
Spire.Presentation.FileFormat.Pptx2019Presentation ppt = new Presentation();
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.ColumnClustered, new RectangleF(50, 50, 400, 400));
//获取PrimaryCategory轴
IChartAxis chartAxis = chart.PrimaryCategoryAxis;
//设置距轴线的距离
chartAxis.LabelsDistance = 200;
//保存文件
ppt.SaveToFile(outputFile, FileFormat.Pptx2013);问题修复:
新功能:
PdfDocument myPdf = new PdfDocument("test.pdf");
PdfPageBase page = myPdf .Pages[0];
PdfDestination dest = new PdfDestination(page, new PointF(-40f, -40f));
dest.Mode = PdfDestinationMode.FitV;
PdfGoToAction gotoaction = new PdfGoToAction(dest);
myPdf.AfterOpenAction = gotoaction;
myPdf.ViewerPreferences.PageMode = PdfPageMode.UseOutlines;
myPdf.SaveToFile("FitBH.pdf");
myPdf.Close();PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add(PdfPageSize.A4, new PdfMargins(20));
page.SetTabOrder(TabOrder.Structure);
PdfTaggedContent taggedContent = new PdfTaggedContent(doc);
taggedContent.SetLanguage("en-US");
taggedContent.SetTitle("test");
taggedContent.SetPdfUA1Identification();
PdfTrueTypeFont font = new PdfTrueTypeFont(new System.Drawing.Font("Times New Roman", 14), true);
PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
PdfStructureElement document = taggedContent.StructureTreeRoot.AppendChildElement(PdfStandardStructTypes.Document);
PdfStructureElement heading1 = document.AppendChildElement(PdfStandardStructTypes.HeadingLevel1);
heading1.BeginMarkedContent(page);
string headingText = "What is a Tagged PDF?";
page.Canvas.DrawString(headingText, font, brush, new PointF(0, 0));
heading1.EndMarkedContent(page);
PdfStructureElement paragraph = document.AppendChildElement(PdfStandardStructTypes.Paragraph);
paragraph.BeginMarkedContent(page);
string paragraphText = ""Tagged PDF" doesn’t seem like a life-changing term. But for some, it is. For people who are " +
"blind or have low vision and use assistive technology (such as screen readers and connected Braille displays) to " +
"access information, an untagged PDF means they are missing out on information contained in the document because assistive " +
"technology cannot "read" untagged PDFs. Digital accessibility has opened up so many avenues to information that were once " +
"closed to people with visual disabilities, but PDFs often get left out of the equation.";
RectangleF rect = new RectangleF(0, 30, page.Canvas.ClientSize.Width, page.Canvas.ClientSize.Height);
page.Canvas.DrawString(paragraphText, font, brush, rect);
paragraph.EndMarkedContent(page);
PdfStructureElement figure = document.AppendChildElement(PdfStandardStructTypes.Figure);
figure.BeginMarkedContent(page);
PdfImage image = PdfImage.FromFile(TestUtil.DataPath + "ImgFiles/Bug_3938.png");
page.Canvas.DrawImage(image, new PointF(0, 150));
figure.EndMarkedContent(page);
PdfStructureElement table = document.AppendChildElement(PdfStandardStructTypes.Table);
PdfTable pdfTable = new PdfTable();
pdfTable.Style.DefaultStyle.Font = font;
System.Data.DataTable dataTable = new System.Data.DataTable();
dataTable.Columns.Add("Name");
dataTable.Columns.Add("Age");
dataTable.Columns.Add("Sex");
dataTable.Rows.Add(new string[] { "John", "22", "Male" });
dataTable.Rows.Add(new string[] { "Katty", "25", "Female" });
pdfTable.DataSource = dataTable;
pdfTable.Style.ShowHeader = true;
pdfTable.StructureElement = table;
pdfTable.Draw(page.Canvas, new PointF(0, 280), 300f);
doc.SaveToFile("1.pdf");
doc.Dispose();问题修复:
问题修复:
Spire.PDF for Java 9.7.0 已发布。本次更新新增了转换PDF到Word的新接口以及转换PDF到HTML时的新方法。并且还增强了 PDF 文档到 PPTX、HTML 以及图片的转换。此外,该版本还修复了一些已知问题,如修复了设置裁剪框不起作用的问题。
新功能:
PdfToWordConverter converter(inputPath);
converter.saveToDocx(OutputPath);
converter.dispose();pdfDocument.getConvertOptions().setPdfToHtmlOptions(bool useEmbeddedSvg, bool useEmbeddedImg)
pdfDocument.getConvertOptions().setPdfToHtmlOptions(bool useEmbeddedSvg, bool useEmbeddedImg, int maxPageOneFile)问题修复:
Spire.Doc 11.7.0 已发布。该版本新增支持首行缩进设置字符个数以及锁定文本框和图片的纵横比。该版本还增强了 Word 到 PDF 的转换功能。此外,一些已知问题也在本次更新中被成功修复,如获取出的段前段后的值不正确的问题。详情请阅读以下内容。
新功能:
paragraph.ParagraphFormat.FirstLineIndentChars = value;
注意:
value为正数:设置的是首行缩进
value为负数:设置的是悬挂缩进
value为0时,用paragraph.Format.SetFirstLineIndentChars(0);方法设置textBox.AspectRatioLocked = true;//添加文本框时默认不锁定纵横比picture.AspectRatioLocked = true;//添加图片时默认锁定纵横比问题修复: