Code Samples
Merge Multiple Presentation by Passing List of All Files in .NET Apps
Dec 31 2012 04:26 AM | Aspose in Source Code
This technical tip allows developers to merge multiple presentation files using Saaspose.Slides REST API in your .NET applications. You can pass a list of all the files you want to merge using this example. Developers need to upload all the input files (Presentation1.pptx, Presentation2.pptx and Presentation3.pptx in case of this example) before running this example. Please check Upload File to Saaspose for how to. Some important steps for performing this task are to specify product URI, build URI, build URI to download merged presentation and Save output file.
Sample Code for Merge multiple presentations
SaasposeApp.AppKey = "89**********************";
SaasposeApp.AppSID = "77***********************";
//specify product URI
Product.BaseProductUri = @"[url="http://api.saaspose.com/v1.0%22;"]http://api.saaspose.com/v1.0";[/url]
string[] presentationsList = new string[] { "Presentation2.pptx", "Presentation3.pptx" };
PresentationsList list = new PresentationsList();
list.PresentationPaths = presentationsList;
string strJSON = JsonConvert.SerializeObject(list);
//build URI
string strURI = "[url="http://api.saaspose....n1.pptx/merge%22;"]http://api.saaspose....n1.pptx/merge";[/url] //Product.BaseProductUri + "/pdf/" + basePdf + "/appendDocument?appendFile=" + newPdf + "&startPage=1&endPage=" + iPageCount.ToString();
string signedURI = Utils.Sign(strURI);
Utils.ProcessCommand(signedURI, "POST", strJSON);
// build URI to download merged presentation
strURI = "[url="http://api.saaspose....ntation1.pptx%22;"]http://api.saaspose....ntation1.pptx";[/url]
signedURI = Utils.Sign(strURI);
using (Stream responseStream = Utils.ProcessCommand(signedURI, "GET"))
{
//Save output file
using (Stream fileStream = System.IO.File.OpenWrite("C:\\MergedPresentation.pptx"))
{
Utils.CopyStream(responseStream, fileStream);
}
}
//Following is the PresentationsList class
/// <summary>
/// represents list of presentations to be merged
/// </summary>
class PresentationsList
{
public PresentationsList() { }
public string[] PresentationPaths { get; set; }
}
//build URI to upload file to Saaspose
string strURI = "[url="http://api.saaspose....emoteFileName%22;"]http://api.saaspose....emoteFileName";[/url]
string signedURI = Sign(strURI);
UploadFileBinary(localfilepath, signedURI, "PUT");
Overview: Saaspose.Slides Saaspose.Slides is a REST based API that allows developers to read, write & modify a PowerPoint presentations in cloud. It is platform independent API & can be used by developers in web, desktop, mobile & cloud applications alike. It provides a rich set of features like creating presentation from scratch, modify various aspect of a presentation & converting a presentation to PDF, XPS, TIFF, SVG, HTML, PNG, JPEG, GIF & BMP formats. It helps you add, modify or extract text from the presentation.
More about Saaspose.Slides
- Homepage Saaspose.Slides
- More Technical Tips by Saaspose.Slides
- Ask technical questions/queries from Saaspose Support Team
Contact Information
Aspose Pty Ltd, Suite 163,
79 Longueville Road
Lane Cove, NSW, 2066
Australia
Saaspose - Your File Format Experts 2.0
sales@aspose.com
Phone: 1.214.329.1520
Fax: 866.810.9465
Read story → 0 comments




