Aspose pdf examples

Aspose pdf examples DEFAULT

.NET PDF API Features

Generate PDF documents using product API

Add tables & Graph objects during PDF generation

Transform XSL-FO & XML to PDF

Convert PDF to multiple formats

Add, update, delete text & images from PDF documents

Insert, extract, append & concatenate PDF documents

Add, modify and remove bookmarks

Insert text, image or page stamp

Insert text and image in headers and footers

Encrypt and decrypt PDF as well as modify passwords

Manipulate, export and import annotations

Variety of printing options

Convert PDF to Word, PowerPoint & HTML Formats

With as little as 2 lines of code, you can implement robust PDF to Word, PowerPoint or HTML conversion features for your .NET applications.

Save PDF in different formats - C#

Furthermore, you can either transform each page of a PDF file to conventional raster & vector image formats such as BMP, JPEG, PNG, GIF, EPS, SVG or convert the whole PDF to multi-page TIFF. You may also convert to XLS, EPS, SVG, XPS, LaTex, TXT and PDF/A format with ease.

Create & Manipulate PDF Documents On the Fly

Aspose.PDF for .NET offers the capability to generate documents from scratch. You can use its API or transform images, XML, XSL-FO, HTML, SVG, PCL, XPS, EPUB or simple text files to PDF documents. Moreover, you can specify XMP metadata, author details, creator details, and title information during the PDF generation.

This library is also a good choice when you need to edit or manipulate existing PDF documents. It allows you to concatenate or merge two or more PDF files, append new pages to an existing file, extract pages, insert pages at a particular location in an existing file, split documents or create N-up's (number of pages over the single page) and booklets.

Set Security Constraints for PDF Documents

Aspose.PDF for .NET offers the facility to encrypt and decrypt documents with either bit,bit or bit encryption and provides the ability to specify user passwords for further security. Content modification in documents such as copying the content, printing the file, completing form fields, degraded printing, annotation modification as well as document assembly can also be restricted.

API allows you to further improve security mechanism by using PKCS#1, PKCS#7 and PKCS#7 detached signature types, and with the use of the digital certificate. You may specify the certificate level and set the graphical appearance of the signature as per application requirements.

Process PDF Form Fields

Aspose.PDF for .NET provides advanced features beyond simple form fields processing. With this single product, you get a bunch of features from the addition of form fields to advanced abilities such as dynamically rename, remove and copy form fields across the documents, set JavaScript for the push button and flatten form fields. This product is also great when it comes to specifying field attributes such as READ_ONLY, REQUIRED, NO_EXPORT, HIDDEN, NO ZOOM. You can also easily specify visual attributes such as field Alignment, BorderStyle, ButtonStyle, FontSize, TextColor, TextEncoding or define custom positioning to place the form fields at an absolute position within the document.

Aspose.PDF for .NET also supports importing & exporting form fields data from XML, FDF or XFDF files. Moreover, you can bind form fields with OLEDB or ODBCDB data sources. API also allows to import an image or barcode, get field data with rich text formatting or add submit button to post data to a specified URL.

Graph & Imaging Capabilities

Aspose.PDF for .NET provides support for many different types of graphs: graphs can be drawn on any page location specified by coordinates and existing graphs can be rotated and scaled to suit your requirements. You may also try converting images residing on disk, memory or web location, to PDF format. Along with conventional image types, CCITT (fax) images, multi-page TIFF images and transparent GIF images are also supported.

Convert PDF to CCITT4 compressed TIFF - C#

Aspose.PDF for .NET also allows you to add, replace, extract or delete images already present in a PDF file. You may also add images as a watermark while generating documents or manipulating existing files.

Conversion of PDF documents to raster images powered by Aspose.Imaging export modules.

Adobe Acrobat Automation – Not Needed

Aspose.PDF for .NET APIs are built using managed code that can be installed and deployed as a single .NET assembly without needing Adobe Acrobat installed. It is easier and flexible to use compared to Adobe Acrobat automation.


C# (CSharp) Aspose.Pdf Document Examples

