Spire.PDF 3.9.360 新支持打印指定的 PDF 页面
|
028-81705109
|
|
微信扫一扫
|

在线编辑/WebAPI

Spire.PDF 3.9.360 新支持打印指定的 PDF 页面

我们很高兴地通知大家,Spire.PDF 3.9.360正式发布了。这次更新我们添加了PDF打印指定页面,公布了属性图层的名字,还新支持可以通过搜索文本返回当前行的文本等修功能,同时,我们对打印,PDF图层以及安全设置的代码做了一些调整。 我们还修复了PDF转XPS出现的问题,图片转PDF以及压缩PDF文档中的图片等bugs。具体更新内容如下:

新功能:

PdfDocument doc = new PdfDocument();
doc.LoadFromFile(filename);
doc.PrintSettings.SelectSomePages(new int[]{2,4});
doc.Print();
string name = doc.Layers[0].Name;
signature.SignTextAlignment=SignTextAlignment.Right;
PdfDocument doc = new PdfDocument();
doc.LoadFromFile("Alcontrol - EDF.pdf");
PdfPageBase page =doc.pages[0];
SimpleTextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
string text=page.ExtractText(strategy);
FileStream fs =new FileStream("Alcontrol - EDF.txt",FileMode.Create);
StreamWriter sw =new StreamWriter(fs);
sw.Writer(text);
sw.Flush();
sw.Close();

调整:

PdfDocument doc = new PdfDocument(FilePath + "sample.pdf");
//change print settings you want
doc.PrintSettings.Landscape = true;
doc.Print();
//add layer
PdfLayer layer = doc.Layers.AddLayer("red line", PdfVisibility.On);
PdfCanvas pcA = layer.CreateGraphics(doc.Pages[0].Canvas);
pcA.DrawLine(new PdfPen(PdfBrushes.Red, 1), new PointF(0, 100), new PointF(100, 100));
layer = doc.Layers.AddLayer("blue line");
PdfCanvas pcB = layer.CreateGraphics(doc.Pages[0].Canvas);
pcB.DrawLine(new PdfPen(PdfBrushes.Blue, 1), new PointF(0, 150), new PointF(100, 150));
//remove the layer by name
doc.Layers.RemoveLayer(("red line");
//encrypt
doc.Security.Encrypt("userPassword", "OwnerPassword", Spire.Pdf.Security.PdfPermissionsFlags.EditContent, Spire.Pdf.Security.PdfEncryptionKeySize.Key256Bit);
//verify owner password.
doc.Security.VerifyOwnerPassword();

问题修复:


获取最新版的 Spire.PDF 3.9.360,请点击:

http://www.e-iceblue.cn/Downloads/Spire-PDF-NET.html