Image Text Extraction from Remote Image URL by REST API in Java Apps
Dec 27 2012 04:47 AM | Aspose in Source Code
This technical tip allows developers to extract image text from remote image URL using Saaspose.OCR REST API in their Java applications. Some important steps for performing this task is to build URI to extract text, sign URI, execute signed URI request and get response, Parse and deserialize the JSON to an object and Display the value and type of all the extracted text.
Sample Code for for Extracting Image Text from Remote Image URL
//build URI to extract text
String strURI = "";
strURI = "[url="http://api.saaspose.com/v1.0/ocr/recognize?url=http://s017.radikal.ru/i406/1202/7b/70183bef7a09.jpg&language=english&useDefaultDictionaries=true%22;"]http://api.saaspose....ionaries=true";[/url]
//sign URI
String signedURI = Sign(strURI);
//execute signed URI request and get response
InputStream responseStream = ProcessCommand(signedURI, "POST");
String strJSON = StreamToString(responseStream);
// Parse and deserialize the JSON to a object.
OCRResponse ocrResponse = gson.fromJson(strJSON, OCRResponse.class);
// Display the value and type of all the recognized barcodes
for (Part part : ocrResponse.getPartsInfo().getList())
{
System.out.println("Text: " + part.getText());
System.out.println("Font Name: " + part.getFontName());
System.out.println("Font Size: " + part.getFontSize());
System.out.println("Bold: " + part.getBold());
System.out.println("Italic: " + part.getItalic());
System.out.println("Underline: " + part.getUnderline());
}
//Here is the OCRResponse class
public class OCRResponse extends BaseResponse
{
private String Text;
private OCREnvelop PartsInfo;
public String getText() { return Text; }
public OCREnvelop getPartsInfo() { return PartsInfo; }
}
//Here is the OCREnvelop class
public class OCREnvelop
{
private List<Part> Parts;
public List<Part> getList() { return Parts; }
}
//Here is the Part class
public class Part
{
public Part() { }
private String FontName;
private float FontSize;
private boolean Bold;
private boolean Italic;
private boolean Underline;
private String Text;
public String getFontName() { return FontName; }
public float getFontSize() { return FontSize; }
public boolean getBold() { return Bold; }
public boolean getItalic() { return Italic; }
public boolean getUnderline() { return Underline; }
public String getText() { return Text; }
}
Overview: Saaspose.OCR
Saaspose.OCR is a platform independent REST API used for optical character recognition and document scanning. It allows developers to scan documents, extract text and recognize characters from the documents in the cloud. It supports OCR feature for whole image, partial image or a specific rectangular area of an image file. It can be used with languages like .NET, Java, PHP, Ruby, Rails, Python, jQuery & many others. It can also be integrated with other cloud services to process documents.
More about Saaspose.BarCode
- Homepage of Saaspose.OCR
- More Technical Tips by Saaspose.BarCode
- Ask technical questions/queries from Saaspose Support Team
Contact Information
Aspose Pty Ltd, Suite 163,
79 Longueville Road
Lane Cove, NSW, 2066
Australia
Saaspose - Your File Format Experts 2.0
sales@aspose.com
Phone: 1.214.329.1520
Read story → 0 comments




Bulk SMS Services - HTTP Gateway Integration
Jun 21 2011 12:24 PM | AWS in Source Code
HTTP API to submit messages on SMPP:
:/bulksms/bulksms?username=XXXX&password=YYYYY&type=Y&dlr=Z&destination=QQQQQQQQQ&source=RRRR&message=SSSSSSSS<&url=KKKK>
: smpp1.kapsystem.com.com
: 8080 or 8000
Parameters are explained below, please note that all the parameters (especially message and url) should be URL-UTF-8 encoded.
Username: User name of the SMPP Account
Password: Password of the SMPP Account
Type: Indicates the type of message.
DLR: Indicates whether the client wants delivery report for this message.
Destination: Mobile Number to which to Send message to (may or may not include a ‘+’ sign), multiple mobile numbers can be separated by commas (note the comma (',') should be URL encoded).
Source: The sender address that should appear in the message
Message: The message to send
URL: If sending a WAP Push message (type=4), this holds the link that you wish to send, for any other type of message, no value needs to be supplied for this field (if specified will be ignored) . Just like “message” field, this field should also be URL encoded with UTF-8 character encoding (even for sending non-ASCII domain names).
Read story → 0 comments




