Skip to content

Instantly share code, notes, and snippets.

@documentprocessing
documentprocessing / read-outlook-msg-properties-with-msgreader.cs
Created October 29, 2024 15:41
Read Outlook MSG properties using MSGReader API
using (var msg = new MsgReader.Outlook.Storage.Message("testfile.msg"))
{
var from = msg.Sender;
var sentOn = msg.SentOn;
var recipientsTo = msg.GetEmailRecipients(MsgReader.Outlook.RecipientType.To, false, false);
var recipientsCc = msg.GetEmailRecipients(MsgReader.Outlook.RecipientType.Cc, false, false);
var subject = msg.Subject;
var htmlBody = msg.BodyHtml;
// etc...
}
@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