diff --git a/pdf/english/_index.md b/pdf/english/_index.md index 297387b51..e6009e7c2 100644 --- a/pdf/english/_index.md +++ b/pdf/english/_index.md @@ -47,6 +47,19 @@ Learn how to create, format, and manipulate tables in PDF documents using Aspose {{< tutorial-card link="./net/tables/add-table/" title="Add Table to an Existing PDF Using Aspose.PDF for .NET" imgSrc="./net/tables/add-table/images/thumb.png" >}} {{< tutorial-card link="./net/tables/insert-page-break/" title="Create a PDF with Tables and Pagination Using Aspose.PDF" imgSrc="./net/tables/insert-page-break/images/thumb.png" >}} {{< tutorial-card link="./net/tables/render-table/" title="Create a PDF with Tables using Aspose.PDF for .NET" imgSrc="./net/tables/render-table/images/thumb.png" >}} +{{< tutorial-card link="./net/tables/set-border/" title="Create PDF with Double-Bordered Table using Aspose.PDF" imgSrc="./net/tables/set-border/images/thumb.png" >}} +{{< tutorial-card link="./net/tables/text-alignment-for-table-row-content/" title="Create a PDF with Text Alignment for Table Row Content" imgSrc="./net/tables/text-alignment-for-table-row-content/images/thumb.png" >}} +{{< /blocks/products/pf/tutorial-page-section >}} +{{< blocks/products/pf/tutorial-page-section >}} +## [Comprehensive Tutorials Text Handling in Aspose.PDF for .NET](./net/text/) +Learn how to create, format, and manipulate tables in PDF documents using Aspose.PDF for .NET with step-by-step tutorials and code examples. + +{{< tutorial-card link="./net/text/add-text/" title="Adding Text to PDF Documents with Aspose.PDF" imgSrc="./net/text/add-text/images/thumb.png" >}} +{{< tutorial-card link="./net/text/add-text-border/" title="Creating Styled Text with Borders in PDF Documents using Aspose.PDF" imgSrc="./net/text/add-text-border/images/thumb.png" >}} +{{< tutorial-card link="./net/text/add-transparent-text/" title="Creating Transparent Text Effects in PDF with Aspose.PDF" imgSrc="./net/text/add-transparent-text/images/thumb.png" >}} +{{< tutorial-card link="./net/text/add-underline-text/" title="Adding Underlined Text in PDF with Aspose.PDF" imgSrc="./net/text/add-underline-text/images/thumb.png" >}} +{{< tutorial-card link="./net/text/create-multi-column/" title="Create a Multi-Column PDF Using Aspose.PDF for .NET" imgSrc="./net/text/create-multi-column/images/thumb.png" >}} +{{< tutorial-card link="./net/text/multicolumn-paragraphs/" title="Multi-Column Paragraphs in PDF using Aspose.PDF" imgSrc="./net/text/multicolumn-paragraphs/images/thumb.png" >}} {{< /blocks/products/pf/tutorial-page-section >}} {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} diff --git a/pdf/english/net/_index.md b/pdf/english/net/_index.md index efb907a92..b521352a0 100644 --- a/pdf/english/net/_index.md +++ b/pdf/english/net/_index.md @@ -40,6 +40,19 @@ Learn how to create, format, and manipulate tables in PDF documents using Aspose {{< tutorial-card link="./tables/add-table/" title="Add Table to an Existing PDF Using Aspose.PDF for .NET" imgSrc="./tables/add-table/images/thumb.png" >}} {{< tutorial-card link="./tables/insert-page-break/" title="Create a PDF with Tables and Pagination Using Aspose.PDF" imgSrc="./tables/insert-page-break/images/thumb.png" >}} {{< tutorial-card link="./tables/render-table/" title="Create a PDF with Tables using Aspose.PDF for .NET" imgSrc="./tables/render-table/images/thumb.png" >}} +{{< tutorial-card link="./tables/set-border/" title="Create PDF with Double-Bordered Table using Aspose.PDF" imgSrc="./tables/set-border/images/thumb.png" >}} +{{< tutorial-card link="./tables/text-alignment-for-table-row-content/" title="Create a PDF with Text Alignment for Table Row Content" imgSrc="./tables/text-alignment-for-table-row-content/images/thumb.png" >}} +{{< /blocks/products/pf/tutorial-page-section >}} +{{< blocks/products/pf/tutorial-page-section >}} +## [Comprehensive Tutorials Text Handling in Aspose.PDF for .NET](./text/) +Learn how to create, format, and manipulate tables in PDF documents using Aspose.PDF for .NET with step-by-step tutorials and code examples. + +{{< tutorial-card link="./text/add-text/" title="Adding Text to PDF Documents with Aspose.PDF" imgSrc="./text/add-text/images/thumb.png" >}} +{{< tutorial-card link="./text/add-text-border/" title="Creating Styled Text with Borders in PDF Documents using Aspose.PDF" imgSrc="./text/add-text-border/images/thumb.png" >}} +{{< tutorial-card link="./text/add-transparent-text/" title="Creating Transparent Text Effects in PDF with Aspose.PDF" imgSrc="./text/add-transparent-text/images/thumb.png" >}} +{{< tutorial-card link="./text/add-underline-text/" title="Adding Underlined Text in PDF with Aspose.PDF" imgSrc="./text/add-underline-text/images/thumb.png" >}} +{{< tutorial-card link="./text/create-multi-column/" title="Create a Multi-Column PDF Using Aspose.PDF for .NET" imgSrc="./text/create-multi-column/images/thumb.png" >}} +{{< tutorial-card link="./text/multicolumn-paragraphs/" title="Multi-Column Paragraphs in PDF using Aspose.PDF" imgSrc="./text/multicolumn-paragraphs/images/thumb.png" >}} {{< /blocks/products/pf/tutorial-page-section >}} {{< /blocks/products/pf/main-container >}} diff --git a/pdf/english/net/tables/_index.md b/pdf/english/net/tables/_index.md index 018d5231a..844b511dc 100644 --- a/pdf/english/net/tables/_index.md +++ b/pdf/english/net/tables/_index.md @@ -19,7 +19,8 @@ This section includes detailed tutorials on various table-related operations. Le {{< tutorial-card link="./add-table/" title="Add Table to an Existing PDF Using Aspose.PDF for .NET" imgSrc="./add-table/images/thumb.png" >}} {{< tutorial-card link="./insert-page-break/" title="Create a PDF with Tables and Pagination Using Aspose.PDF" imgSrc="./insert-page-break/images/thumb.png" >}} {{< tutorial-card link="./render-table/" title="Create a PDF with Tables using Aspose.PDF for .NET" imgSrc="./render-table/images/thumb.png" >}} - +{{< tutorial-card link="./set-border/" title="Create PDF with Double-Bordered Table using Aspose.PDF" imgSrc="./set-border/images/thumb.png" >}} +{{< tutorial-card link="./text-alignment-for-table-row-content/" title="Create a PDF with Text Alignment for Table Row Content" imgSrc="./text-alignment-for-table-row-content/images/thumb.png" >}} {{< /blocks/products/pf/tutorial-page-section >}} {{< /blocks/products/pf/main-container >}} diff --git a/pdf/english/net/tables/set-border/_index.md b/pdf/english/net/tables/set-border/_index.md new file mode 100644 index 000000000..2f26dbec7 --- /dev/null +++ b/pdf/english/net/tables/set-border/_index.md @@ -0,0 +1,51 @@ +--- +title: Create PDF with Double-Bordered Table using Aspose.PDF for .NET +weight: 7700 +limit: +description: Learn how to create a PDF document with a table featuring double borders. Quick setup instructions and code examples included. +keywords: [Aspose PDF, .NET PDF example, double borders, PDF table, create PDF, Aspose documentation] +url: /net/tables/set-border/ +--- +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Create PDF with Double-Bordered Table using Aspose.PDF + +This example demonstrates how to create a PDF document using Aspose.PDF for .NET, featuring a table with double borders on the top and bottom sides of the cells. Follow the step-by-step instructions to implement this feature in your applications seamlessly. + +--- +{{< tutorial-widget sourcePath="pdf/net/tables/set-border" >}} + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< blocks/products/pf/tutorial-page-section >}} + +## Installation Instructions +To get started with Aspose.PDF for .NET, please follow these installation instructions: + +1. Download Aspose.PDF: + - Visit the [Aspose website](https://www.aspose.com/downloads/pdf/net) to download the latest version of Aspose.PDF for .NET. + +2. Install via NuGet Package Manager: + - Open your project in Visual Studio. + - Go to Tools > NuGet Package Manager > Manage NuGet Packages for Solution. + - Search for "Aspose.PDF" and install the package. + +3. Add References: + - Ensure your project references the Aspose.PDF DLL in the `packages` folder. + +4. Include Aspose.PDF Namespace in Your Project: + ```csharp + using Aspose.Pdf; + using Aspose.Pdf.Text; + ``` + +## For more details: +[Aspose.PDF for .NET Documentation](https://docs.aspose.com/pdf/net/) +[Aspose.PDF for .NET API Reference](https://reference.aspose.com/pdf/net/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} + +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/pdf/english/net/tables/set-border/example.txt b/pdf/english/net/tables/set-border/example.txt new file mode 100644 index 000000000..69167101f --- /dev/null +++ b/pdf/english/net/tables/set-border/example.txt @@ -0,0 +1,51 @@ +//ExStart +//ExSummary: This code demonstrates how to create a PDF document with a table that has double borders on both the top and bottom sides. +//ExStepSummary:0: Instantiate a Document object and add a page to it. +//ExStepSummary:1: Create a BorderInfo object to define the border properties for the table cells. +//ExStepSummary:2: Instantiate a Table object and specify the column widths. +//ExStepSummary:3: Add a Row to the table and insert a Cell containing text. +//ExStepSummary:4: Set the double border for the cell using the BorderInfo object. +//ExStepSummary:5: Add the table to the page's paragraphs collection and save the document to a specified file path. +//ExStepImage:5:images/1.png +//ExStep:0- +// Define the path to the documents directory. +string dataDir = "Your Document Directory"; + +//ExStep:1- +// Instantiate Document object. +Document doc = new Document(); +// Add a page to the PDF document. +Page page = doc.Pages.Add(); + +//ExStep:2- +// Create BorderInfo object. +Aspose.Pdf.BorderInfo border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All); +// Specify that the top border will be double +border.Top.IsDoubled = true; +// Specify that the bottom border will be double +border.Bottom.IsDoubled = true; + +//ExStep:3- +// Instantiate Table object. +Aspose.Pdf.Table table = new Aspose.Pdf.Table(); +// Specify Columns width information +table.ColumnWidths = "100"; + +//ExStep:4- +// Create Row object for the table. +Aspose.Pdf.Row row = table.Rows.Add(); +// Add a Table cell to cells collection of row +Aspose.Pdf.Cell cell = row.Cells.Add("some text"); +// Apply the border settings defined earlier. +cell.Border = border; + +//ExStep:5- +// Add the table to the paragraphs collection of the page. +page.Paragraphs.Add(table); +// Specify the output file path. +dataDir = dataDir + "TableBorderTest_out.pdf"; +// Save the PDF document +doc.Save(dataDir); +// Print success message with file path. +Console.WriteLine("\nBorder setup successfully.\nFile saved at " + dataDir); +//ExEnd \ No newline at end of file diff --git a/pdf/english/net/tables/text-alignment-for-table-row-content/_index.md b/pdf/english/net/tables/text-alignment-for-table-row-content/_index.md new file mode 100644 index 000000000..2067d6aa0 --- /dev/null +++ b/pdf/english/net/tables/text-alignment-for-table-row-content/_index.md @@ -0,0 +1,51 @@ +--- +title: Create a PDF with Text Alignment for Table Row Content in Aspose.PDF for .NET +weight: 7700 +limit: +description: Learn how to create a PDF document with a table using Aspose.PDF for .NET. This example demonstrates adding 10 rows and 3 columns with dynamic content. +keywords: [Aspose.PDF for .NET, create PDF table, add table to PDF, .NET PDF library, C# PDF table, generate PDF C#, Aspose PDF example, table formatting in PDF] +url: /net/tables/text-alignment-for-table-row-content/ +--- +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Create a PDF with Text Alignment for Table Row Content + +Aspose.PDF for .NET provides a powerful API for creating, editing, and manipulating PDF documents programmatically. This example demonstrates how to generate a PDF file containing a structured table with 10 rows and 3 columns. Each row is dynamically populated with content, and the table is formatted with light gray borders. The step-by-step guide walks you through initializing the document, defining the table, setting properties, and finally saving the output PDF. Aspose.PDF for .NET simplifies PDF generation in C# applications, making it ideal for automated report generation, invoice creation, and structured data presentation. + +--- + +{{< tutorial-widget sourcePath="pdf/net/tables/text-alignment-for-table-row-content" >}} + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< blocks/products/pf/tutorial-page-section >}} +## Installation Instructions: +To use Aspose.PDF for .NET in your project, follow these steps: + +1. Install via NuGet Package Manager: + Open NuGet Package Manager in your Visual Studio project and run: + ```sh + Install-Package Aspose.PDF + ``` + +2. Download DLL Manually: + - Visit the Aspose.PDF for .NET Download Page: [Download Here](https://releases.aspose.com/pdf/net/) + - Extract and reference `Aspose.Pdf.dll` in your project. + +3. Apply a License (Optional): + - Get a free temporary license: [Request License](https://purchase.aspose.com/temporary-license/) + - Apply it in your code: + ```csharp + Aspose.Pdf.License license = new Aspose.Pdf.License(); + license.SetLicense("Aspose.Pdf.lic"); + ``` +## For more details +- Documentation: [Aspose.PDF for .NET Documentation](https://docs.aspose.com/pdf/net/) +- API Reference: [Aspose.PDF for .NET API Reference](https://reference.aspose.com/pdf/net/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} + +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/pdf/english/net/tables/text-alignment-for-table-row-content/example.txt b/pdf/english/net/tables/text-alignment-for-table-row-content/example.txt new file mode 100644 index 000000000..8b8e44267 --- /dev/null +++ b/pdf/english/net/tables/text-alignment-for-table-row-content/example.txt @@ -0,0 +1,66 @@ +//ExStart +//ExSummary: This code demonstrates how to create a PDF document with a table containing 10 rows and 3 columns. +//ExStepSummary:0: This step sets the directory path where the output PDF file will be saved. +//ExStepSummary:1: This step creates a new PDF document instance. +//ExStepSummary:2: This step initializes a new table object. +//ExStepSummary:3: This step sets the border color of the table to LightGray. +//ExStepSummary:4: This step applies a LightGray border to all table cells. +//ExStepSummary:5: This step starts a loop to add 10 rows to the table. +//ExStepSummary:6: This step adds a new row to the table and sets its vertical alignment to center. +//ExStepSummary:7: This step adds three cells to the row, with the first cell containing dynamic content based on the current timestamp. +//ExStepSummary:8: This step adds a new page to the PDF document. +//ExStepSummary:9: This step adds the table to the newly created page in the document. +//ExStepSummary:10: This step saves the final PDF document to the specified output directory. +//ExStepImage:8:images/1.png + +//ExStep:0- +// The path to the documents directory. +string dataDir = "Your Document Directory"; + +//ExStep:1- +// Create a new PDF document. +Aspose.Pdf.Document doc = new Aspose.Pdf.Document(); + +//ExStep:2- +// Initializes a new instance of the Table. +Aspose.Pdf.Table table = new Aspose.Pdf.Table(); + +//ExStep:3- +// Set the table border color as LightGray. +table.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray)); + +//ExStep:4- +// Set the border for table cells. +table.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray)); + +//ExStep:5- +// Create a loop to add 10 rows +for (int row_count = 0; row_count < 10; row_count++) +{ +//ExStep:6- + // Add row to table + Aspose.Pdf.Row row = table.Rows.Add(); + // Set vertical alignment of the row. + row.VerticalAlignment = VerticalAlignment.Center; + +//ExStep:7- + // Add first cell with dynamic content. + row.Cells.Add("Column (" + row_count + ", 1)" + DateTime.Now.Ticks); + // Add second cell. + row.Cells.Add("Column (" + row_count + ", 2)"); + // Add third cell. + row.Cells.Add("Column (" + row_count + ", 3)"); +} + +//ExStep:8- +// Add a new page to the PDF document. +Page tocPage = doc.Pages.Add(); + +//ExStep:9- +// Add the table object to the first page of the document. +tocPage.Paragraphs.Add(table); + +//ExStep:10- +// Save the updated document containing the table object. +doc.Save(dataDir + "43620_ByWords_out.pdf"); +//ExEnd \ No newline at end of file diff --git a/pdf/english/net/text/_index.md b/pdf/english/net/text/_index.md new file mode 100644 index 000000000..00010b0c2 --- /dev/null +++ b/pdf/english/net/text/_index.md @@ -0,0 +1,30 @@ +--- +title: Comprehensive Tutorials Text Handling in Aspose.PDF for .NET +weight: 10 +limit: +description: Learn how to add, format, extract, and manipulate text in PDF documents using Aspose.PDF for .NET with step-by-step tutorials and code examples. +keywords: +url: /net/text/ +--- +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +## Introduction + +Working with text in a PDF document is a fundamental task, whether you’re creating reports, invoices, or eBooks. Aspose.PDF for .NET offers a powerful API to add, edit, format, extract, and manipulate text with ease. Whether you need to insert text at specific coordinates, change font styles, or search and replace content, Aspose.PDF provides robust solutions. With its high-level features, you can control text properties like alignment, color, and size, ensuring professional-quality output. + +In this tutorial series, we’ll explore various aspects of text manipulation using Aspose.PDF for .NET. You’ll learn how to insert text dynamically, format it with advanced styling, extract content for processing, and even work with multi-column layouts. Each tutorial is designed with clear explanations and practical code examples, making it easy for developers to implement text-based features in their applications. Whether you’re a beginner or an experienced developer, these guides will help you master text handling in PDF files effortlessly. + +{{< tutorial-card link="./add-text/" title="Adding Text to PDF Documents with Aspose.PDF" imgSrc="./add-text/images/thumb.png" >}} +{{< tutorial-card link="./add-text-border/" title="Creating Styled Text with Borders in PDF Documents using Aspose.PDF" imgSrc="./add-text-border/images/thumb.png" >}} +{{< tutorial-card link="./add-transparent-text/" title="Creating Transparent Text Effects in PDF with Aspose.PDF" imgSrc="./add-transparent-text/images/thumb.png" >}} +{{< tutorial-card link="./add-underline-text/" title="Adding Underlined Text in PDF with Aspose.PDF" imgSrc="./add-underline-text/images/thumb.png" >}} +{{< tutorial-card link="./create-multi-column/" title="Create a Multi-Column PDF Using Aspose.PDF for .NET" imgSrc="./create-multi-column/images/thumb.png" >}} +{{< tutorial-card link="./multicolumn-paragraphs/" title="Multi-Column Paragraphs in PDF using Aspose.PDF" imgSrc="./multicolumn-paragraphs/images/thumb.png" >}} + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} + +{{< blocks/products/products-backtop-button >}} diff --git a/pdf/english/net/text/add-text-border/_index.md b/pdf/english/net/text/add-text-border/_index.md new file mode 100644 index 000000000..f402524e1 --- /dev/null +++ b/pdf/english/net/text/add-text-border/_index.md @@ -0,0 +1,48 @@ +--- +title: Creating Styled Text with Borders in PDF Documents using Aspose.PDF for .NET +weight: 7700 +limit: +description: Create professional PDF documents with styled text fragments featuring custom fonts, colors, and borders using Aspose.PDF for .NET library. +keywords: [Aspose.PDF for .NET, PDF creation, text styling, border effects, text fragments, C# PDF library, document formatting] +url: /net/text/add-text-border/ +--- +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Creating Styled Text with Borders in PDF Documents + +Aspose.PDF for .NET is a powerful PDF processing API that allows developers to create, edit, manipulate, and convert PDF documents without requiring Adobe Acrobat. This example demonstrates how to create a PDF document with a text fragment that has specific styling and a border, which is particularly useful for highlighting important content in your documents. + +--- +{{< tutorial-widget sourcePath="pdf/net/text/add-text-border" >}} + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< blocks/products/pf/tutorial-page-section >}} + +## Installation Instructions + +1. Install via NuGet Package Manager: + ``` + Install-Package Aspose.PDF + ``` + +2. Install via .NET CLI: + ``` + dotnet add package Aspose.PDF + ``` + +3. Manual Installation: + - Download the latest version from [Aspose.PDF for .NET releases](https://releases.aspose.com/pdf/net/) + - Add reference to Aspose.PDF.dll in your project + +## Resources + +- [Aspose.PDF for .NET Documentation](https://docs.aspose.com/pdf/net/) +- [Aspose.PDF for .NET API Reference](https://reference.aspose.com/pdf/net/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} + +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/pdf/english/net/text/add-text-border/example.txt b/pdf/english/net/text/add-text-border/example.txt new file mode 100644 index 000000000..dde283fb4 --- /dev/null +++ b/pdf/english/net/text/add-text-border/example.txt @@ -0,0 +1,55 @@ +//ExStart +//ExSummary: This code demonstrates how to create a PDF document with a text fragment that has specific styling and a border. +//ExStepSummary:0: The following code initializes the path for saving the PDF document. +//ExStepSummary:1: The following code creates a new PDF document object. +//ExStepSummary:2: The following code adds a new page to the PDF document. +//ExStepSummary:3: The following code creates a text fragment with specified content and position. +//ExStepSummary:4: The following code sets the properties of the text fragment, including font size and colors. +//ExStepSummary:5: The following code enables the drawing of a border around the text rectangle. +//ExStepSummary:6: The following code appends the text fragment to the PDF page using a TextBuilder. +//ExStepSummary:7: The following code saves the PDF document to the specified directory. +//ExStepImage:6:images/1.png +//ExStep:0- +// Initialize the path to save the document +string dataDir = "Your Document Directory"; + +//ExStep:1- +// Create a new PDF document object +Document pdfDocument = new Document(); + +//ExStep:2- +// Add a new page to the PDF document +Page pdfPage = (Page)pdfDocument.Pages.Add(); + +//ExStep:3- +// Create a text fragment with the specified content +TextFragment textFragment = new TextFragment("main text"); +// Set the position of the text fragment +textFragment.Position = new Position(100, 600); + +//ExStep:4- +// Set the font size of the text +textFragment.TextState.FontSize = 12; +// Set the font type +textFragment.TextState.Font = FontRepository.FindFont("TimesNewRoman"); +// Set the background color of the text +textFragment.TextState.BackgroundColor = Aspose.Pdf.Color.LightGray; +// Set the foreground color of the text +textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.Red; + +//ExStep:5- +// Set the stroking color for the border +textFragment.TextState.StrokingColor = Aspose.Pdf.Color.DarkRed; +// Enable the drawing of the border around the text +textFragment.TextState.DrawTextRectangleBorder = true; + +//ExStep:6- +// Create a TextBuilder object for the page +TextBuilder tb = new TextBuilder(pdfPage); +// Append the text fragment to the PDF page +tb.AppendText(textFragment); + +//ExStep:7- +// Save the document to the specified path +pdfDocument.Save(dataDir + "PDFWithTextBorder_out.pdf"); +//ExEnd \ No newline at end of file diff --git a/pdf/english/net/text/add-text/_index.md b/pdf/english/net/text/add-text/_index.md new file mode 100644 index 000000000..e17c35c75 --- /dev/null +++ b/pdf/english/net/text/add-text/_index.md @@ -0,0 +1,51 @@ +--- +title: Adding Text to PDF Documents with Aspose.PDF for .NET +weight: 7700 +limit: +description: Learn how to add text fragments to existing PDF documents using Aspose.PDF for .NET with complete code examples and step-by-step instructions. +keywords: [Aspose.PDF, .NET, C#, PDF manipulation, text fragment, PDF editing, document processing, PDF text] +url: /net/text/add-text/ +--- +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Adding Text to PDF Documents with Aspose.PDF for .NET + +Aspose.PDF for .NET is a powerful PDF processing API that allows developers to create, modify, and convert PDF documents without Adobe Acrobat dependencies. This example demonstrates how to add styled text to an existing PDF document with precise positioning, custom fonts, and color properties. The Aspose.PDF library provides comprehensive functionality for text manipulation in PDF documents with simple and intuitive programming interfaces. + +--- +{{< tutorial-widget sourcePath="pdf/net/text/add-text" >}} + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< blocks/products/pf/tutorial-page-section >}} + +## Installation Instructions + +1: Prerequisites +- Visual Studio 2017 or higher +- .NET Framework 4.0 or higher or .NET Core 2.0+ / .NET 5.0+ +- Basic knowledge of C# programming + +2: Install Aspose.PDF for .NET +You can install Aspose.PDF for .NET using one of the following methods: + +Using NuGet Package Manager Console: +```csharp +PM> Install-Package Aspose.PDF +``` + +3: Using Visual Studio NuGet Package Manager: + 1. Open your project in Visual Studio + 2. Right-click on the project in Solution Explorer and select "Manage NuGet Packages" + 3. Search for "Aspose.PDF" and install the package + +## Additional Resources +- [Aspose.PDF for .NET Documentation](https://docs.aspose.com/pdf/net/) +- [Aspose.PDF for .NET API Reference](https://reference.aspose.com/pdf/net/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} + +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/pdf/english/net/text/add-text/example.txt b/pdf/english/net/text/add-text/example.txt new file mode 100644 index 000000000..9ae816481 --- /dev/null +++ b/pdf/english/net/text/add-text/example.txt @@ -0,0 +1,61 @@ +//ExStart +//ExSummary: This code demonstrates how to add a text fragment to an existing PDF document using Aspose.PDF. It opens a PDF, creates a text fragment with specific properties, and saves the modified document. +//ExStepSummary:0: This step sets the path to the documents directory where the input PDF is located. +//ExStepSummary:1: This step opens the specified PDF document for editing. +//ExStepSummary:2: This step retrieves a specific page from the PDF document. +//ExStepSummary:3: This step creates a text fragment with specified content and position on the page. +//ExStepSummary:4: This step sets various properties for the text fragment, including font size, font type, background color, and foreground color. +//ExStepSummary:5: This step creates a TextBuilder object to facilitate adding the text fragment to the PDF page. +//ExStepSummary:6: This step appends the text fragment to the PDF page. +//ExStepSummary:7: This step sets the output file path for the modified PDF document. +//ExStepSummary:8: This step saves the modified PDF document to the specified output path. +//ExStepImage:3: images/1.png +//ExStepImage:6:images/2.png + + +//ExStep:0- +// Set the directory path for the documents +string dataDir = "Your Document Directory"; + +//ExStep:1- +// Open the specified PDF document +Document pdfDocument = new Document(dataDir + "input.pdf"); + +//ExStep:2- +// Retrieve the second page of the PDF document +Page pdfPage = (Page)pdfDocument.Pages[1]; + +//ExStep:3- +// Create a new text fragment with the specified content +TextFragment textFragment = new TextFragment("main text"); +// Set the position of the text fragment on the page +textFragment.Position = new Position(100, 600); + +//ExStep:4- +// Set the font size of the text fragment +textFragment.TextState.FontSize = 12; +// Set the font type +textFragment.TextState.Font = FontRepository.FindFont("TimesNewRoman"); +// Set background color +textFragment.TextState.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray); +// Set text color +textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Red); + +//ExStep:5- +// Create a TextBuilder object for the page +TextBuilder textBuilder = new TextBuilder(pdfPage); + +//ExStep:6- +// Append the text fragment to the PDF page +textBuilder.AppendText(textFragment); + +//ExStep:7- +// Set the output file path for the modified PDF document +dataDir = dataDir + "AddText_out.pdf"; + +//ExStep:8- +// Save the modified PDF document to the specified output path +pdfDocument.Save(dataDir); +// Output success message +Console.WriteLine("\nText added successfully.\nFile saved at " + dataDir); +//ExEnd \ No newline at end of file diff --git a/pdf/english/net/text/add-transparent-text/_index.md b/pdf/english/net/text/add-transparent-text/_index.md new file mode 100644 index 000000000..54137c3c0 --- /dev/null +++ b/pdf/english/net/text/add-transparent-text/_index.md @@ -0,0 +1,55 @@ +--- +title: Creating Transparent Text Effects in PDF with Aspose.PDF for .NET +weight: 7700 +limit: +description: Create PDF documents with transparent text and shapes using Aspose.PDF for .NET. Perfect for watermarks and visually appealing designs. +keywords: [Aspose.PDF, .NET PDF library, transparent text, PDF transparency, C# PDF generation, PDF manipulation, rectangle shapes, opacity effects, document creation, PDF programming] +url: /net/text/add-transparent-text/ +--- +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Creating Transparent Text Effects in PDF with Aspose.PDF for .NET + +Enhance your PDF documents with transparent text and shapes using Aspose.PDF for .NET. This powerful library allows you to create visually appealing documents by applying transparency effects to both text and graphical elements, perfect for watermarks, overlays, and creative document designs. + +--- +{{< tutorial-widget sourcePath="pdf/net/text/add-transparent-text" >}} + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< blocks/products/pf/tutorial-page-section >}} + +## Installation Instructions + +1. Install via NuGet Package Manager: + ``` + Install-Package Aspose.PDF + ``` + +2. Install via .NET CLI: + ``` + dotnet add package Aspose.PDF + ``` + +3. Add Reference Manually: + - Download the library from [Aspose Releases](https://releases.aspose.com/pdf/net/) + - Add reference to Aspose.PDF.dll in your project + +4. Add Using Statement: + ```csharp + using Aspose.Pdf; + using Aspose.Pdf.Drawing; + ``` + +## Resources + +- [Aspose.PDF for .NET Documentation](https://docs.aspose.com/pdf/net/) +- [Aspose.PDF for .NET API Reference](https://reference.aspose.com/pdf/net/) +- [Download Latest Version](https://releases.aspose.com/pdf/net/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} + +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/pdf/english/net/text/add-transparent-text/example.txt b/pdf/english/net/text/add-transparent-text/example.txt new file mode 100644 index 000000000..8abd6bc79 --- /dev/null +++ b/pdf/english/net/text/add-transparent-text/example.txt @@ -0,0 +1,61 @@ +//ExStart +//ExSummary: This code demonstrates how to create a PDF document that includes a rectangle and a text fragment with transparent text effects. The output will be saved as `AddTransparentText_out.pdf` in the specified directory. +//ExStepSummary:0: Initialize document directory path and create a new PDF document with a page. +//ExStepSummary:1: Create a Graph object and Rectangle with transparent fill color, then add it to the page. +//ExStepSummary:2: Create a TextFragment with sample text and set transparent green color with 30% opacity. +//ExStepSummary:3: Save the document to the specified output path. +//ExStepSummary:4: Display a success message with the file path. +//ExStepImage:1:images/1.png +//ExStepImage:2:images/2.png + +//ExStep:0- +// The path to the documents directory. +string dataDir = "Your Document Directory"; + +// Create Document instance +Document doc = new Document(); + +// Create page to pages collection of PDF file +Aspose.Pdf.Page page = doc.Pages.Add(); + +//ExStep:1- +// Create Graph object with width and height +Aspose.Pdf.Drawing.Graph canvas = new Aspose.Pdf.Drawing.Graph(100.0, 400.0); +// Create rectangle instance with defined dimensions +Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(100, 100, 400, 400); + +// Create color object from Alpha color channel +rect.GraphInfo.FillColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.FromArgb(128, System.Drawing.Color.FromArgb(12957183))); + +// Add rectangle to shapes collection of Graph object +canvas.Shapes.Add(rect); // Add the rectangle shape to the Graph object + +// Add graph object to paragraphs collection of page object +page.Paragraphs.Add(canvas); + +// Set value to not change position for graph object +canvas.IsChangePosition = false; + +//ExStep:2- +// Create TextFragment instance with sample value +TextFragment text = new TextFragment("transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text "); + +// Create color object from Alpha channel +Aspose.Pdf.Color color = Aspose.Pdf.Color.FromArgb(30, 0, 255, 0); + +// Set color information for text instance +text.TextState.ForegroundColor = color; + +// Add text to paragraphs collection of page instance +page.Paragraphs.Add(text); + +//ExStep:3- +// Specify the output path for the PDF file +dataDir = dataDir + "AddTransparentText_out.pdf"; +// Save the document to the specified path +doc.Save(dataDir); + +//ExStep:4- +// Inform the user that the process is complete +Console.WriteLine("\nTransparent text added successfully.\nFile saved at " + dataDir); +//ExEnd \ No newline at end of file diff --git a/pdf/english/net/text/add-underline-text/_index.md b/pdf/english/net/text/add-underline-text/_index.md new file mode 100644 index 000000000..0a58dfe0b --- /dev/null +++ b/pdf/english/net/text/add-underline-text/_index.md @@ -0,0 +1,62 @@ +--- +title: Adding Underlined Text in PDF with Aspose.PDF for .NET +weight: 7700 +limit: +description: Learn how to add underlined text to PDF documents using Aspose.PDF for .NET library with this step-by-step code example and instructions. +keywords: [Aspose.PDF, .NET, PDF creation, underline text, C#, text formatting, PDF manipulation, document processing, TextFragment, TextBuilder] +url: /net/text/add-underline-text/ +--- +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Adding Underlined Text in PDF with Aspose.PDF for .NET + +Aspose.PDF for .NET is a powerful PDF processing library that allows developers to create, modify, and manipulate PDF documents without requiring Adobe Acrobat. This example demonstrates how to create a new PDF document and add text with underline formatting using the TextBuilder and TextFragment classes. The code creates a simple PDF with a test message formatted in Arial font with underline styling, positioning it at specific coordinates within the page. + +--- +{{< tutorial-widget sourcePath="pdf/net/text/add-underline-text" >}} + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< blocks/products/pf/tutorial-page-section >}} +## Installation Instructions + +1: Install Aspose.PDF for .NET + +You can install Aspose.PDF for .NET using one of the following methods: + +Using NuGet Package Manager: + +```csharp +Install-Package Aspose.PDF +``` + +Using .NET CLI: + +```bash +dotnet add package Aspose.PDF +``` + +Using PackageReference in your project file: + +```xml + +``` + +2: Add Required Using Statements + +```csharp +using Aspose.Pdf; +using Aspose.Pdf.Text; +``` + +## Additional Resources + +- [Aspose.PDF for .NET Documentation](https://docs.aspose.com/pdf/net/) +- [Aspose.PDF for .NET API Reference](https://reference.aspose.com/pdf/net/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} + +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/pdf/english/net/text/add-underline-text/example.txt b/pdf/english/net/text/add-underline-text/example.txt new file mode 100644 index 000000000..36de84b77 --- /dev/null +++ b/pdf/english/net/text/add-underline-text/example.txt @@ -0,0 +1,50 @@ +//ExStart +//ExSummary: This code demonstrates how to create a PDF document and add a text fragment with underline formatting. It includes steps for creating the document, adding text, and saving the file. +//ExStepSummary:0: Define the directory where the PDF document will be saved. +//ExStepSummary:1: Initialize a new PDF document and add a page to it. +//ExStepSummary:2: Create a TextBuilder object for the first page of the document. +//ExStepSummary:3: Create a TextFragment with the test message, set its font to Arial, size to 10, and enable underline formatting. +//ExStepSummary:4: Specify the position of the TextFragment in the PDF and append it to the TextBuilder. +//ExStepSummary:5: Define the output file path and save the PDF document. +//ExStepSummary:6: Output a success message indicating the underlined text was added and show the file location. +//ExStepImage:4:images/1.png +//ExStep:0- +// Define the directory where the document will be saved. +string dataDir = "Your Document Directory"; + +//ExStep:1- +// Initialize a new PDF document. +Document pdfDocument = new Document(); +// Add a new page to the document. +pdfDocument.Pages.Add(); + +//ExStep:2- +// Create a TextBuilder for the first page. +TextBuilder tb = new TextBuilder(pdfDocument.Pages[1]); + +//ExStep:3- +// Create a TextFragment with the specified text. +TextFragment fragment = new TextFragment("Test message"); +// Set the font to Arial. +fragment.TextState.Font = FontRepository.FindFont("Arial"); +// Set the font size to 10. +fragment.TextState.FontSize = 10; +// Enable underline formatting for the text. +fragment.TextState.Underline = true; + +//ExStep:4- +// Specify the position of the TextFragment in the PDF. +fragment.Position = new Position(10, 800); +// Append the TextFragment to the TextBuilder. +tb.AppendText(fragment); + +//ExStep:5- +// Define the output file path for the PDF. +dataDir = dataDir + "AddUnderlineText_out.pdf"; +// Save the document to the specified path. +pdfDocument.Save(dataDir); + +//ExStep:6- +// Output success message. +Console.WriteLine("\nUnderline text added successfully.\nFile saved at " + dataDir); +//ExEnd \ No newline at end of file diff --git a/pdf/english/net/text/create-multi-column/_index.md b/pdf/english/net/text/create-multi-column/_index.md new file mode 100644 index 000000000..090910324 --- /dev/null +++ b/pdf/english/net/text/create-multi-column/_index.md @@ -0,0 +1,54 @@ +--- +title: Create a Multi-Column PDF Using Aspose.PDF for .NET +weight: 7700 +limit: +description: Learn how to create a multi-column PDF document using Aspose.PDF for .NET. This guide includes step-by-step code examples, formatting, and layout instructions. +keywords: [Aspose.PDF for .NET, create multi-column PDF, PDF document, .NET PDF library, add text to PDF, HTML formatting in PDF, PDF layout, multi-column formatting] +url: /net/text/create-multi-column/ +--- +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Create a Multi-Column PDF Using Aspose.PDF for .NET + +Aspose.PDF for .NET is a powerful library for creating, editing, and manipulating PDF documents programmatically. In this tutorial, we’ll demonstrate how to create a multi-column PDF document using Aspose.PDF for .NET. We’ll cover setting up margins, adding formatted text with HTML, drawing horizontal lines, and organizing content into multiple columns. This example ensures that your content is structured professionally, making it ideal for magazines, articles, or reports. + +--- +{{< tutorial-widget sourcePath="pdf/net/text/create-multi-column" >}} + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< blocks/products/pf/tutorial-page-section >}} + +## Installation Instructions + +To use Aspose.PDF for .NET in your project, follow these steps: + +1. Install via NuGet (Recommended) +Run the following command in the NuGet Package Manager Console: +```powershell +Install-Package Aspose.PDF +``` + +2. Install via .NET CLI +For .NET Core or .NET 5+, use: +```bash +dotnet add package Aspose.PDF +``` + +3. After installation, import the necessary namespaces in your project: +```csharp +using Aspose.Pdf; +using Aspose.Pdf.Drawing; +using Aspose.Pdf.Text; +``` + +## For detailed documentation +[Aspose.PDF for .NET Documentation](https://docs.aspose.com/pdf/net/) +[API Reference](https://reference.aspose.com/pdf/net/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} + +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/pdf/english/net/text/create-multi-column/example.txt b/pdf/english/net/text/create-multi-column/example.txt new file mode 100644 index 000000000..ff9634cea --- /dev/null +++ b/pdf/english/net/text/create-multi-column/example.txt @@ -0,0 +1,114 @@ +//ExStart +//ExSummary: This code demonstrates how to create a multi-column PDF document using Aspose.PDF library. It sets up margins, adds text with HTML formatting, and organizes content into columns. +//ExStepSummary:0: This step sets the document directory, initializes a new PDF document, and configures its page margins. +//ExStepSummary:1: This step adds a new page to the document and draws a horizontal line using the Graph and Line classes. +//ExStepSummary:2: This step creates an HtmlFragment with formatted text and adds it to the PDF document. +//ExStepSummary:3: This step creates a FloatingBox for a two-column layout and adds author information to it. +//ExStepSummary:4: This step draws another horizontal line inside the FloatingBox for visual separation. +//ExStepSummary:5: This step adds a lengthy text fragment to the FloatingBox to demonstrate content distribution in multiple columns. +//ExStepSummary:6: This step saves the document to the specified output path and prints a success message. +//ExStepImage:2:images/1.png +//ExStepImage:5:images/2.png +//ExStep:0- +// Define the path to the documents directory +string dataDir = "Your Document Directory"; +// Create a new Document instance +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; +// Add a new page to the document +Page page = doc.Pages.Add(); + +//ExStep:1- +// Create a new Graph object for drawing a line +Aspose.Pdf.Drawing.Graph graph1 = new Aspose.Pdf.Drawing.Graph(500.0, 2.0); +// Add the line to paragraphs collection of section object +page.Paragraphs.Add(graph1); + +// Specify the coordinates for the line +// Define the start and end points of the line +float[] posArr = new float[] { 1, 2, 500, 2 }; +// Create a line shape with specified coordinates +Aspose.Pdf.Drawing.Line l1 = new Aspose.Pdf.Drawing.Line(posArr); +// Add the line shape to the graph +graph1.Shapes.Add(l1); + +//ExStep:2- +// Create string variables with text containing html tags +string s = "" + + +" How to Steer Clear of money scams " ++ ""; +// Create an HtmlFragment for the heading text +HtmlFragment heading_text = new HtmlFragment(s); +// Add the heading text to the page +page.Paragraphs.Add(heading_text); + +//ExStep:3- +// Create a new FloatingBox for multi-column layout +Aspose.Pdf.FloatingBox box = new Aspose.Pdf.FloatingBox(); +// Set the number of columns to 2 +box.ColumnInfo.ColumnCount = 2; +// Set the spacing between the columns +box.ColumnInfo.ColumnSpacing = "5"; +// Set the width for each column +box.ColumnInfo.ColumnWidths = "105 105"; +// Create a text fragment for author info +TextFragment text1 = new TextFragment("By A Googler (The Official Google Blog)"); +// Set font size for the text +text1.TextState.FontSize = 8; +// Set line spacing for the text +text1.TextState.LineSpacing = 2; +// Add the author text to the floating box +box.Paragraphs.Add(text1); +// Update font size for the text +text1.TextState.FontSize = 10; +// Set font style to italic +text1.TextState.FontStyle = FontStyles.Italic; + +//ExStep:4- +// Create another Graph object for drawing a second line +Aspose.Pdf.Drawing.Graph graph2 = new Aspose.Pdf.Drawing.Graph(50.0, 10.0); +// 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); +// Add the second line shape to the graph +graph2.Shapes.Add(l2); + +// Add the line to paragraphs collection of section object +box.Paragraphs.Add(graph2); + +//ExStep:5- +// Create a lengthy text fragment to demonstrate content in columns +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." +); +// Add the lengthy text to the floating box +box.Paragraphs.Add(text2); +// Add the floating box containing all content to the page +page.Paragraphs.Add(box); +//ExStep:6- +// Specify the output PDF file path +dataDir = dataDir + "CreateMultiColumnPdf_out.pdf"; +// Save the document to the specified path +doc.Save(dataDir); +// Print success message +Console.WriteLine("\nMulti-column PDF file created successfully.\nFile saved at " + dataDir); +//ExEnd \ No newline at end of file diff --git a/pdf/english/net/text/multicolumn-paragraphs/_index.md b/pdf/english/net/text/multicolumn-paragraphs/_index.md new file mode 100644 index 000000000..b1efbcff9 --- /dev/null +++ b/pdf/english/net/text/multicolumn-paragraphs/_index.md @@ -0,0 +1,47 @@ +--- +title: Multi-Column Paragraphs in PDF using Aspose.PDF for .NET +weight: 7700 +limit: +description: Learn how to extract and modify multi-column paragraphs in a PDF using Aspose.PDF for .NET. Step-by-step guide with code examples. +keywords: [Aspose.PDF for .NET, PDF multi-column paragraphs, extract paragraphs from PDF, .NET PDF processing, PDF document manipulation, ParagraphAbsorber] +url: /net/text/multicolumn-paragraphs/ +--- +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Multi-Column Paragraphs in PDF using Aspose.PDF + +Aspose.PDF for .NET provides a powerful API for working with PDF documents, including extracting and modifying multi-column paragraphs. This example demonstrates how to load a PDF, extract paragraphs, and enable multi-column paragraph formatting to observe the changes. With Aspose.PDF, you can efficiently manipulate paragraph structures in PDF files, making document formatting and content extraction seamless. + +--- +{{< tutorial-widget sourcePath="pdf/net/text/multicolumn-paragraphs" >}} + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< blocks/products/pf/tutorial-page-section >}} +## Installation Instructions: +To use Aspose.PDF for .NET in your project, follow these steps: + +1. Install via NuGet: + Open the Package Manager Console in Visual Studio and run: + ```powershell + Install-Package Aspose.PDF + ``` + + +2. Apply a License (Optional but Recommended): + - Purchase a license from [Aspose Purchase](https://purchase.aspose.com/buy) or get a [temporary license](https://purchase.aspose.com/temporary-license/). + - Apply the license in your code: + ```csharp + License license = new License(); + license.SetLicense("Aspose.PDF.lic"); + ``` +## Resources +[Aspose.PDF Documentation](https://docs.aspose.com/pdf/net/) +[Aspose.PDF for .NET](https://reference.aspose.com/pdf/net/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} + +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/pdf/english/net/text/multicolumn-paragraphs/example.txt b/pdf/english/net/text/multicolumn-paragraphs/example.txt new file mode 100644 index 000000000..6ec6da473 --- /dev/null +++ b/pdf/english/net/text/multicolumn-paragraphs/example.txt @@ -0,0 +1,65 @@ +//ExStart +//ExSummary: This code demonstrates how to work with multi-column paragraphs in a PDF document using Aspose.PDF. It loads a PDF, extracts paragraphs, and then modifies a setting to allow multi-column paragraphs before extracting paragraphs again to show the difference. +//ExStepSummary:0: The following code shows how to specify the data directory where the PDF document is located. +//ExStepSummary:1: The following code shows how to load the PDF document using the Document class. +//ExStepSummary:2: The following code shows how to create a ParagraphAbsorber to extract paragraphs from the document. +//ExStepSummary:3: The following code shows how to visit the document with the ParagraphAbsorber to populate its results. +//ExStepSummary:4: The following code shows how to access the first page's markup and extract information about paragraphs before allowing multi-column paragraphs. +//ExStepSummary:5: The following code shows how to enable multi-column paragraphs and then re-extract paragraph information to show the effect of the change. +//ExStepImage:4:images/1.png +//ExStepImage:5:images/2.png +//ExStep:0- +// Specify the data directory. +string dataDir = "Your Document Directory"; + +//ExStep:1- +// Load the PDF document. +Document doc = new Document(dataDir + "MultiColumnPdf.pdf"); + +//ExStep:2- +// Create a ParagraphAbsorber. +ParagraphAbsorber absorber = new ParagraphAbsorber(); + +//ExStep:3- +// Visit the document to extract paragraphs. +absorber.Visit(doc); + +//ExStep:4- +// Access the page markup. +PageMarkup markup = absorber.PageMarkups[0]; + +Console.WriteLine("IsMulticolumnParagraphsAllowed == false\r\n"); + +// Get the last paragraph from the third section. +MarkupSection section = markup.Sections[2]; +MarkupParagraph paragraph = section.Paragraphs[section.Paragraphs.Count - 1]; + +Console.WriteLine("Section at {0} last paragraph text:\r\n", section.Rectangle.ToString()); +Console.WriteLine(paragraph.Text); + +// Get the first paragraph from the second section. +section = markup.Sections[1]; +paragraph = section.Paragraphs[0]; + +Console.WriteLine("\r\nSection at {0} first paragraph text:\r\n", section.Rectangle.ToString()); +Console.WriteLine(paragraph.Text); + +//ExStep:5- +// Enable multi-column paragraphs. +markup.IsMulticolumnParagraphsAllowed = true; +Console.WriteLine("\r\nIsMulticolumnParagraphsAllowed == true\r\n"); + +// Get the last paragraph from the third section after enabling multi-column paragraphs. +section = markup.Sections[2]; +paragraph = section.Paragraphs[section.Paragraphs.Count - 1]; + +Console.WriteLine("Section at {0} last paragraph text:\r\n", section.Rectangle.ToString()); +Console.WriteLine(paragraph.Text); + +// Get the first paragraph from the second section after enabling multi-column paragraphs. +section = markup.Sections[1]; +paragraph = section.Paragraphs[0]; + +Console.WriteLine("\r\nSection at {0} first paragraph text:\r\n", section.Rectangle.ToString()); +Console.WriteLine(paragraph.Text); +//ExEnd \ No newline at end of file diff --git a/pdf/static/net/tables/set-border/images/1.png b/pdf/static/net/tables/set-border/images/1.png new file mode 100644 index 000000000..a9d7e613e Binary files /dev/null and b/pdf/static/net/tables/set-border/images/1.png differ diff --git a/pdf/static/net/tables/set-border/images/thumb.jpeg b/pdf/static/net/tables/set-border/images/thumb.jpeg new file mode 100644 index 000000000..0d9e8ae62 Binary files /dev/null and b/pdf/static/net/tables/set-border/images/thumb.jpeg differ diff --git a/pdf/static/net/tables/set-border/images/thumb.png b/pdf/static/net/tables/set-border/images/thumb.png new file mode 100644 index 000000000..4e1d0169f Binary files /dev/null and b/pdf/static/net/tables/set-border/images/thumb.png differ diff --git a/pdf/static/net/tables/text-alignment-for-table-row-content/images/1.png b/pdf/static/net/tables/text-alignment-for-table-row-content/images/1.png new file mode 100644 index 000000000..229b3dced Binary files /dev/null and b/pdf/static/net/tables/text-alignment-for-table-row-content/images/1.png differ diff --git a/pdf/static/net/tables/text-alignment-for-table-row-content/images/thumb.jpeg b/pdf/static/net/tables/text-alignment-for-table-row-content/images/thumb.jpeg new file mode 100644 index 000000000..d77f6aac5 Binary files /dev/null and b/pdf/static/net/tables/text-alignment-for-table-row-content/images/thumb.jpeg differ diff --git a/pdf/static/net/tables/text-alignment-for-table-row-content/images/thumb.png b/pdf/static/net/tables/text-alignment-for-table-row-content/images/thumb.png new file mode 100644 index 000000000..5593a8ffb Binary files /dev/null and b/pdf/static/net/tables/text-alignment-for-table-row-content/images/thumb.png differ diff --git a/pdf/static/net/text/add-text-border/images/1.png b/pdf/static/net/text/add-text-border/images/1.png new file mode 100644 index 000000000..4165673fa Binary files /dev/null and b/pdf/static/net/text/add-text-border/images/1.png differ diff --git a/pdf/static/net/text/add-text-border/images/thumb.jpeg b/pdf/static/net/text/add-text-border/images/thumb.jpeg new file mode 100644 index 000000000..a61d1df05 Binary files /dev/null and b/pdf/static/net/text/add-text-border/images/thumb.jpeg differ diff --git a/pdf/static/net/text/add-text-border/images/thumb.png b/pdf/static/net/text/add-text-border/images/thumb.png new file mode 100644 index 000000000..a8e54ae67 Binary files /dev/null and b/pdf/static/net/text/add-text-border/images/thumb.png differ diff --git a/pdf/static/net/text/add-text/images/1.png b/pdf/static/net/text/add-text/images/1.png new file mode 100644 index 000000000..ec2cbdd63 Binary files /dev/null and b/pdf/static/net/text/add-text/images/1.png differ diff --git a/pdf/static/net/text/add-text/images/2.png b/pdf/static/net/text/add-text/images/2.png new file mode 100644 index 000000000..3cc4f5821 Binary files /dev/null and b/pdf/static/net/text/add-text/images/2.png differ diff --git a/pdf/static/net/text/add-text/images/thumb.jpeg b/pdf/static/net/text/add-text/images/thumb.jpeg new file mode 100644 index 000000000..085c9af97 Binary files /dev/null and b/pdf/static/net/text/add-text/images/thumb.jpeg differ diff --git a/pdf/static/net/text/add-text/images/thumb.png b/pdf/static/net/text/add-text/images/thumb.png new file mode 100644 index 000000000..3c8ce876a Binary files /dev/null and b/pdf/static/net/text/add-text/images/thumb.png differ diff --git a/pdf/static/net/text/add-transparent-text/images/1.png b/pdf/static/net/text/add-transparent-text/images/1.png new file mode 100644 index 000000000..a16a3a4af Binary files /dev/null and b/pdf/static/net/text/add-transparent-text/images/1.png differ diff --git a/pdf/static/net/text/add-transparent-text/images/2.png b/pdf/static/net/text/add-transparent-text/images/2.png new file mode 100644 index 000000000..2371bce38 Binary files /dev/null and b/pdf/static/net/text/add-transparent-text/images/2.png differ diff --git a/pdf/static/net/text/add-transparent-text/images/Gemini_Generated_Image_i54rh2i54rh2i54r.jpeg b/pdf/static/net/text/add-transparent-text/images/Gemini_Generated_Image_i54rh2i54rh2i54r.jpeg new file mode 100644 index 000000000..7ac0559ba Binary files /dev/null and b/pdf/static/net/text/add-transparent-text/images/Gemini_Generated_Image_i54rh2i54rh2i54r.jpeg differ diff --git a/pdf/static/net/text/add-transparent-text/images/Gemini_Generated_Image_i54rh2i54rh2i54r.png b/pdf/static/net/text/add-transparent-text/images/Gemini_Generated_Image_i54rh2i54rh2i54r.png new file mode 100644 index 000000000..c24ecfc75 Binary files /dev/null and b/pdf/static/net/text/add-transparent-text/images/Gemini_Generated_Image_i54rh2i54rh2i54r.png differ diff --git a/pdf/static/net/text/add-underline-text/images/1.png b/pdf/static/net/text/add-underline-text/images/1.png new file mode 100644 index 000000000..98be37723 Binary files /dev/null and b/pdf/static/net/text/add-underline-text/images/1.png differ diff --git a/pdf/static/net/text/add-underline-text/images/thumb.jpeg b/pdf/static/net/text/add-underline-text/images/thumb.jpeg new file mode 100644 index 000000000..94c899bce Binary files /dev/null and b/pdf/static/net/text/add-underline-text/images/thumb.jpeg differ diff --git a/pdf/static/net/text/add-underline-text/images/thumb.png b/pdf/static/net/text/add-underline-text/images/thumb.png new file mode 100644 index 000000000..cec32d699 Binary files /dev/null and b/pdf/static/net/text/add-underline-text/images/thumb.png differ diff --git a/pdf/static/net/text/create-multi-column/images/1.png b/pdf/static/net/text/create-multi-column/images/1.png new file mode 100644 index 000000000..b4c686a73 Binary files /dev/null and b/pdf/static/net/text/create-multi-column/images/1.png differ diff --git a/pdf/static/net/text/create-multi-column/images/2.png b/pdf/static/net/text/create-multi-column/images/2.png new file mode 100644 index 000000000..2ecca335a Binary files /dev/null and b/pdf/static/net/text/create-multi-column/images/2.png differ diff --git a/pdf/static/net/text/create-multi-column/images/thumb.jpeg b/pdf/static/net/text/create-multi-column/images/thumb.jpeg new file mode 100644 index 000000000..6a6d69829 Binary files /dev/null and b/pdf/static/net/text/create-multi-column/images/thumb.jpeg differ diff --git a/pdf/static/net/text/create-multi-column/images/thumb.png b/pdf/static/net/text/create-multi-column/images/thumb.png new file mode 100644 index 000000000..af0d5a366 Binary files /dev/null and b/pdf/static/net/text/create-multi-column/images/thumb.png differ diff --git a/pdf/static/net/text/multicolumn-paragraphs/images/1.png b/pdf/static/net/text/multicolumn-paragraphs/images/1.png new file mode 100644 index 000000000..9652f54d3 Binary files /dev/null and b/pdf/static/net/text/multicolumn-paragraphs/images/1.png differ diff --git a/pdf/static/net/text/multicolumn-paragraphs/images/2.png b/pdf/static/net/text/multicolumn-paragraphs/images/2.png new file mode 100644 index 000000000..8ae2a6924 Binary files /dev/null and b/pdf/static/net/text/multicolumn-paragraphs/images/2.png differ diff --git a/pdf/static/net/text/multicolumn-paragraphs/images/thumb.jpeg b/pdf/static/net/text/multicolumn-paragraphs/images/thumb.jpeg new file mode 100644 index 000000000..aabe2e954 Binary files /dev/null and b/pdf/static/net/text/multicolumn-paragraphs/images/thumb.jpeg differ diff --git a/pdf/static/net/text/multicolumn-paragraphs/images/thumb.png b/pdf/static/net/text/multicolumn-paragraphs/images/thumb.png new file mode 100644 index 000000000..707a67f6b Binary files /dev/null and b/pdf/static/net/text/multicolumn-paragraphs/images/thumb.png differ