How to build an advanced ASP.NET AJAX Photo Editor
Feb 13 2011 05:13 PM | AWS in Code Samples
This <strong>ImageDraw</strong> demo demonstrates how easily you can use <strong>ImageDraw object model</strong> and <strong>ASP.NET AJAX Framework</strong> to design an advanced AJAX-based Photo Editor.
The following figure is a screenshot of the ASP.NET AJAX Photo Editor application that leverages ASP.NET AJAX Framework, ASP.NET AJAX Control Toolkit and ImageDraw.
<img style="vertical-align: middle;" src="http://www.neodynami...0/figure01.jpg" alt="" />
<strong>This AJAX Photo Editor features:</strong>
<strong>- UI leveraging ASP.NET AJAX Control Toolkit</strong>
The left pane of AJAX Photo Editor UI leverages on ASP.NET AJAX Control Toolkit components like Accordion and Slider. The Accordion control is used to divide some Imaging Effects in categories. Those Imaging effects leverage ImageDraw object model and Slider controls are used for setting up some parameters that each effects feature.
For example, the following figure shows how Slider controls are used so the user can specify which Brightness, Contrast, Gamma, Saturation and Hue levels must be apply on the target photo.
<img src="http://www.neodynami...0/figure02.jpg" alt="" />
<strong>- Imaging Effects provided by ImageDraw</strong>
AJAX Photo Editor provides some of the most common imaging effects that well know photo editor software features like Basic Tuning (Brightness, Contrast, Gamma, Saturation, and Hue), Coloring (Convert to Black & White/Grayscale, Sepia and Negative/Invert), Rotation and Flipping and Scaling. In addition to those basic imaging effects, we introduced two new interested effects called Perspective View and Reflection which are built-in ImageDraw object model.
For example, the following figures show Coloring settings like Black & White/Grayscale and Negative/Invert:
<img style="vertical-align: middle;" src="http://www.neodynami...0/figure03.jpg" alt="" />
The following figure shows Rotation and Flipping feature:
<img style="vertical-align: middle;" src="http://www.neodynami...0/figure04.jpg" alt="" />
And the last one figure shows Composite Imaging Effects (Reflection + Perspective View + Scaling):
<img style="vertical-align: middle;" src="http://www.neodynami...0/figure01.jpg" alt="" />
<strong>Links:</strong>
<a href="http://www.neodynami...38;sid=90">This Demo</a>
<a href="http://www.neodynami...;prodid=8">More Demos</a>
<a href="http://www.neodynami...did=8">Download ImageDraw SDK for .NET</a>
<a href="http://www.neodynami...;prodid=8">More Information about Neodynamic ImageDraw SDK for .NET</a>
Neodynamic
.NET Components & Controls
<a href="http://www.neodynami...dynamic.com</a>
Read story → 0 comments




