Skip to content

Instantly share code, notes, and snippets.

View documentprocessing's full-sized avatar

Document Processing documentprocessing

View GitHub Profile
@documentprocessing
documentprocessing / add-watermark-to-pdf-with-questpdf-api.cs
Created October 26, 2024 06:51
Add Watermark to PDF with QuestPDF for .NET
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
class Program
{
static void Main(string[] args)
{
// Create a PDF document
Document.Create(document =>
@documentprocessing
documentprocessing / add-image-to-pdf-questpdf.cs
Created October 26, 2024 06:17
Add image to PDF using QuestPDF
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
class Program
{
static void Main(string[] args)
{
// Create a PDF document
Document.Create(document =>
@documentprocessing
documentprocessing / create-pdf-using-questpdf.cs
Created October 26, 2024 06:15
Create PDF using QuestPDF for .NET
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
class Program
{
static void Main(string[] args)
{
// Create a PDF document
Document.Create(document =>
@documentprocessing
documentprocessing / add-watermark-in-pdf-using-pdfsharp-dotnet.cs
Created October 19, 2024 08:22
Add Wartermark in PDF using PDFSharp for .NET API
using System;
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
using PdfSharp.Drawing;
class Program
{
static void Main(string[] args)
{
// Load an existing PDF document
@documentprocessing
documentprocessing / insert-table-in-pdf-with-pdfsharp-dotnet.cs
Created October 19, 2024 08:16
Insert Table in a PDF document using PDFSharp for .NET
using PdfSharp.Pdf;
using PdfSharp.Drawing;
PdfDocument document = new PdfDocument();
PdfPage page = document.AddPage();
XGraphics gfx = XGraphics.FromPdfPage(page);
XFont font = new XFont("Verdana", 12, XFontStyle.Regular);
int rows = 5;
int cols = 3;
@documentprocessing
documentprocessing / add-image-to-pdf-with-pdfsharp-dotnet.cs
Created October 19, 2024 08:06
Add image to PDF using PDFSharp API
using System;
using PdfSharp.Pdf;
using PdfSharp.Drawing;
class Program
{
static void Main(string[] args)
{
// Create a new PDF document
PdfDocument document = new PdfDocument();
@documentprocessing
documentprocessing / create-pdf-using-dotnet-pdfsharp.cs
Created October 19, 2024 07:55
Create PDF using PDFSharp API for .NET
using System;
using PdfSharp.Pdf;
using PdfSharp.Drawing;
class Program
{
static void Main(string[] args)
{
// Create a new PDF document
PdfDocument document = new PdfDocument();
@documentprocessing
documentprocessing / insert-image-in-docx-xwpf.java
Created October 15, 2024 13:38
Insert image in DOCX using Apache POI XWPF API
// Create a new document
XWPFDocument document = new XWPFDocument();
// Create a new paragraph in the document
XWPFParagraph paragraph = document.createParagraph();
XWPFRun run = paragraph.createRun();
run.setText("Here is an image below:");
// Insert an image
FileInputStream imageStream = new FileInputStream("path/to/your/image.jpg");
@documentprocessing
documentprocessing / add-header-footer-to-docx-java-apache-poi.java
Last active October 15, 2024 13:20
Add Header and Footer to DOCX file
@documentprocessing
documentprocessing / read-docx-using-apache-poi-xwpf.java
Created October 15, 2024 08:09
Read Existing DOCX using Apache POI XWPF API
// Path to the input DOCX file
String inputFilePath = "input.docx";
// Path to the output DOCX file after modification
String outputFilePath = "output.docx";
// Open the DOCX file for reading
FileInputStream fis = new FileInputStream(inputFilePath);
XWPFDocument document = new XWPFDocument(fis);
// Read the paragraphs of the DOCX file