public void CreateIndex(Analyzer analayer) { FSDirectory fsDir = new SimpleFSDirectory(new DirectoryInfo(_indexerFolder)); IndexWriter indexWriter = new IndexWriter(fsDir, analayer, true, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED); Stopwatch stopWatch = Stopwatch.StartNew(); int analyzedCount = 0; string[] files = System.IO.Directory.GetFiles(_textFilesFolder, this._fileSearchPattern, SearchOption.AllDirectories); //统计需要索引的文件页数 int totalPages = GetTotalPages(files); WriteLog("Total pages statistics takes {0}ms", stopWatch.Elapsed.Milliseconds); stopWatch.Restart(); TextAbsorber textAbsorber = new TextAbsorber(); //开始索引 foreach (string pdfFile in files) { var fileInfo = new FileInfo(pdfFile); var fileName = fileInfo.Name; Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(pdfFile); WriteLog("Current file is {0}", pdfFile); //注意pdf页码从1开始 for (int i = 1;i<=pdfDocument.Pages.Count;i++) { Page page = pdfDocument.Pages[i]; page.Accept(textAbsorber); string pageContent = textAbsorber.Text; Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document(); doc.Add(new Field(LuceneConfig.Field_Path, pdfFile, Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.Add(new Field(LuceneConfig.Field_FileName, fileName, Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field(LuceneConfig.Field_PageNumber, i.ToString(), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field(LuceneConfig.Field_ContentByPage, pageContent, Field.Store.NO, Field.Index.ANALYZED)); indexWriter.AddDocument(doc); analyzedCount++; RaiseProgressChanged(analyzedCount * / totalPages); } } indexWriter.Optimize(); indexWriter.Dispose(); stopWatch.Stop(); Console.WriteLine("All completed. It takes {0}ms", stopWatch.Elapsed); }
  1. Johnny pag bike
  2. Ender filament
  3. Craigslist 280zx
  4. Husqvarna usa motorcycles
  5. 2018 safeway open

C# (CSharp) Aspose.Pdf.Document Examples

public static void CompletedCode() { // ExStart:CompletedCode // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles(); // Create PdfFileEditor object PdfFileEditor pdfEditor = new PdfFileEditor(); // Create a MemoryStream object to hold the resultant PDf file using (MemoryStream Concatenated_Stream = new MemoryStream()) { // Save concatenated output file pdfEditor.Concatenate(new FileStream(dataDir + "input1.pdf", FileMode.Open), new FileStream(dataDir + "input2.pdf", FileMode.Open), Concatenated_Stream); // Insert a blank page at the begining of concatenated file to display Table of Contents Aspose.Pdf.Document concatenated_pdfDocument = new Aspose.Pdf.Document(Concatenated_Stream); // Insert a empty page in a PDF concatenated_pdfDocument.Pages.Insert(1); // Hold the resultnat file with empty page added using (MemoryStream Document_With_BlankPage = new MemoryStream()) { // Save output file concatenated_pdfDocument.Save(Document_With_BlankPage); using (var Document_with_TOC_Heading = new MemoryStream()) { // Add Table Of Contents logo as stamp to PDF file PdfFileStamp fileStamp = new PdfFileStamp(); // Find the input file fileStamp.BindPdf(Document_With_BlankPage); // Set Text Stamp to display string Table Of Contents Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); stamp.BindLogo(new FormattedText("Table Of Contents", System.Drawing.Color.Maroon, System.Drawing.Color.Transparent, Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, true, 18)); // Specify the origin of Stamp. We are getting the page width and specifying the X coordinate for stamp stamp.SetOrigin((new PdfFileInfo(Document_With_BlankPage).GetPageWidth(1) / 3), ); // Set particular pages stamp.Pages = new int[] { 1 }; // Add stamp to PDF file fileStamp.AddStamp(stamp); // Create stamp text for first item in Table Of Contents var Document1_Link = new Aspose.Pdf.Facades.Stamp(); Document1_Link.BindLogo(new FormattedText("1 - Link to Document 1", System.Drawing.Color.Black, System.Drawing.Color.Transparent, Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, true, 12)); // Specify the origin of Stamp. We are getting the page width and specifying the X coordinate for stamp Document1_Link.SetOrigin(, ); // Set particular pages on which stamp should be displayed Document1_Link.Pages = new int[] { 1 }; // Add stamp to PDF file fileStamp.AddStamp(Document1_Link); // Create stamp text for second item in Table Of Contents var Document2_Link = new Aspose.Pdf.Facades.Stamp(); Document2_Link.BindLogo(new FormattedText("2 - Link to Document 2", System.Drawing.Color.Black, System.Drawing.Color.Transparent, Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, true, 12)); // Specify the origin of Stamp. We are getting the page width and specifying the X coordinate for stamp Document2_Link.SetOrigin(, ); // Set particular pages on which stamp should be displayed Document2_Link.Pages = new int[] { 1 }; // Add stamp to PDF file fileStamp.AddStamp(Document2_Link); // Save updated PDF file fileStamp.Save(Document_with_TOC_Heading); fileStamp.Close(); // Now we need to add Heading for Table Of Contents and links for documents PdfContentEditor contentEditor = new PdfContentEditor(); // Bind the PDF file in which we added the blank page contentEditor.BindPdf(Document_with_TOC_Heading); // Create link for first document contentEditor.CreateLocalLink(new System.Drawing.Rectangle(, , , 20), 2, 1, System.Drawing.Color.Transparent); // Create link for Second document // We have used new PdfFileInfo("d:/pdftest/Input1.pdf").NumberOfPages + 2 as PdfFileInfo.NumberOfPages(..) returns the page count for first document // And 2 is because, second document will start at Input1+1 and 1 for the page containing Table Of Contents. contentEditor.CreateLocalLink(new System.Drawing.Rectangle(, , , 20), new PdfFileInfo(dataDir + "Input1.pdf").NumberOfPages + 2, 1, System.Drawing.Color.Transparent); // Save updated PDF contentEditor.Save( dataDir + "Concatenated_Table_Of_Contents.pdf"); } } } // ExEnd:CompletedCode }
Explore for .NET API Examples using Visual Studio Plugin

Working with Aspose.Pdf for .NET

Aspose.Pdf for .NET is a popular tool that can be used to create PDF documents. It helps you to create and manipulate PDF documents in .NET with ease. Most importantly, you can leverage Aspose.Pdf to manipulate existing PDF documents sans the need of having Adobe Acrobat installed in your system. This article provides an overview of Aspose.Pdf and how we can work with it in .NET applications.

Aspose.Pdf Features

Aspose.Pdf provides many interesting features. Some of the important features include the following:

  • Compression of PDF documents
  • Add or remove bookmarks
  • Support for graphs, fonts and hyperlinks
  • Convert pages to images
  • Print PDF documents
  • Import and Export PDF from data
  • Encrypt or decrypt PDF documents
  • Digitally sign PDF documents

Installing Aspose.Pdf

You can install Aspose.Pdf for .NET via NuGet Package Manager. To install Aspose.Pdf you can run the following command in the Package Manager Console.

Getting Started with Aspose.Pdf in Visual Studio

In this section, we will explore how we can work with Aspose.Pdf in .NET. We will learn how to create a PDF document using the Aspose.Pdf API.

Here's the list of the steps that you would need to follow to create a PDF document using the Aspose API for .NET.

  1. Open Visual Studio (I'm using Visual Studio in my system though you can use the earlier versions, i.e., Visual Studio or Visual Studio as well)
  2. Create a new C# console application project
  3. Save the project with a name
  4. Next, create an instance of the Pdf class (this class is available as part of the Aspose.Pdf.Generator) namespace
  5. Specify the license (if you have purchased a license) using the License class
  6. Add one or more sections to the Pdf object. Note that the Sections collection is used to hold one or more sections.
  7. Add a text paragraph to the section you just created
  8. Lastly, call the Save method on the Pdf instance to generate your PDF document

And that's all you need to do to create a PDF document using the Aspose.Pdf API.

Applying the License

Applying the license to the Aspose.Pdf is simple. All you need to do is create an instance of the Aspose.Pdf.License class, call the SetLicense method and pass the license file name as a parameter to the method.

The easiest way to apply the license to Aspose.Pdf component is by placing the license file inside the same directory where the Aspose.dll resides. This way you would not have to have the hassle of passing path while specifying the license file name to the SetLicense method. The following code snippet shows how you instantiate the License class, load the license from a license file and then make a call to the SetLicense method to apply the license.

Learn more about how to work with Aspose.Pdf from here.

If you would like to explore more on Aspose.Pdf or on any of the Aspose family of products, you can refer to their documentation.

The Complete Code Listing

The following code listing illustrates how you can create a new PDF document using the Aspose.Pdf API.

Note that the following namespaces should be included in your program for it to compile and work.


Aspose.Pdf for .NET is a popular PDF document creation component that you can use from within your .NET applications to create, edit and manage PDF documents without the need of having Acrobat installed in your system. This article presented a discussion on Aspose.Pdf, its incredible features and how you can get started using it in our .NET applications. Happy reading!


Pdf examples aspose

Aspose PDF Converter Tutorial and Comparison

In this article I will examine how to work with the Aspose PDF converter in .NET by comparing its programming structure, provided functions, licensing and pricing packages. Follow the step-by-step tutorials and use the code examples to see for yourself which library is best for working with PDFs in your C# project.

Header Footer Style Functions

Jump to Article

Try IronPDF free for development

Compare Aspose PDF Functions


About Aspose PDF API

Aspose API provider is a file format component provider company. The specialized component Aspose PDF DLL is used to deal with PDF files. It allows developers to create and set the properties of PDF documents programmatically. We can also use it to add Watermarks, Text Stamps, Bookmarks, and compress PDF files.

About IronPDF

IronPDF C# Library is provided by Iron Software for generating, editing, and manipulating PDF files in .NET projects. It is known well becuase it requires only a few lines of code with a simple programming structure to get the required PDF files. By using it, we can easily generate PDF files from many sources (such as HTML String, HTML Files, or URLs), and then set its properties (such as Page Number, Headers, Page Margins or Watermarks and more).

1. Aspose PDF Licensing and Pricing

When we need to purchase APIs for our project, pricing and licensing packages can play a very important role in the selection.

Here we compare the main 4 perpetual licenses provided by Aspose PDF to their IronPDF counterparts.

License CoverageIronPDFAspose.PDF
# of License Options28 customizable license options for your needs4 licenses available for general needs
1 developer, 1 project, 1 location$ with 1 yr free supportNo license
1 developer, unlimited projects, 1 location$ with 1 yr free support$ with standard suport or $ with paid support
1 developer, unlimited projects, unlimited locations$1, with 1 yr free support$2, with standard support or $4, with paid support
Up to 10 developers, unlimited projects, up to 10 locations$1, with 1 yr free support$4, with standard suport or $7, with paid support
1 SaaS/OEM product, unlimited developers, unlimited locations$1, with 1 yr free supportNo license
Unlimited SaaS/OEM products, up to 10 developers, unlimited locations$5, with 1 yr free support$13, with standard suport or $21, with paid support
Purchase a licenseIronPDF LicensesAspose PDF Licenses

While Aspose offers multiple tiers of support pricing, IronPDF offers more affordable licenses, customizable options, and free support for all coverage.

Aspose PDF Supported Platforms

Let's look at the supported framework and platforms of Aspose.PDF.

Aspose PDF Supported Frameworks

  • .NET Framework or above
  • .NET Core
  • .NET Core

Aspose PDF Supported Platforms

Aspose PDF Dependencies

If we want to use the Aspose.PDF component in our project, then we need to make sure that we fulfill the dependencies in our Visual Studio Project:

Aspose PDF for .NET Framework

Aspose PDF For .NET Standard

Aspose PDF For .NET Standard

IronPDF Supported Platforms

.Net framework or above for

.NET Standard & Core 2, 3 & 5

Cloud hosting services included

IronPDF can be used with:

  • ASP.Net MVC Application
  • ASP.Net Web Forms Application
  • Console Application
  • Cloud Application
  • Service
  • Function
  • Desktop Application.

IronPDF Dependencies

IronPDFPDF for .NET Framework

IronPDFPDF for .NET Standard or above

Step 1: Installation

Aspose PDF Download

There are two possible ways that we can use Aspose.PDF components in our project, and there is no difference whichever one you choose.

Aspose.PDF Download via NuGet Package

Open the NuGet Package Manager of your project in Visual Studio and browse , then install it.

Install with Aspose.PDF.dll

You can also download Aspose.PDF.dll and extract the downloaded file. It will create some folder and files.

  • Go to folder
  • Go to the required .Net Framework folder, which includes .
  • Add the reference of this file in your Visual Studio project.

Now, you can use Aspose.PDF functions and classes namespace.

Install IronPDF

We can also install IronPDF in our project using two different ways.

Install IronPDF with NuGet

The easiest technique is to add IronPDF in the project.

  • Go to NuGet Package Manager in Visual Studio project and browse
  • Install IronPDF

Download IronPDF.dll

Another option is to download IronPDF.dll, then add its reference to the project. After this, we can use IronPDF classes and provided functions from the namespace.

How To Tutorials

2. HTML String to PDF

Let's take the first major use case: that we want to create a PDF file by HTML string and save it in the target location. Let's compare the code required and start with IronPDF.

IronPDF Convert HTML String to PDF

The above code will create a PDF file and save it in the target location.


  • If you do not give the full path and just give the file name as we do in the above example, then the PDF file will be created in the folder of your project.
  • In the case that you want to generate the file in then you can write:

Read more about how to create PDF from HTML and working with PDF files using IronPDF.

Aspose PDF Convert HTML String to PDF

The above code will create a new PDF file , just like we created using IronPDF.

Difference between Aspose and IronPDF

Using Aspose.PDF, we first need to create a new Page, HtmlFragment, and add it into the page paragraph, and then save it to the target location. IronPDF has no such type of coding structure and provides a way with many fewer lines of code.

Read more about how to Convert PDF with Aspose PDF DLL and working with Aspose.PDF in .NET applications.

3. HTML File to PDF

Now, let's take another use case: create a PDF file from an existing HTML file.

Note: Assume that we have an HTML file which exists in the folder of the project and we want to create a PDF file from it.

IronPDF Convert HTML File to PDF

The above code will create a new PDF file from the file.

Aspose PDF Convert HTML File to PDF

The above code will also create a new PDF file from , but here we need to specify .

4. Work with Headers and Footers

It is a common requirement that we need to add Headers and Footers on PDF pages for different purposes such as including the document name, page numbers, references, date and time, or other similar functions. Both components provide different types of functions to accomplish these:

IronPDF Headers and Footers Functions

IronPDF has the following properties by which we can easily set Headers and Footers of newly created PDF file pages.

  • to write text on the left side of the Header or Footer.
  • to write text on the right side of the Header or Footer.
  • to write text in the center of the Header or Footer.
  • to specify the font size of the text of the Header of Footer.
  • to specify the font family of the Header or Footer.
  • to draw a line that separates page content and the Header or Footer.
  • to specify the space between page content and the Header or Footer.

The following example showcases how to use the above properties.

The above code will create a PDF file, , and print on the left side of the Header, on the right side of the Header, and on the right side of the Footer.

Read more about how to Add Header and Footers in an HTML to PDF conversion with full list of functions provided by IronPDF.

Aspose PDF Headers and Footers Functions

To deal with Headers and Footers, introduced the class. By using it, we can easily add Headers and Footers on PDF file pages and set their properties. There are many subclasses of , but here we will discuss the basic three classes and their properties which are commonly used in our daily work.

VerticalAlignment (used to set the vertical alignment of TextStamp and has the following properties)

  • None for no vertical alignment.
  • Top sets the vertical alignment to the top.
  • Center sets vertical alignment in the center.
  • Bottom sets vertical alignment the bottom.

HorizontalAlignment (used to set the horizontal alignment of TextStamp and has the following properties)

  • None for no horizontal alignment.
  • Left sets horizontal alignment to left.
  • Right sets horizontal alignment to right.
  • Center sets horizontal alignment in the center.
  • Justify Text will be aligned on both left and right margins.
  • FullJustify all lines will be left-aligned and right-aligned

TextState (used to set the properties of the text, and has some basic properties)

  • Font sets the font of the text
  • FontStyles sets the font style of the text.
  • FontSize sets the font size of the text.
  • Color sets the color of the text.
  • Underline sets the underline for the text.
  • StrikeOut sets the strikeout style for the text.

See the following example for how to use the above properties to set Header and Footer.

This will create the same PDF file as we created using IronPDF: on the left side of the Header, on the right side of the Header and on the right side of page bottom.

You can compare the ease of working with IronPDF and their simple functions to the list provided by Aspose.

Read more about using Aspose Manage Header and Footer of PDF File.

5. Add Page Numbers to PDF File

Let's suppose that we want to create a PDF file from an HTML string, and then add a page number to the Header of the page.

IronPDF Add Page Numbers to PDF File

The above code will create a PDF file , insert the HTML data, and add the in the page Header.

Output: Here's a screenshot of our newly created file.

Aspose PDF Add Page Numbers to PDF File

Aspose.PDF does not provide the predefined function to set Headers and Footers, unlike IronPDF. Using Aspose.PDF, we would need to work with and set its alignment for the Header and Footer on the PDF page. See the example below.

Output: Here is the screenshot of newly created file.

6. Add Watermarks

We often need to add Watermarks on our PDF file pages for advertisement, security, or copyright issues. Let's create a PDF file from an HTML string, and then add Watermark using both components.

IronPDF Add Watermark

To add a watermark on the PDF page, IronPDF provides the class.


  • = the actual text written in HTML which displays as Watermark text.
  • = write the page number as the Watermark.
  • = set the opacity of the Watermark.
  • = set the rotation of the Watermark content clockwise.
  • = hyperlink that the Watermark will link to.
  • = set the position of the Watermark, which we can set using the following positions:
    • TopLeft
    • TopCenter
    • TopRight
    • MiddleLeft
    • MiddleCenter
    • MiddleRight
    • BottomLeft
    • BottomCenter
    • BottomRight

Let's see the following example, where we will understand how to use the above functions in our project.

VB  C#

Output: Here is the screenshot of the newly created file with watermark.

If we want to add a Watermark on multiple pages, but not all, then we can use the function as follows:

If we do want to add a Watermark on all pages, then we can use the function like this:

Read more about how to add a watermark to PDFs.

Aspose PDF Add Watermark

Aspose.PDF does not provide a special function to add text as a Watermark, unlike IronPDF. Instead, we need to use the class. Let's see how that works.

Output: And here is the screenshot of the stamped file.

Read more about using Aspose PDF add stamp and watermark in your files and projects.

Difference between Aspose and IronPDF Watermarking

When talking about Watermarks on selected pages or multiple pages, there are no specified functions when using Aspose.PDF. But we can do it using page iteration of a PDF file with , , or etc. This does create bulky code and requires us to add different conditions if we want to add a Watermark only on select pages.

Licensing and Pricing

7. Compare License Options

As developers, we all want to complete our projects with minimal cost and resources, and budget can be especially important. Review the chart to compare what license is right for your needs and budget.

IronPDF offers licenses with a customizable # of developers, projects, and locations so you can meet the needs of your project and pay only for the coverage you need. Check out the HTML to PDF licenses or contact the support team to get a custom quote and free 30 day deployment trial.


8. Aspose PDF and IronPDF Takeaways

Works with PDF files programmatically.Works with PDF files programmatically.
Developed in .NET framework using C#.Developed in .NET framework using C#.
Supports Windows, Linux, and MacOS.Supports Windows, Linux, and MacOS.
Provides a generalized way to convert page to PDF file.No generalized way to convert pages to PDF file.
Provides predefined functions for Header and Footer.No predefined functions for Header and Footer, need to use .
Can set Watermark styling properties Using HTML and CSS.No support for HTML and CSS for styling properties.
Easily attach a Cover Page to a PDF with just a few lines of code.More difficult to add a cover page to a PDF file.
Licenses start at $Licenses start at $

More from Aspose

9. Aspose Components Overview

Aspose provides a range of components to suit your project needs. See the full list below and compare to other IronPDF products for competitive pricing and clear & condensed code functions.

ComponentSupportsUsageIronSoftware Comparison
Aspose.Words.Net, Java, C++, Android via JavaCreate, edit, convert & print Word files.
Aspose.PDF.Net, Java, C++, Android via JavaWork with PDF files to generate, edit and manipulate the PDFs programmatically.IronPDF
Aspose.Cells.Net, Java, C++, Android via Java, NodeJS via Java, PHP via Java, Python via JavaCreate, edit, import, export and convert Excel files into many formats.IronXL
Aspose.Email.Net, Java, C++, Android via Java, Python via .NETCreate, manipulate, convert and send Outlook Emails, and implement Network Protocols such as SMTP, POP3 & IMAP.
Aspose.Slides.Net, .Net Core, Java, C++, Android via Java, XamarinCreate, manage and convert PowerPoint Presentation and Slides.
Aspose.Imaging.Net, JavaDraw, manipulate, convert, and transform images.
Aspose.BarCode.Net, Java, C++, Android via Java, NodeJS via Java, PHP via JavaCreate and scan any type of Barcodes e,g, 1D, 2D, and Postal.IronBarCode
Aspose.Diagram.Net, Java, Node.JS via JavaWork with with Microsoft Visio files to create, edit and convert them on any platform.
Aspose.CAD.Net, JavaConvert AutoCAD, DWG & DXF drawings to PDF & raster images.
Aspose.PSD.Net, JavaCreate, edit, convert Adobe Photoshop and Adobe Illustrator files programmatically.

Tutorial Quick Access

Explore the IronPDF API Reference

Explore the API Reference for IronPDF C# Library, including details of all of IronPDF’s features, classes, method fields, namespaces, and enums.

View the API Reference


Ubaid is a full-stack developer. He has spent many years in ERP development using different technologies and platforms. He evaluated many market-leading products and found the best Iron product from all.

How to add image to a PDF document in Editor

Best Java code snippets using top 20 results out of )

  • Add the Codota plugin to your IDE and get smart completions

    private void myMethod () {

    • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
    • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
    • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
    • Smart code suggestions by Tabnine


    publicstaticvoid savingToDoc() { Document pdfDocument = new Document(dataDir + "SampleDataTable.pdf"); + "TableHeightIssue.doc", SaveFormat.Doc); }
    publicstaticvoid main(String[] args) { Document pdfDocument = new Document("input.pdf"); HtmlSaveOptions saveOptions = new HtmlSaveOptions();"resultant.html", saveOptions); }
    publicstaticvoid main(String[] args) { Document pdfDocument = new Document("BlueBackground.pdf"); EpubSaveOptions options = new EpubSaveOptions(); options.ContentRecognitionMode = EpubSaveOptions.RecognitionMode.Flow;"BlueBackground.epub", options); }
    publicstaticvoid main(String[] args) { Document document = new Document("Input.pdf"); document.setOpenAction(null);"Output.pdf"); }
    publicstaticvoid main(String[] args) { com.aspose.pdf.LoadOptions options = new com.aspose.pdf.PsLoadOptions(); Document pdfDocument = new Document("", options);"PSToPDF_out.pdf"); } }
    publicstaticvoid main(String[] args) { Document doc = new Document("input.pdf"); PptxSaveOptions pptx_save = new PptxSaveOptions();"output.pptx", pptx_save); }
    publicstaticvoid main(String[] args) { LoadOptions options = new XpsLoadOptions(); Document document = new Document("printoutput.xps", options);"resultant.pdf"); }
    publicstaticvoid main(String[] args) { Document pdfDocument = new Document("LegacyProduct_test.pdf"); ExcelSaveOptions excelsave = new ExcelSaveOptions();"ConvertedFile.xls", excelsave); }
    publicstaticvoid pdfTopdfA3aConversion() { String myDir = "pathToDir"; Document doc = new Document(myDir + "input.pdf"); doc.convert("file.log", PdfFormat.PDF_A_3A, ConvertErrorAction.Delete); + "output.pdf"); }
    publicstaticvoid toDeletePDFPortfolioFile() { Document pdfDocument = new Document("Portfolio_output.pdf"); pdfDocument.getEmbeddedFiles().delete();"NotFolio.pdf"); } }
    publicstaticvoid deleteParticularBookmark() { Document pdfDocument = new Document("source.pdf"); pdfDocument.getOutlines().delete("Child Outline");"noBookmark.pdf"); }
    publicstaticvoid main(String[] args) { Document pdfDocument = new Document("input.pdf"); pdfDocument.getEmbeddedFiles().delete();"output.pdf"); }
    publicstaticvoid main(String[] args) { Document pdfDocument = new Document("input.pdf"); pdfDocument.getForm().delete("textbox1");"output.pdf"); }
    publicstaticvoid main(String[] args) { String dataDir = Utils.getSharedDataDir(PDFToHTMLRenderPDFDataLayersAsSeparateHTMLLayerElement.class) + "PDFToHTML/"; Document doc = new Document(dataDir + "input.pdf"); HtmlSaveOptions htmlOptions = new HtmlSaveOptions(); htmlOptions.setConvertMarkedContentToLayers(true); + "output.html", htmlOptions); }
    publicstaticvoid main(String[] args) { Document pdfDocument = new Document("input.pdf"); FileSpecification fileSpecification = new FileSpecification("sample.txt", "Sample text file"); pdfDocument.getEmbeddedFiles().add(fileSpecification);"output.pdf"); }
    publicstaticvoid main(String[] args) { Document pdfDocument1 = new Document("input1.pdf"); Document pdfDocument2 = new Document("input2.pdf"); pdfDocument1.getPages().add(pdfDocument2.getPages());"Concatenate_output.pdf"); }
    publicstaticvoid main(String[] args) { Document pdfDocument = new Document("input.pdf"); TextBoxField textBoxField = (TextBoxField) pdfDocument.getForm().get("textbox1"); textBoxField.setValue("Updated Value"); textBoxField.setReadOnly(true);"output.pdf"); }
    publicstaticvoid main(String[] args) { Document pdfDocument = new Document("input.pdf"); pdfDocument.getPages().get_Item(1).getAnnotations().delete();"output.pdf"); }
    publicstaticvoid removeUnnecessaryObjects() { Document doc = new Document("source.pdf"); Document.OptimizationOptions opt = new Document.OptimizationOptions(); opt.setRemoveUnusedObjects(true); opt.setRemoveUnusedStreams(true); opt.setLinkDuplcateStreams(true); doc.optimizeResources(opt);"optimized.pdf"); }
    publicstaticvoid main(String[] args) { Document document = new Document("input.pdf"); RgbToDeviceGrayConversionStrategy strategy = new RgbToDeviceGrayConversionStrategy(); for (int idxPage = 1; idxPage <= document.getPages().size(); idxPage++) { Page page = document.getPages().get_Item(idxPage); strategy.convert(page); }"output.pdf"); }

    Similar news:

    .NET API to Process & Manipulate PDF Files


    Integrate PDF creation, processing, manipulation & conversion features into your own .NET applications without needing Adobe Acrobat®.

    Aspose.PDF for .NET allows to work with PDF documents, pages, text, images, attachments, fonts, bookmarks, annotations, forms, operators, stamps, watermarks, links, security, signatures, and printing.

    PDF Processing via .NET

    • Generate PDF documents on the fly through the API or via XML templates.
    • Supports 14 core, Type 1, TruType, Type 3, CJK & Unicode fonts.
    • Extract text from PDF pages or search for particular text segment using regular expressions.
    • Add or extract text & images to & from PDF documents.
    • Concatenate or split PDF files.
    • Linearization of PDF documents for web optimization.
    • Validation support for PDF/A-1a, PDF/A-1b & PDF/A-2a.
    • Manage PDF tables & graphs using easy to understand object model.
    • Convert PDF documents to Office, web, image & PS formats with highest visual fidelity.
    • Manipulate PDF files to manage bookmarks, hyperlinks, watermarks, attachments & annotation.
    • Encrypt or decrypt PDF documents as well as set document privileges or modify passwords.
    • Manage PDF forms to add, delete, move, flatten or decorate form fields. Developers may also import or export XML, FDF or XFDF data.
    • Digitally sign PDF documents or remove signatures. Also, verify if PDF is signed and signature is valid.
    • Print PDF documents to physical or virtual printers with or without print dialog.
    • Set document viewer preferences as well as manipulate document information & XMP metadata.

    Read & Write PDF & Other Formats

    Fixed Layout: PDF, PDF/A, PDF/UA, XPS
    Books: EPUB
    Web: HTML, MHTML

    Save PDF Documents As

    Microsoft Office: DOC, DOCX, XLS, XLSX, PPTX
    Images: JPEG, PNG, BMP, TIFF, EMF
    Other: MobiXML, XML

    Read Formats

    PostScript: PS

    Platform Independence

    Aspose.PDF for .NET can be used to build applications for Windows, Mac OS X x64 as well as for Linux x Developers may also code in PHP, VBScript, Delphi & C++ programming languages while using Aspose.PDF for .NET via COM Interop.

    Getting Started with Aspose.PDF for .NET

    Are you ready to give Aspose.PDF for .NET a try? Simply execute from Package Manager Console in Visual Studio to fetch the NuGet package. If you already have Aspose.PDF for .NET and want to upgrade the version, please execute to get the latest version.

    Create a PDF Document from Scratch

    // initialize document objectDocumentdocument=newDocument(); // add a pagePagepage=document.Pages.Add(); // add text to the new pagepage.Paragraphs.Add(newAspose.Pdf.Text.TextFragment("Hello World!")); // save PDF documentdocument.Save(dir+"output.pdf");

    Save PDF as Office & HTML Formats

    One of the most popular feature of Aspose.PDF for .NET is to convert PDF documents to other formats without needing to understand the underlying structure of the resultant format.

    Give the following snippet a try with your own samples:

    // load the file to be convertedvarpfile=newAspose.Pdf.Document(dir+"template.pdf"); // save in different formatspfile.Save(dir+"output.docx", Aspose.Pdf.SaveFormat.DocX); pfile.Save(dir+"output.pptx", Aspose.Pdf.SaveFormat.Pptx); pfile.Save(dir+"output.html", Aspose.Pdf.SaveFormat.Html);

    Home | Product Page | Docs | Demos | API Reference | Examples | Blog | Search | Free Support | Temporary License


    713 714 715 716 717