Browse our Products
Aspose.PDF for .NET 9.5.0
We are pleased to share a new version of Aspose.PDF for .NET with the following improvements.
New Features
We are pleased to share a new version of Aspose.PDF for .NET with the following improvements.
PDFNEWNET-35710 - Implement IsHtmlTagSupported property in TextFragment class PDFNEWNET-36908 - Remove Extended Rights feature from the PDF PDFNEWNET-37133 - Add support for Pdf measurement tool PDFNEWNET-37135 - PDF to HTML - Save HTML,CSS,Image, Font resources in Stream object PDFNEWNET-37199 - Get form field limit
Enhancements
PDFNEWNET-33326 - Expanded Bookmarks when opening the PDF documents PDFNEWNET-34718 - PDF to DOC: output document is 10 times larger PDFNEWNET-35804 - Adding HTML string using Aspose.PDF namespace(DOM) PDFNEWNET-36403 - PDFNEWNET-35748 Several other types of Shapes absent in new GeneratorExceptions PDFNEWNET-34921 - PDF to XPS: Exception during conversion PDFNEWNET-35979 - HTML to PDF - OutOfMemoryException during conversion PDFNEWNET-36295 - HTMl to PDF - FormatException during conversion PDFNEWNET-36300 - HTML to PDF - Table and its content do not appear properly PDFNEWNET-36301 - HTML to PDF - The UL list items appear in small font PDFNEWNET-36302 - HTML to PDF - Table borders do not appear in resultant PDF PDFNEWNET-36410 - ArgumentNullException when setting ColumnAdjustment type as AutoFitToContent PDFNEWNET-36541 - PDF to XPS - IndexOutOfRangeException during conversion PDFNEWNET-37017 - Filling an image field results ArgumentException PDFNEWNET-37109 - OutOfMemoryException while linearizing PDF file PDFNEWNET-37129 - Document saving throws ArgumentException PDFNEWNET-37157 - StackOverflowException when trying to read PDF file information PDFNEWNET-37177 - PDF to TIFF - Exception during conversion PDFNEWNET-37179 - Exception while saving the PDF file PDFNEWNET-37210 - Deleting page from a newly created PDF throws ArgumentException PDFNEWNET-37218 - NullReferenceException while loading PDF file PDFNEWNET-37237 - Exception while concatenating PDF files PDFNEWNET-35710 - Implement IsHtmlTagSupported property in TextFragment class PDFNEWNET-36908 - Remove Extended Rights feature from the PDF PDFNEWNET-37133 - Add support for Pdf measurement tool PDFNEWNET-37135 - PDF to HTML - Save HTML,CSS,Image, Font resources in Stream objectBugs PDFNEWNET-29636 - Table contents are rendered over the page’s bottom margin PDFNEWNET-32895 - HTML2PDF: Converted file has alot of spaces and empty page PDFNEWNET-33506 - HTML to PDF Conversion issues PDFNEWNET-33733 - Corrupted DOC file when generated from PDF document PDFNEWNET-33782 - Document becomes corrupted after applying compression PDFNEWNET-34696 - PDF to Word: Unable to open converted document in Word 2003 PDFNEWNET-34888 - Wrong font for accented characters, after PDF converted to Word PDFNEWNET-34987 - Text Replace:- Text is overlapping to contents on right PDFNEWNET-35016 - PDF to HTML :- Contents on resultant HTML are missing PDFNEWNET-35021 - Aspose.PDF.Generator.pdf.save() method hang while converting Html file to Pdf PDFNEWNET-35536 - HTML to PDF conversion throws exception when encounter unsupported font PDFNEWNET-35546 - HTML to PDF text splits over two lines. PDFNEWNET-35623 - HTML to PDF formatting issue. PDFNEWNET-35633 - HTML to PDF - Not all contents are visible PDFNEWNET-35634 - HTML to PDF - Double underline not rendered resultant file PDFNEWNET-35704 - HTML to PDF - Incorrect output file PDFNEWNET-35844 - HTML to PDF: line break tag <br> or <br> effect left margin PDFNEWNET-35892 - PDF to TIFF: background image is not being rendered PDFNEWNET-35980 - HTML to PDF - Unable to convert HTML to PDF format PDFNEWNET-35999 - HTML to PDF: inline CSS style adds linebreak PDFNEWNET-36106 - HTML to PDF: Large HTML conversion issue PDFNEWNET-36108 - HTML to PDF - Image is being placed on subsequent page PDFNEWNET-36131 - HTML to PDF - Resultant file is blank PDFNEWNET-36293 - HTML to PDF - Table going beyond Page width PDFNEWNET-36312 - Printing - Margin information for printout is not being honored PDFNEWNET-36381 - Unable to set text margin when using IsHtmlTagSupported PDFNEWNET-36431 - PDF to HTML - conversion process takes longer time PDFNEWNET-36440 - Text replacement creates formatting isuse PDFNEWNET-36463 - PDF to Image - Image crops if Resolution value is increased PDFNEWNET-36556 - Text replace leaves an extra space PDFNEWNET-36635 - Problem to validate converted PDF to PDF/A PDFNEWNET-36640 - PngDevice.Process cutting off image PDFNEWNET-36760 - SVG to PDF conversion: Image is being rendered incorrectly PDFNEWNET-36818 - Incorrect page dimensions are being returned PDFNEWNET-36891 - HTML to PDF - Only contents iside Body tag are appearing in PDF PDFNEWNET-36953 - HTML to PDF: border is being added around hyperlink PDFNEWNET-36996 - Quality of Image added to PDF is not good PDFNEWNET-37038 - Missing Link Annotation Action PDFNEWNET-37048 - Problem when creating Pdf from SVG in multitasking operations PDFNEWNET-37060 - HTML to PDF: incorrect formatting PDFNEWNET-37062 - Error embedding files to PDF PDFNEWNET-37079 - Form field is inacessable PDFNEWNET-37087 - PDF size increases after optimization PDFNEWNET-37094 - PDF to PDFA1b: resultant document does not compliance PDFA1b standards PDFNEWNET-37120 - JpegDevice input width does not match the output width PDFNEWNET-37128 - Newly created form crashes while editing in Adobe Acrobat PDFNEWNET-37149 - PDF to TIFF: Compression type RLE always generates 1bpp format PDFNEWNET-37153 - Duplicate type SmartAssembly.Attributes when using multiple Aspose API’s together PDFNEWNET-37154 - Some form fields are not populated PDFNEWNET-37155 - PDF to PDF/A - Colors are changing in resultnat file PDFNEWNET-37166 - XSL-FO to PDF - resultant file shows incorrect PDF prodcuer value PDFNEWNET-37169 - PDF to text: extraction of duplicate characters PDFNEWNET-37170 - PDF to text: bullets are being extracted as special characters. PDFNEWNET-37174 - Header text left Alignment issue PDFNEWNET-37175 - PDF to PDFA1b: PDFA1b compliance issue PDFNEWNET-37187 - PDF to Excel - Blank column is not being honored PDFNEWNET-37198 - HTML to PDF: link in HTML is being rendered with an extra rectangle around it PDFNEWNET-37206 - PDF file size increases when trying to compress it PDFNEWNET-37215 - SetPageSize() ignored if any Text added to the page PDFNEWNET-37216 - PDF file size increases when we try compressing it PDFNEWNET-37217 - Multiline text stamp alignment issue
Public API and Backwards Incompatible Changes
- Property CoordinateType was added to PdfViewer and PdfConverter The CoordinateType property allows to set printable area to MediaBox or CropBox (default value)SetFieldImage method was added to XFA class: public void SetFieldImage(string fieldName, Stream image)
Example: Following code snippet shows how to set image for XFA form field:
Document doc = new Document("doc.pdf");
FileStream fs = new FileStream("image.jpg", FileMode.Open, FileAccess.Read);
doc.Form.XFA.SetFieldImage("form1[0].ImageField1[0]", fs);
doc.Save("37017-1.pdf");
- ReplaceAdjustment enumeration was added into TextReplaceOptions class and provides the following values:
None - No action, length of the line may be changed
AdjustSpaceWidth - Try to adjust spaces between words to keep line length
- ReplaceAdjustmentAction property was added into TextReplaceOptions class
- TextReplaceOptions class has new constructor that allows to set ReplaceAdjustment parameter
TextReplaceOptions.#ctor(Aspose.PDF.Text.TextOptions.TextReplaceOptions.ReplaceAdjustment)
- TextReplaceOptions property was added into TextFragmentAbsorber class
- Ellipse class was implemented:
Constructor:
public Ellipse(float left, float bottom, float width, float height)
Properties:
Left - float value that indicates the left position of the ellipse.
Bottom - float value that indicates the bottom position of the ellipse.
Width - float value that indicates the width of the ellipse.
Height - float value that indicates the height of the ellipse.
Example: Following code snippet shows how to add Ellipse
string outFile = "Ellipse.pdf";
Document doc = new Document();
Page page = doc.Pages.Add();
Graph canvas = new Graph(400, 100);
page.Paragraphs.Add(canvas);
Ellipse ellipse1 = new Ellipse(50, 10, 100, 50);
canvas.Shapes.Add(ellipse1);
doc.Save(outFile);
- Path class was implemented
Constructors:
public Path()public Path(Shape[] shapes)
Property:
Shapes - shapes collection
Example:
following code snippet shows how o add Path:
Document doc = new Document();
Page page = doc.Pages.Add();
Graph graph = new Graph(100, 400);
page.Paragraphs.Add(graph);
Path path = new Path();
path.GraphInfo.FillColor = Color.Red;
graph.Shapes.Add(path);
Line line = new Line(new float[] { 200, 80, 200, 100 });
path.Shapes.Add(line);
Arc arc = new Arc(200, 50, 50, 90, 270);
path.Shapes.Add(arc);
float[] curPos = arc.GetEndPosition();
line = new Line(new float[] { curPos[0], curPos[1], 200, 20 });path.Shapes.Add(line);
arc = new Arc(200, 50, 30, 270, 90);
path.Shapes.Add(arc);
doc.Save(outFile);
- HtmlFragment class was added into namespace Aspose.PDF
Constructor:
public HtmlFragment(string text)
Parameter:
text - HTML text
Property:Text
\- HTML text
Example:Following code snippet shows how to add HTML fragment:
Document doc = new Document();
Page page = doc.Pages.Add();
HtmlFragment titel = new HtmlFragment("<fontsize=10><b><i>Table</i></b></fontsize>");
titel.IsKeptWithNext = true;
titel.Margin.Bottom = 10;
titel.Margin.Top = 200;
page.Paragraphs.Add(titel);
doc.Save(outFile);
- ContainsUsageRights() method was added into PdfFileSignature class
- RemoveUsageRights() method was added into PdfFileSignature class
Example: Following code shows how to remove usage rights feature from the document
using (PdfFileSignature pdfSign = new PdfFileSignature())
{
string inputFile = @"c:\36908.pdf";
string outputFile = @"c:\36908_output.pdf";
pdfSign.BindPdf(inputFile);
if (pdfSign.ContainsUsageRights())
{
pdfSign.RemoveUsageRights();
}
pdfSign.Document.Save(outputFile);
}
- IsContainSignature method was renamed into ContainsSignature
- The previous method name was not removed but marked as obsolete to be removed in future.
- IsCoversWholeDocument method was renamed into CoversWholeDocument
- The previous method name was not removed but marked as obsolete to be removed in future.
- Measure members of Measure class
Constructor
public Measure(Annotation annotation)
Properties
ScaleRatio - A text string expressing the scale ratio of the drawing.
XFormat - A number format array for measurement of change along the xaxis and, if Y is not present, along the y axis as well
YFormat - A number format array for measurement of change along the y axis.
DistanceFormat - A number format array for measurement of distance in any direction.
AreaFormat - A number format array for measurement of area.
AngleFormat - A number format array for measurement of angles.
SlopeFormat - A number format array for measurement of the slope of a line.
Origin - Point that shall specify the origin of the measurement coordinate system in default user space coordinates.
XYFactor - A factor that shall be used to convert the largest units along the y axis to the largest units along the x axis.
- NumberFormat class was added into Measure class the class represents Number format for the measure.
Constructor:
public NumberFormat(Measure measure)
Properties
UnitLabel - A text string specifying a label for displaying the units.
ConvresionFactor - The conversion factor used to multiply a value in partial units of the previous number format array element to obtain a value in the units of this number format.
FractionDisplayment - In what manner fractional values are displayed.
Precision - If FractionDisplayment is ShowAsDecimal, this value is precision of fractional value; It shall me multiple of 10. Default is 100.
Denominator - If FractionDisplayment is ShowAsFraction, this value is denominator of the fraction. Default value is 16.
ForceDenominator - If FractionDisplayment is ShowAsFraction, this value determines meay or not the fraction be reduced. If value is true fraction may not be reduced.
ThousandsSeparator - Text that shall be used between orders of thousands in display of numerical values. An empty string indicates that no text shall be added. Default is comma.
FractionSeparator - Text that shall be used as the decimal position in displaying numerical values. An empty string indicates that the default shall be used. Default is period character.
BeforeText - Text that shall be concatenated to the left of the label.
AfterText - Text that shall be concatenated after the label
- Enumeration FractionStyle was added into NumberFormat. Its values are as follows.
FractionStyle values:
ShowAsDecimal - Show fractional values as decimal fraction.
ShowAsFraction - Show fractional value as fraction.
Round - Round fractional values to the nearest whole integer.
Truncate - Truncate to achieve whole units.
- NumberFormatList class was added into Measure class. It represents the a list of number formats.
Constructor
public NumberFormatList(Measure measure)Properties
Adds number format to list.
public void Insert(int index, NumberFormat value)
public void RemoveAt(int index) //Removes number format from list.
- Measure property was added to LineAnnotation and PolyLineAnnotation classes.
Examples:
Following example demonstrates how to use Measure with LineAnnotation:
Document doc = new Document("source.pdf");
Rectangle rect = new Rectangle(260, 630, 451, 662);
LineAnnotation line = new LineAnnotation(doc.Pages[1], rect, new Point(266, 657), new Point(446, 656));
line.Color = Color.Red;
line.LeaderLine = -15;line.LeaderLineExtension = 5;
line.StartingStyle = LineEnding.OpenArrow;
line.EndingStyle = LineEnding.OpenArrow;
line.Measure = new Measure(line);
line.Measure.DistanceFormat = new Measure.NumberFormatList(line.Measure);
line.Measure.DistanceFormat.Add(new Measure.NumberFormat(line.Measure));
line.Measure.DistanceFormat[1].UnitLabel = "mm";
line.Measure.DistanceFormat[1].FractionSeparator = ".";
line.Measure.DistanceFormat[1].ConvresionFactor = 1;
line.Contents = "155 mm";
line.ShowCaption = true;
line.CaptionPosition = CaptionPosition.Top;
doc.Pages[1].Annotations.Add(line);
doc.Save("output.pdf");
Following example demonstrates how to use Measure with PolylineAnnotation:
Document doc = new Document("source.pdf");
Point[] vertices = new Point[]{new Point(100, 600),new Point(500, 600),new Point(500, 500), new Point(400, 300),new Point(100, 500),new Point(100, 600)};
Rectangle rect = new Rectangle(100, 500, 500, 600);
PolylineAnnotation area = new PolylineAnnotation(doc.Pages[1], rect, vertices);
area.Color = Color.Red;
area.StartingStyle = LineEnding.OpenArrow;
area.EndingStyle = LineEnding.OpenArrow;
area.Measure = new Measure(area);
area.Measure.DistanceFormat = new Measure.NumberFormatList(area.Measure);
area.Measure.DistanceFormat.Add(new Measure.NumberFormat(area.Measure));
area.Measure.DistanceFormat[1].UnitLabel ="mm";
doc.Pages[1].Annotations.Add(area);
doc.Save( "output.pdf"));
Following code snippet demonstrates how to read Measure properties:
Document doc = new Document("measure.pdf");
Console.WriteLine((doc.Pages[1].Annotations[1] as LineAnnotation).Measure.ScaleRatio);
Console.WriteLine((doc.Pages[1].Annotations[1] as LineAnnotation).Measure.AreaFormat[1].UnitLabel);
Console.WriteLine((doc.Pages[1].Annotations[1] as LineAnnotation).Measure.AreaFormat[1].ConvresionFactor);
Console.WriteLine((doc.Pages[1].Annotations[1] as LineAnnotation).Measure.AreaFormat[1].FractionSeparator);