Generate Multi-Column PDF, PDF to PPTX conversion, PDF/A with attachments and support for OTF fonts with Aspose.Pdf for .NET 10.3.0

Share on FacebookTweet about this on TwitterShare on LinkedIn

Aspose.Pdf for .NET logo We are pleased to announce the release of another exciting version of Aspose.Pdf for .NET 10.3.0 which is a better and an optimized version, as compared to earlier releases. This new release provides some great features and enhancements, which keeps this API high among the list of its competitors. At Aspose, we are always striving to provide high demanding features, with such an ease that our customers can accomplish their requirements, with a minimal set of code lines, even with couple of code lines. Isn’t that exciting !

PDF to PPTX conversion

We have an API named Aspose.Slides which provides the feature to create as well as manipulate existing MS PowerPoint presentations. It also offers the feature to convert PPT/PPTX files to PDF format, so that the resultant file can be viewed across multiple platforms, without compromising the layout / formatting of document. We know that PDF is one of the widely used fie format for data sharing because it ensures the document structure/contents remains intact, when viewing the file over various platforms/devices and even it does not matter what your regional or personal system preferences are. In order to deal with PDF format, Aspose.Pdf for .NET is one of the great API’s in industry to facilitate users to programatically create as well as manipulate any existing PDF files. Recently many of our customers requested a feature to transform PDF files to PPTX format, and we are pleased to share that this new release of Aspose.Pdf for .NET offers this great feature. So in order to accomplish this requirement, you only need to instantiate an object of PptxSaveOptions class and pass it as second argument to Document.Save(..) method. For further details, please take a look over Convert PDF to PPTX.

BTW, you may consider taking a look over Working with Document Conversion section to get a sneak peak of conversion features currently being offered by Aspose.Pdf for .NET.

// Load PDF document
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(@"C:\pdftest\IN_7664539.pdf");
// Instantiate PptxSaveOptions instance
Aspose.Pdf.PptxSaveOptions pptx_save = new Aspose.Pdf.PptxSaveOptions();
// Save the output in PPTX format
doc.Save("c:/pdftest/IN_7664539.pptx", pptx_save);

Create Multi-column PDF document

Magazines and newspapers mostly have news; mostly displayed in multiple columns on the single pages instead of the books where text paragraphs are mostly printed on the whole pages from left to right position. Many document processing applications like Microsoft Word and Adobe Acrobat Writer allow users to create multiple columns on a single page and then add data to them. Aspose.Pdf for .NET also offers the feature to create multiple columns inside the pages of PDF documents. For related details, please visit Create Multi-Column PDF document

Document doc = new Document();
// specify the left margin info for the PDF file
doc.PageInfo.Margin.Left = 40;
// specify the Right margin info for the PDF file
doc.PageInfo.Margin.Right = 40;
Page page = doc.Pages.Add();

Aspose.Pdf.Drawing.Graph graph1 = new Aspose.Pdf.Drawing.Graph(500, 2);
// Add the line to paraphraphs collection of section object
page.Paragraphs.Add(graph1);

//specify the coordinates for the line
float[] posArr = new float[] { 1, 2, 500, 2 };
Aspose.Pdf.Drawing.Line l1 = new Aspose.Pdf.Drawing.Line(posArr);
graph1.Shapes.Add(l1);
//Create string variables with text containing html tags

string s = "" +

"< strong> How to Steer Clear of money scams "
+ "";
//Create text paragraphs containing HTML text

HtmlFragment heading_text = new HtmlFragment(s);
page.Paragraphs.Add(heading_text);

Aspose.Pdf.FloatingBox box = new Aspose.Pdf.FloatingBox();
//Add four columns in the section
box.ColumnInfo.ColumnCount = 2;
//Set the spacing between the columns
box.ColumnInfo.ColumnSpacing = "5";

box.ColumnInfo.ColumnWidths = "105 105";
TextFragment text1 = new TextFragment("By A Googler (The Official Google Blog)");
text1.TextState.FontSize = 8;
text1.TextState.LineSpacing = 2;
box.Paragraphs.Add(text1);
text1.TextState.FontSize = 10;

text1.TextState.FontStyle = FontStyles.Italic;
// Create a graphs object to draw a line
Aspose.Pdf.Drawing.Graph graph2 = new Aspose.Pdf.Drawing.Graph(50, 10);
// specify the coordinates for the line
float[] posArr2 = new float[] { 1, 10, 100, 10 };
Aspose.Pdf.Drawing.Line l2 = new Aspose.Pdf.Drawing.Line(posArr2);
graph2.Shapes.Add(l2);

// Add the line to paragraphs collection of section object
box.Paragraphs.Add(graph2);