Convert your Text files to PDF
Feb 13 2011 05:11 PM | AWS in Code Samples
<p>We often get queries from customers who would like to convert their text files to PDF. We are often asked if we can quickly provide some code which can accomplish this task and save them the effort of going through the documentation. So for the benefit of everyone, we present here a simple example which can be used as it is to easily and efficiently convert a text file to PDF using <strong><a href="http://www.aspose.co...></strong>.</p>
<p><strong>[C#]</strong></p>
<code>
System.IO.TextReader tr = new StreamReader("test.txt");
//Instantiate Pdf pbject by calling its empty constructor
Aspose.Pdf.Pdf pdf1 = new Aspose.Pdf.Pdf();
//Create a new section in the Pdf object<br />
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();
//Create a new text paragraph and pass the text to its constructor as argument
Aspose.Pdf.Text t2 = new Aspose.Pdf.Text(tr.ReadToEnd());
sec1.Paragraphs.Add(t2);
pdf1.Save("test.Pdf");
<p><strong>[VB.NET]</strong></p>
<p>Dim tr As System.IO.TextReader = New StreamReader("test.txt")
\\'Instantiate Pdf pbject by calling its empty constructor
Dim pdf1 As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf()
\\'Create a new section in the Pdf objects
Dim sec1 As Aspose.Pdf.Section = pdf1.Sections.Add()
\\'Create a new text paragraph and pass the text to its constructor as argument
Dim t2 As Aspose.Pdf.Text = New Aspose.Pdf.Text(tr.ReadToEnd())
sec1.Paragraphs.Add(t2)
pdf1.Save(\\"test.Pdf\\")
</code>
<p><strong>[Java]</strong></p>
<code>
try{ try
StringBuffer sb = new StringBuffer(1024);
BufferedReader reader = new BufferedReader(new FileReader("test.txt"));
char[] chars = new char[1024];
int numRead = 0;
while( (numRead = reader.read(chars)) > -1){
sb.append(String.valueOf(chars));
<p>}</p>
<p>reader.close();
//Instantiate Pdf pbject by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a new section in the Pdf object
Section sec1 = pdf1.getSections().add();
//Create a new text paragraph and pass the text to its constructor as argument
Text text1 = new Text(sec1,sb.toString());
sec1.getParagraphs().add(text1);
pdf1.save(new FileOutputStream(new File("test.pdf")));
}catch(java.io.IOException ioe){
System.out.println(ioe.getMessage());
}catch(AsposeBaseException e){
System.out.println(e.getMessage());
}
</code>
<p><strong>More about Aspose.Pdf</strong></p>
<p>- <strong><a href="http://www.aspose.co....asp\">Download evaluation version</a></strong> of Aspose.Pdf.<br />
- <strong><a href="http://www.aspose.co...ex.html">Online documentation</a></strong> of Aspose.Pdf.<br />
- <strong><a href="http://www.aspose.co...os</a></strong> of Aspose.Pdf.<br />
- Post your technical questions/queries to <strong><a href="http://www.aspose.co...x\\">Aspose.Pdf Forum</a></strong>.</p>
<p><strong>Contact Information</strong><br />
Suite 119, 272 Victoria Avenue<br />
Chatswood, NSW, 2067<br />
Australia<br />
<strong><a href="http://www.aspose.com/">Aspose - The .NET and Java component publisher</a></strong><br />
<strong>sales@aspose.com </strong><br />
Phone: 888.277.6734<br />
Fax: 866.810.9465l</p>
Read story → 0 comments




Microsoft Office Live Communications Server 2003 SDK
Feb 13 2011 04:59 PM | AWS in Source Code
The Microsoft Office Live Communications Server 2003 SDK Documentation provides documentation for building custom Session Initiation Protocol (SIP) applications that run on Live Communications Server 2003.
The Live Communications Server 2003 SDK Documentation is designed to assist developers who are building custom SIP applications for Live Communications Server 2003, and also to assist administrators who want to manage Live Communications Servers using Windows Management Instrumentation (WMI) applications.
<h4>System Requirements</h4>
<ul>
<li><strong>Supported Operating Systems: </strong></li>
<li>Windows Server 2003</li>
<li>HTML Help viewer</li>
<li>Compressed (.zip) file extraction support</li>
</ul>
<a href="http://www.microsoft...lang=en&tm" target="_blank">Download SDK</a>
Read story → 0 comments




Source Code Outliner PowerToy
Feb 13 2011 04:55 PM | AWS in Source Code
The Source Outliner PowerToy is a Visual Studio 2008 extension that provides a tree view of your source code's types and members and lets you quickly navigate to them with filtering inside the editor.
The Source Code Outliner PowerToy was created as a package using the Visual Studio SDK for Visual Studio 2008. For more information about VSX, visit the <a href="http://msdn.com/vsx/">Visual Studio Extensibility Developer Center</a>. The project source code (in both C# and Visual Basic) can be found on the <a href="http://www.codeplex....rceCodeOutliner project on CodePlex.com</a>.
<h4>System Requirements</h4>
<ul>
<li><strong>Supported Operating Systems: </strong>Windows Vista; Windows XP, Visual Studio 2008, Standard edition or above.</li>
</ul>
<a href="http://www.microsoft...lang=en&tm" target="_blank">Download</a>
Read story → 0 comments




How can you Insert / Delete Rows Programmatically
Feb 13 2011 04:08 PM | AWS in Code Samples
Do you wish to have worksheets that can be easily updated to keep up with your constantly changing business needs?
Using <strong><a href="http://www.aspose.co...l">Aspose.Cells APIs</a></strong>, you can <em><strong>quickly insert new rows, columns, cells, and worksheets — and just as easily delete them </strong></em>— calling a few methods only and your task is performed with excellence.
While you are creating a new worksheet from scratch or working with an existing worksheet, you might need to add extra rows / columns into your worksheet to accommodate more data or for your specific need.
Alternatively, it can also be required to delete rows / columns from specified positions / locations in the worksheet. To fulfill these requirements, <a href="http://www.aspose.co...ls</strong></a> provides simplest set of APIs that can easily perform your desired task within no time.
There are two methods that Aspose.Cells offers in this regard i.e., <em><strong>InsertRows</strong></em> and <em><strong>DeleteRows</strong></em>, these two methods are optimized related performance and efficient enough to do the job very quickly.
So if you are in need to insert some sets of rows or remove a number of rows, it is recommended that you should always use InsertRows and DeleteRows methods instead of repeatedly using InsertRow and DeleteRow methods in a loop.
<a href="http://www.aspose.co...ls</strong></a> works in the same way as <em><strong>Microsoft Excel</strong></em> does. When rows or columns are added, the contents in the worksheet are shifted to downwards or right side but if rows or columns are removed, the contents in the worksheet will be shifted to upwards or left side. Moreover, the references in other worksheets are updated accordingly upon insertion / deletion of rows.
Following example shows the usage of InsertRows and DeleteRows methods
<strong>[C#]</strong> //Instantiate a Workbook object. Workbook workbook = new Workbook(); //Load a template file. workbook.Open(\\"d:\\test\\MyBook.xls\\"); //Get the first worksheet in the book. Worksheet sheet = workbook.Worksheets[0]; //Insert 10 rows at row index 2 (insertion starts at 3rd row) sheet.Cells.InsertRows(2, 10); //Delete 5 rows now. (8th row - 12th row) sheet.Cells.DeleteRows(7, 5); //Save the excel file. workbook.Save(\\"d:\\test\\out_MyBook.xls\\"); <strong>[VB]</strong> \\'Instantiate a Workbook object. Dim workbook As Workbook = New Workbook \\'Load a template file. workbook.Open(\\"d:\test\MyBook.xls\\") \\'Get the first worksheet in the book. Dim sheet As Worksheet = workbook.Worksheets(0) \\'Insert 10 rows at row index 2 (insertion starts at 3rd row) sheet.Cells.InsertRows(2, 10) \\'Delete 5 rows now. (8th row - 12th row) sheet.Cells.DeleteRows(7, 5) \\'Save the excel file. workbook.Save(\\"d:\test\out_MyBook.xls\\") <strong>[Java]</strong> //Instantiate a Workbook object. Workbook workbook = new Workbook(); //Load a template file. workbook.open(\\"d:\\test\\MyBook.xls\\"); //Get the first worksheet in the book. Worksheet sheet = workbook.getWorksheets().getSheet(0); //Insert 10 rows at row index 2 (insertion starts at 3rd row) sheet.getCells().insertRows(2, 10); //Delete 5 rows now. (8th row - 12th row) sheet.getCells().deleteRows(7, 5,true); //Save the excel file. workbook.save(\\"d:\\test\\out_MyBook.xls\\");
<strong>About Aspose.Cells for .NET</strong>
- <a href="http://www.aspose.co...strong>Download evaluation version</strong></a> of Aspose.Cells for .NET.
- <a href="http://www.aspose.co...><strong>Online documentation</strong></a> of Aspose.Cells for .NET.
- <a href="http://www.aspose.co...os</strong></a> of Aspose.Cells for .NET.
- Post your technical questions/queries to <strong><a href="http://www.aspose.co...x">Aspose.Cells for .NET Forum</a></strong>.
<strong>Contact Information</strong>
Suite 119, 272 Victoria Avenue
Chatswood, NSW, 2067
Australia
<a href="http://www.extreme-v...><strong>Aspose - The .NET and Java component publisher</strong></a>
<a href="mailto:sales@aspose.com">sales@aspose.com</a>
Phone: 888.277.6734
Fax: 866.810.9465l
Read story → 0 comments




Building a Mobile Game in Visual Studio
Feb 13 2011 04:06 PM | AWS in Code Samples
The latest version of Microsoft® Visual Studio® includes a lot of new treats for mobile developers. In addition to new debugging tools and emulators, it includes the Windows® Mobile 5 SDK, .NET® Compact Framework 3.5, and SQL® Server Compact Edition 3.5 out of the box, without additional installs. This walkthrough gives you the code and assets for a fully functional Hangman-style game called "W80 Words" (weighty words), which takes advantage of the new platform and coding environment.
Microsoft Visual Studio 2008 includes a lot of useful features for mobile developers, especially those of the database persuasion. On the one hand, you have the latest and greatest version 3 emulators, Windows Mobile 5 libraries and project templates pre-installed, and unit testing for mobile. (See the Windows Mobile Team Blog for an overview.) On the other hand, you have LINQ, a new syntax for working directly with datasets. But what is the sound of two hands clapping without touching? That's right—silence.
Here's the scoop on LINQ for mobile: technically, LINQ works with .NET Compact Framework 3.5, though with limitations. According to MSDN you get standard query operators, LINQ to DataSet, and LINQ to XML. However, the more useful LINQ to SQL designer is not supported in SQL Server Compact Edition 3.5 (see this thread). Nor will you find any LINQ objects available in your mobile project, despite having a System.Linq reference added by default. In fact, I can find neither details nor code samples regarding LINQ for Mobile on the Internet. Nor can I get any additional information from the fine folks at Microsoft.
Read the rest at <a href="http://www.devx.com/.../Article/36659" target="_blank">Devx</a>
Read story → 0 comments








Sign In
Create Account