TextFragment text2 = new TextFragment(@"Sed augue tortor, sodales id, luctus et, pulvinar ut, eros. Suspendisse vel dolor. Sed quam. Curabitur ut massa vitae eros euismod aliquam. Pellentesque sit amet elit. Vestibulum interdum pellentesque augue. Cras mollis arcu sit amet purus. Donec augue. Nam mollis tortor a elit. Nulla viverra nisl vel mauris. Vivamus sapien. nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et,nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.");
box.Paragraphs.Add(text2);

page.Paragraphs.Add(box);

string outFile = "c:/pdftest/Muli-Column.pdf";
//Save the Pdf
doc.Save(outFile);

Attachment support in PDF/A format

PDF/A is widely used standard to preserve data inside document for long term and also to ensure the integrity of data inside the document (document is not modified, once its compliance is set to PDF/A format). Recently we have come across a requirement to provide support for attachments in PDF/A files and as per Adobe Community post, PDF/A_3a compliance format supports the feature to attach any file type as attachment. Please visit the following link for further details on Convert PDF File to PDF-A

.
// instantiate Document instance to load existing file
Aspose.Pdf.Document doc = new Document("c:/colored.pdf");
//setup new file to be added as attachment
FileSpecification fileSpecification = new FileSpecification("c:/input.jpg", "Image file");
//add attachment to document's attachment collection
doc.EmbeddedFiles.Add(fileSpecification);
// perform conversion to PDF/A_3a so attachment is included in resultnat file
doc.Convert("c:/Log.txt", Aspose.Pdf.PdfFormat.PDF_A_3A, ConvertErrorAction.Delete);
// save resultant file
doc.Save("c:/Converted.pdf");

OTF Fonts support

Aspose.Pdf for .NET offers the feature to use Custom/TrueType fonts while creating/manipulating PDF file contents, so that file contents are displayed using contents other than default system fonts. Starting this release, we have also provided the support for Open Type Fonts. For further details, please visit How to use OTF fonts.

//Create new document instance
Document pdfDocument = new Document();
// add page to pages collection of PDF file
Aspose.Pdf.Page page = pdfDocument.Pages.Add();
// create TextFragment instnace with sample text
TextFragment fragment = new TextFragment("Sample Text in OTF font");
// find font inside system font directory
//fragment.TextState.Font = FontRepository.FindFont("HelveticaNeueLT Pro 45 Lt");
// or you can even specify the path of OTF font in system directory
fragment.TextState.Font = FontRepository.OpenFont(@"E:\HelveticaNeueLTPro-Lt.otf");
// specify to emend font inside PDF file, so that its displayed properly,
// even if specific font is not installed/present over target machine
fragment.TextState.Font.IsEmbedded = true;
// add TextFragment to paragraphs collection of Page instance
page.Paragraphs.Add(fragment);
// save resultant file
pdfDocument.Save("c:/pdftest/OTF_Font_Tes.pdf");

Make FindFont(…) method case insensitive

The FindFont(..) method of Aspose.Pdf.Text.FontRepository class provides the capabilities to find specific font from system font repository (i.e. C:/Windows/Fonts/). The method is case-sensitive and requires exact Font file name. In this new release, we have provided an overload method public static Font FindFont(string fontName, bool ignoreCase), which takes second argument to specify either the font name should be case-sensitive or not. When using True as second argument, a case insensitive name can be provided.

//Create new document instance
Document pdfDocument = new Document();
// add page to pages collection of PDF file
Aspose.Pdf.Page page = pdfDocument.Pages.Add();
// create TextFragment instnace with sample text
TextFragment fragment = new TextFragment("Sample Text in OTF font");
// find font inside system font directory
fragment.TextState.Font = FontRepository.FindFont("HelveticaNeueLT Pro 45 Lt",true);
// specify to emend font inside PDF file, so that its displayed properly,
// even if specific font is not installed/present over target machine
fragment.TextState.Font.IsEmbedded = true;
// add TextFragment to paragraphs collection of Page instance
page.Paragraphs.Add(fragment);
// save resultant file
pdfDocument.Save("c:/pdftest/OTF_Font_Tes.pdf");

Miscellaneous fixes

As well as the enhancements and features discussed above, there have been specific improvement for PDF to HTML and HTML to PDF conversion features. Among these fixes, the PCL to PDF, SVG to PDF, PDF to Excel, PDF to DOC, PDF to TIFF and TIFF to PDF conversion, conversion of PDF to PDF/A compliant documents, text replacement, rendering PDF files to XPS format are also improved. Please download and try the latest release of Aspose.Pdf for .NET 10.3.0.