From c421c0fad57bb55e666fc202bc12d06ae6fc2bc0 Mon Sep 17 00:00:00 2001 From: Aspose-Tester Date: Thu, 20 Aug 2026 01:05:47 -0700 Subject: [PATCH 1/2] Add 48 example(s) for facades-stamps --- facades-stamps/AGENTS.md | 78 +- facades-stamps/README.md | 67 - ...d-image-watermark-to-specific-pdf-pages.cs | 54 - ...kground-watermark-to-specific-pdf-pages.cs | 58 + .../add-barcode-header-to-pdf-pages.cs | 43 - .../add-confidential-text-and-logo-stamp.cs | 65 + .../add-creation-date-stamp-to-pdf.cs | 55 - facades-stamps/add-creation-date-stamp.cs | 51 + .../add-custom-border-stamp-to-pdf.cs | 47 + .../add-dynamic-text-stamp-to-pdf.cs | 75 +- .../add-file-name-header-stamp-to-pdf.cs | 48 +- ...add-footer-date-stamp-to-last-pdf-page.cs} | 26 +- facades-stamps/add-footer-page-count-stamp.cs | 38 - ...add-footer-stamp-10-points-above-bottom.cs | 43 +- facades-stamps/add-footer-with-page-count.cs | 38 + .../add-header-stamp-to-all-pdf-pages.cs | 64 - .../add-header-stamp-to-pdf-pages.cs | 44 + .../add-image-and-text-stamp-to-pdf.cs | 66 - ...-image-stamp-to-pdfs-preserve-filenames.cs | 52 + .../add-lower-roman-page-numbers-odd-pages.cs | 55 + ...wercase-roman-page-numbers-to-odd-pages.cs | 58 - .../add-multi-line-colored-header-stamp.cs | 80 +- .../add-multi-line-text-watermark-facade.cs | 53 + .../add-multi-line-text-watermark-pdf.cs | 48 - .../add-multi-line-text-watermark.cs | 71 ++ .../add-multi-line-watermark-custom-font.cs | 69 + .../add-multi-line-watermark-pdf.cs | 66 - .../add-multi-line-watermark-to-pdf.cs | 62 - ...multi-line-watermark-varying-font-sizes.cs | 78 -- .../add-page-number-stamp-leading-zeros.cs | 40 + .../add-page-number-stamp-to-pdf.cs | 35 + ...dd-page-number-stamp-with-leading-zeros.cs | 60 - facades-stamps/add-page-numbers-to-pdf.cs | 30 - .../add-qr-code-stamp-from-pdf-metadata.cs | 60 + .../add-qr-code-verification-stamp.cs | 77 -- .../add-repeating-background-image-stamp.cs | 54 - ...dd-repeating-background-watermark-image.cs | 63 + .../add-right-aligned-image-stamp-to-pdf.cs | 49 - .../add-right-aligned-logo-stamp-to-pdf.cs | 48 + .../add-semi-transparent-background-stamp.cs | 44 +- ...d-semi-transparent-png-background-stamp.cs | 58 - .../add-text-stamp-overlay-to-pdf-pages.cs | 58 - ...add-transparent-confidential-text-stamp.cs | 53 + ...parent-text-stamp-to-selected-pdf-pages.cs | 58 - .../apply-custom-colored-stamp-with-border.cs | 57 - .../apply-custom-line-height-stamp.cs | 45 + .../apply-external-pdf-template-stamp.cs | 54 + .../apply-image-stamp-to-all-pdf-pages.cs | 46 + ...-multi-line-text-stamp-1-5-line-spacing.cs | 51 - .../apply-pdf-page-stamp-as-background.cs | 16 +- .../apply-pdf-stamp-preserve-filenames.cs | 47 - .../apply-pdf-template-stamp-to-page.cs | 44 - .../apply-rotated-image-stamp-bottom-right.cs | 57 - .../apply-rotated-image-stamp-to-pdf-pages.cs | 66 + .../apply-rotated-text-stamp-odd-pages.cs | 55 + .../apply-rotated-text-stamp-to-odd-pages.cs | 56 - .../apply-rotating-stamps-to-pdf-pages.cs | 53 + facades-stamps/apply-rotating-text-stamps.cs | 66 - ...y-semi-transparent-png-background-stamp.cs | 56 + .../apply-stamp-to-even-pdf-pages.cs | 53 + .../apply-text-stamp-to-even-pages.cs | 58 - .../apply-text-stamp-to-specific-pdf-pages.cs | 73 +- .../apply-text-watermark-all-pdf-pages.cs | 45 - .../apply-translucent-text-watermark.cs | 56 + .../apply-translucent-watermark-to-pdf.cs | 53 - .../batch-add-multi-line-watermark-to-pdfs.cs | 98 +- ...h-add-rotated-image-stamp-to-first-page.cs | 57 + .../batch-add-rotated-image-stamp.cs | 69 - .../batch-apply-rotated-pdf-stamp.cs | 73 +- .../combine-image-text-pdf-stamp.cs | 59 +- ...ine-multiple-pdfs-into-multi-page-stamp.cs | 67 + facades-stamps/create-multi-page-pdf-stamp.cs | 68 - facades-stamps/custom-font-stamp-branding.cs | 64 +- facades-stamps/index.json | 1105 ++++++++--------- .../merge-cover-page-background-pdf.cs | 42 - facades-stamps/merge-cover-page-background.cs | 44 + .../multi-line-watermark-addnewlinetext.cs | 76 ++ .../overlay-disclaimer-pdf-first-page.cs | 46 - .../overlay-image-stamp-on-pdf-pages.cs | 50 + ...rlay-legal-disclaimer-with-pdffilestamp.cs | 60 + .../qr-code-and-text-stamp-for-pdf.cs | 59 + .../rotate-text-stamp-45-degrees.cs | 69 +- .../rotate-text-stamp-90-degrees.cs | 66 - .../rotate-text-stamp-on-pdf-pages.cs | 54 + .../stamp-pdf-with-dynamic-barcode.cs | 79 +- 85 files changed, 2849 insertions(+), 3002 deletions(-) delete mode 100644 facades-stamps/README.md delete mode 100644 facades-stamps/add-background-image-watermark-to-specific-pdf-pages.cs create mode 100644 facades-stamps/add-background-watermark-to-specific-pdf-pages.cs delete mode 100644 facades-stamps/add-barcode-header-to-pdf-pages.cs create mode 100644 facades-stamps/add-confidential-text-and-logo-stamp.cs delete mode 100644 facades-stamps/add-creation-date-stamp-to-pdf.cs create mode 100644 facades-stamps/add-creation-date-stamp.cs create mode 100644 facades-stamps/add-custom-border-stamp-to-pdf.cs rename facades-stamps/{add-footer-date-stamp-to-last-page.cs => add-footer-date-stamp-to-last-pdf-page.cs} (52%) delete mode 100644 facades-stamps/add-footer-page-count-stamp.cs create mode 100644 facades-stamps/add-footer-with-page-count.cs delete mode 100644 facades-stamps/add-header-stamp-to-all-pdf-pages.cs create mode 100644 facades-stamps/add-header-stamp-to-pdf-pages.cs delete mode 100644 facades-stamps/add-image-and-text-stamp-to-pdf.cs create mode 100644 facades-stamps/add-image-stamp-to-pdfs-preserve-filenames.cs create mode 100644 facades-stamps/add-lower-roman-page-numbers-odd-pages.cs delete mode 100644 facades-stamps/add-lowercase-roman-page-numbers-to-odd-pages.cs create mode 100644 facades-stamps/add-multi-line-text-watermark-facade.cs delete mode 100644 facades-stamps/add-multi-line-text-watermark-pdf.cs create mode 100644 facades-stamps/add-multi-line-text-watermark.cs create mode 100644 facades-stamps/add-multi-line-watermark-custom-font.cs delete mode 100644 facades-stamps/add-multi-line-watermark-pdf.cs delete mode 100644 facades-stamps/add-multi-line-watermark-to-pdf.cs delete mode 100644 facades-stamps/add-multi-line-watermark-varying-font-sizes.cs create mode 100644 facades-stamps/add-page-number-stamp-leading-zeros.cs create mode 100644 facades-stamps/add-page-number-stamp-to-pdf.cs delete mode 100644 facades-stamps/add-page-number-stamp-with-leading-zeros.cs delete mode 100644 facades-stamps/add-page-numbers-to-pdf.cs create mode 100644 facades-stamps/add-qr-code-stamp-from-pdf-metadata.cs delete mode 100644 facades-stamps/add-qr-code-verification-stamp.cs delete mode 100644 facades-stamps/add-repeating-background-image-stamp.cs create mode 100644 facades-stamps/add-repeating-background-watermark-image.cs delete mode 100644 facades-stamps/add-right-aligned-image-stamp-to-pdf.cs create mode 100644 facades-stamps/add-right-aligned-logo-stamp-to-pdf.cs delete mode 100644 facades-stamps/add-semi-transparent-png-background-stamp.cs delete mode 100644 facades-stamps/add-text-stamp-overlay-to-pdf-pages.cs create mode 100644 facades-stamps/add-transparent-confidential-text-stamp.cs delete mode 100644 facades-stamps/add-transparent-text-stamp-to-selected-pdf-pages.cs delete mode 100644 facades-stamps/apply-custom-colored-stamp-with-border.cs create mode 100644 facades-stamps/apply-custom-line-height-stamp.cs create mode 100644 facades-stamps/apply-external-pdf-template-stamp.cs create mode 100644 facades-stamps/apply-image-stamp-to-all-pdf-pages.cs delete mode 100644 facades-stamps/apply-multi-line-text-stamp-1-5-line-spacing.cs delete mode 100644 facades-stamps/apply-pdf-stamp-preserve-filenames.cs delete mode 100644 facades-stamps/apply-pdf-template-stamp-to-page.cs delete mode 100644 facades-stamps/apply-rotated-image-stamp-bottom-right.cs create mode 100644 facades-stamps/apply-rotated-image-stamp-to-pdf-pages.cs create mode 100644 facades-stamps/apply-rotated-text-stamp-odd-pages.cs delete mode 100644 facades-stamps/apply-rotated-text-stamp-to-odd-pages.cs create mode 100644 facades-stamps/apply-rotating-stamps-to-pdf-pages.cs delete mode 100644 facades-stamps/apply-rotating-text-stamps.cs create mode 100644 facades-stamps/apply-semi-transparent-png-background-stamp.cs create mode 100644 facades-stamps/apply-stamp-to-even-pdf-pages.cs delete mode 100644 facades-stamps/apply-text-stamp-to-even-pages.cs delete mode 100644 facades-stamps/apply-text-watermark-all-pdf-pages.cs create mode 100644 facades-stamps/apply-translucent-text-watermark.cs delete mode 100644 facades-stamps/apply-translucent-watermark-to-pdf.cs create mode 100644 facades-stamps/batch-add-rotated-image-stamp-to-first-page.cs delete mode 100644 facades-stamps/batch-add-rotated-image-stamp.cs create mode 100644 facades-stamps/combine-multiple-pdfs-into-multi-page-stamp.cs delete mode 100644 facades-stamps/create-multi-page-pdf-stamp.cs delete mode 100644 facades-stamps/merge-cover-page-background-pdf.cs create mode 100644 facades-stamps/merge-cover-page-background.cs create mode 100644 facades-stamps/multi-line-watermark-addnewlinetext.cs delete mode 100644 facades-stamps/overlay-disclaimer-pdf-first-page.cs create mode 100644 facades-stamps/overlay-image-stamp-on-pdf-pages.cs create mode 100644 facades-stamps/overlay-legal-disclaimer-with-pdffilestamp.cs create mode 100644 facades-stamps/qr-code-and-text-stamp-for-pdf.cs delete mode 100644 facades-stamps/rotate-text-stamp-90-degrees.cs create mode 100644 facades-stamps/rotate-text-stamp-on-pdf-pages.cs diff --git a/facades-stamps/AGENTS.md b/facades-stamps/AGENTS.md index 4817def75..a679a0e9c 100644 --- a/facades-stamps/AGENTS.md +++ b/facades-stamps/AGENTS.md @@ -8,7 +8,7 @@ parent: ../agents.md # AGENTS - facades-stamps -> **Facades stamps** in PDF using C# / .NET -- **48** verified, compile-tested examples for **Aspose.PDF for .NET** 26.7.0. Each `.cs` file is a standalone, build-validated console example, generated and runtime-checked by an AI agent before publishing. +> **Facades stamps** in PDF using C# / .NET -- **48** verified, compile-tested examples for **Aspose.PDF for .NET** 26.8.0. Each `.cs` file is a standalone, build-validated console example, generated and runtime-checked by an AI agent before publishing. ## Persona @@ -23,15 +23,15 @@ See the root [agents.md](../agents.md) for repository-wide conventions and bound ## Required Namespaces -- `using Aspose.Pdf.Facades;` (38/48 files) ← category-specific -- `using Aspose.Pdf;` (33/48 files) ← category-specific -- `using Aspose.Pdf.Text;` (19/48 files) -- `using Aspose.Pdf.Drawing;` (2/48 files) -- `using Aspose.Pdf.Annotations;` (1/48 files) +- `using Aspose.Pdf.Facades;` (37/48 files) ← category-specific +- `using Aspose.Pdf;` (35/48 files) ← category-specific +- `using Aspose.Pdf.Text;` (14/48 files) +- `using Aspose.Pdf.Annotations;` (2/48 files) +- `using Aspose.Pdf.Drawing;` (1/48 files) - `using Aspose.Pdf.Forms;` (1/48 files) - `using System;` (48/48 files) -- `using System.IO;` (44/48 files) -- `using System.Drawing;` (9/48 files) +- `using System.IO;` (47/48 files) +- `using System.Drawing;` (11/48 files) - `using System.Text;` (1/48 files) ## Common Code Pattern @@ -49,36 +49,36 @@ tool.Save("output.pdf"); | File | Title | Key APIs | Description | |------|-------|----------|-------------| -| [add-background-image-watermark-to-specific-pdf-pag...](./add-background-image-watermark-to-specific-pdf-pages.cs) | Add Background Image Watermark to Specific PDF Pages | `PdfFileStamp`, `Stamp`, `BindPdf` | Demonstrates how to apply an image watermark as a background stamp to pages 2‑5 of a PDF using As... | -| [add-barcode-header-to-pdf-pages](./add-barcode-header-to-pdf-pages.cs) | Add Barcode Header to PDF Pages | `PdfFileStamp`, `AddHeader`, `Close` | Shows how to use Aspose.Pdf.Facades.PdfFileStamp to place a pre‑generated barcode image as a head... | -| [add-creation-date-stamp-to-pdf](./add-creation-date-stamp-to-pdf.cs) | Add Creation Date Stamp to PDF Pages | `Document`, `TextStamp`, `FindFont` | Demonstrates how to add a text stamp that displays the document's creation date (formatted as yyy... | -| [add-dynamic-text-stamp-to-pdf](./add-dynamic-text-stamp-to-pdf.cs) | Add Dynamic Text Stamp to PDF | `FormattedText`, `Stamp`, `BindLogo` | Demonstrates creating a formatted text stamp with dynamic author and date values using string int... | -| [add-file-name-header-stamp-to-pdf](./add-file-name-header-stamp-to-pdf.cs) | Add File Name Header Stamp to PDF | `PdfFileStamp`, `AddHeader`, `Close` | Demonstrates how to use Aspose.Pdf's PdfFileStamp facade to add a header containing the source PD... | -| [add-footer-date-stamp-to-last-page](./add-footer-date-stamp-to-last-page.cs) | Add Footer Date Stamp to Last PDF Page | `Document`, `Page`, `TextStamp` | Shows how to add a footer stamp with the current date (MM-dd-yyyy) to only the last page of a PDF... | -| [add-footer-page-count-stamp](./add-footer-page-count-stamp.cs) | Add Footer Page Count Stamp to PDF | `PdfFileStamp`, `BindPdf`, `AddPageNumber` | Shows how to use Aspose.Pdf.Facades.PdfFileStamp to add a footer that automatically displays the ... | -| [add-footer-stamp-10-points-above-bottom](./add-footer-stamp-10-points-above-bottom.cs) | Add Footer Stamp 10 Points Above Bottom Edge | `PdfFileStamp`, `FormattedText`, `EncodingType` | Demonstrates how to place a footer stamp exactly 10 points above the page bottom using Aspose.Pdf... | -| [add-header-stamp-to-all-pdf-pages](./add-header-stamp-to-all-pdf-pages.cs) | Add Header Stamp to All PDF Pages | `PdfFileStamp`, `Document`, `FormattedText` | Demonstrates iterating through a PDF document and adding a header stamp with a company name to ea... | -| [add-image-and-text-stamp-to-pdf](./add-image-and-text-stamp-to-pdf.cs) | Add Image and Text Stamp to PDF | `PdfFileStamp`, `Stamp`, `FormattedText` | Demonstrates how to use Aspose.Pdf.Facades to place a company logo image and a bold "Confidential... | -| [add-lowercase-roman-page-numbers-to-odd-pages](./add-lowercase-roman-page-numbers-to-odd-pages.cs) | Add Lowercase Roman Page Numbers to Odd Pages | `Document`, `PageNumberStamp`, `NumberingStyle` | Demonstrates how to add page numbers in lowercase Roman numerals to only the odd pages of a PDF u... | -| [add-multi-line-colored-header-stamp](./add-multi-line-colored-header-stamp.cs) | Add Multi‑Line Colored Header Stamp to PDF Pages | `Document`, `Page`, `TextStamp` | Demonstrates how to add a multi‑line header to each page of a PDF using Aspose.Pdf, with each lin... | -| [add-multi-line-text-watermark-pdf](./add-multi-line-text-watermark-pdf.cs) | Add Multi-Line Text Watermark to PDF | `BindPdf`, `AddHeader`, `Save` | Shows how to create a multi-line text watermark and add it as a header on every page of a PDF usi... | -| [add-multi-line-watermark-pdf](./add-multi-line-watermark-pdf.cs) | Add Multi-Line Watermark with Line Spacing to PDF | `PdfFileStamp`, `BindPdf`, `AddStamp` | Demonstrates using Aspose.Pdf.Facades to apply a multi‑line text watermark with opacity and backg... | -| [add-multi-line-watermark-to-pdf](./add-multi-line-watermark-to-pdf.cs) | Add Multi‑Line Watermark to PDF from Memory Stream | `PdfFileStamp`, `FormattedText`, `Stamp` | Shows how to create a PDF in memory and apply a multi‑line, colored, custom‑size watermark using ... | -| [add-multi-line-watermark-varying-font-sizes](./add-multi-line-watermark-varying-font-sizes.cs) | Add Multi-Line Watermark with Varying Font Sizes | `Document`, `PdfFileMend`, `BindPdf` | Creates a PDF and uses PdfFileMend to add three watermark lines at the top of each page, each wit... | -| [add-page-number-stamp-with-leading-zeros](./add-page-number-stamp-with-leading-zeros.cs) | Add Page Number Stamp with Leading Zeros to PDF | `Document`, `Page`, `TextStamp` | Shows how to add a page‑number stamp formatted with leading zeros to every page of a PDF using As... | -| [add-page-numbers-to-pdf](./add-page-numbers-to-pdf.cs) | Add Page Numbers to PDF using PdfFileStamp | `PdfFileStamp`, `AddPageNumber`, `Close` | Demonstrates stamping a PDF with dynamic page numbers using the PdfFileStamp facade and the '#' p... | -| [add-qr-code-verification-stamp](./add-qr-code-verification-stamp.cs) | Add QR Code and Description Stamp to PDF | `Document`, `ImageStamp`, `TextStamp` | Demonstrates how to load a PDF, create an image stamp for a QR code and a text stamp with verific... | -| [add-repeating-background-image-stamp](./add-repeating-background-image-stamp.cs) | Add Repeating Background Image Stamp to PDF | `PdfFileStamp`, `Stamp`, `BindImage` | Demonstrates how to use Aspose.Pdf.Facades to apply a single image stamp as a background watermar... | -| [add-right-aligned-image-stamp-to-pdf](./add-right-aligned-image-stamp-to-pdf.cs) | Add Right-Aligned Image Stamp to PDF | `Document`, `ImageStamp`, `HorizontalAlignment` | Shows how to load a PDF, create an ImageStamp, set its HorizontalAlignment to Right, and apply th... | -| [add-semi-transparent-background-stamp](./add-semi-transparent-background-stamp.cs) | Add Semi-Transparent Background Stamp to PDF | `Stamp`, `PdfFileStamp`, `FormattedText` | Demonstrates creating a formatted text stamp, setting it as a background with 30% opacity, and ap... | -| [add-semi-transparent-png-background-stamp](./add-semi-transparent-png-background-stamp.cs) | Add Semi-Transparent PNG Background Stamp to PDF | `Document`, `PdfFileStamp`, `Stamp` | Demonstrates how to apply a semi‑transparent PNG image as a background stamp that covers the enti... | -| [add-text-stamp-overlay-to-pdf-pages](./add-text-stamp-overlay-to-pdf-pages.cs) | Add Text Stamp Overlay to PDF Pages | `PdfFileStamp`, `BindPdf`, `AddStamp` | Demonstrates how to use the PdfFileStamp facade to place a formatted text stamp on top of existin... | -| [add-transparent-text-stamp-to-selected-pdf-pages](./add-transparent-text-stamp-to-selected-pdf-pages.cs) | Add Transparent Text Stamp to Selected PDF Pages | `PdfFileStamp`, `Stamp`, `FormattedText` | Demonstrates how to apply a semi‑transparent red text stamp labeled 'CONFIDENTIAL' to specific pa... | -| [apply-custom-colored-stamp-with-border](./apply-custom-colored-stamp-with-border.cs) | Apply Custom Colored Stamp with Border to PDF Pages | `Document`, `Page`, `StampAnnotation` | Demonstrates how to add a rubber‑stamp annotation with custom text, color, and border thickness t... | -| [apply-multi-line-text-stamp-1-5-line-spacing](./apply-multi-line-text-stamp-1-5-line-spacing.cs) | Apply Multi-Line Text Stamp with 1.5 Line Spacing | `FormattedText`, `AddNewLineText`, `Stamp` | Demonstrates creating a multi-line text watermark with 1.5 line spacing using FormattedText, bind... | -| [apply-pdf-page-stamp-as-background](./apply-pdf-page-stamp-as-background.cs) | Apply PDF Page Stamp as Background to All Pages | `PdfFileStamp`, `BindPdf`, `Stamp` | Shows how to use Aspose.Pdf.Facades to bind a source PDF, create a background stamp from another ... | -| [apply-pdf-stamp-preserve-filenames](./apply-pdf-stamp-preserve-filenames.cs) | Apply PDF Stamp and Preserve Original Filenames | `PdfFileStamp`, `Stamp`, `InputFile` | Demonstrates how to batch‑apply a PDF stamp to each document in a folder using Aspose.Pdf.Facades... | -| [apply-pdf-template-stamp-to-page](./apply-pdf-template-stamp-to-page.cs) | Apply PDF Template Stamp to Specific Page | `PdfFileStamp`, `Stamp`, `BindPdf` | Shows how to use Aspose.Pdf.Facades.PdfFileStamp and Stamp to bind a page from an external templa... | +| [add-background-watermark-to-specific-pdf-pages](./add-background-watermark-to-specific-pdf-pages.cs) | Add Background Watermark to Specific PDF Pages | `PdfFileStamp`, `Stamp`, `FormattedText` | Demonstrates how to apply a light‑gray background watermark to pages 2‑5 of a PDF using Aspose.Pd... | +| [add-confidential-text-and-logo-stamp](./add-confidential-text-and-logo-stamp.cs) | Add Confidential Text and Logo Stamp to PDF | `PdfFileStamp`, `Stamp`, `FormattedText` | Demonstrates using Aspose.Pdf.Facades to place a combined formatted text stamp and a logo image o... | +| [add-creation-date-stamp](./add-creation-date-stamp.cs) | Add Creation Date Stamp to PDF | `Document`, `DocumentInfo`, `TextStamp` | Shows how to read a PDF's creation date and place it as a text stamp in the top‑left corner of ev... | +| [add-custom-border-stamp-to-pdf](./add-custom-border-stamp-to-pdf.cs) | Add Custom Border Stamp Annotation to PDF | `Document`, `StampAnnotation`, `Border` | Demonstrates how to load a PDF, create a rubber‑stamp annotation with a custom red border and thi... | +| [add-dynamic-text-stamp-to-pdf](./add-dynamic-text-stamp-to-pdf.cs) | Add Dynamic Text Stamp to PDF | `Document`, `Page`, `TextStamp` | Demonstrates creating a TextStamp with interpolated author and date values, applying it to each p... | +| [add-file-name-header-stamp-to-pdf](./add-file-name-header-stamp-to-pdf.cs) | Add File Name Header Stamp to PDF | `Document`, `TextStamp`, `FindFont` | Demonstrates creating a TextStamp that shows the PDF's file name in the header of each page and a... | +| [add-footer-date-stamp-to-last-pdf-page](./add-footer-date-stamp-to-last-pdf-page.cs) | Add Footer Date Stamp to Last PDF Page | `Document`, `Page`, `TextStamp` | Demonstrates how to insert a footer stamp containing the current date (MM-dd-yyyy) on the last pa... | +| [add-footer-stamp-10-points-above-bottom](./add-footer-stamp-10-points-above-bottom.cs) | Add Footer Stamp 10 Points Above Bottom Edge | `PdfFileStamp`, `BindPdf`, `AddFooter` | Demonstrates how to use PdfFileStamp to add a footer stamp positioned exactly 10 points above the... | +| [add-footer-with-page-count](./add-footer-with-page-count.cs) | Add Footer with Page Count to PDF | `PdfFileStamp`, `BindPdf`, `AddPageNumber` | Shows how to use Aspose.Pdf.Facades.PdfFileStamp to add a footer that displays the current page n... | +| [add-header-stamp-to-pdf-pages](./add-header-stamp-to-pdf-pages.cs) | Add Header Stamp to All PDF Pages | `Document`, `Page`, `TextStamp` | Shows how to load a PDF with Aspose.Pdf, iterate through its Pages collection, and add a centered... | +| [add-image-stamp-to-pdfs-preserve-filenames](./add-image-stamp-to-pdfs-preserve-filenames.cs) | Add Image Stamp to PDFs and Preserve Filenames | `PdfFileStamp`, `Stamp`, `BindPdf` | Iterates over PDF files in a source folder, applies an image stamp to each page using the PdfFile... | +| [add-lower-roman-page-numbers-odd-pages](./add-lower-roman-page-numbers-odd-pages.cs) | Add Lower‑Roman Page Numbers to Odd Pages | `Document`, `PageNumberStamp`, `NumberingStyle` | Demonstrates how to add page numbers in lower‑case Roman numerals to only the odd pages of a PDF ... | +| [add-multi-line-colored-header-stamp](./add-multi-line-colored-header-stamp.cs) | Add Multi-Line Colored Header Stamp to PDF | `BindPdf`, `AddStamp`, `Save` | Demonstrates how to apply a multi‑line header stamp with different font colors to each line using... | +| [add-multi-line-text-watermark-facade](./add-multi-line-text-watermark-facade.cs) | Add Multi-Line Text Watermark to PDF using Facades | `PdfFileStamp`, `FormattedText`, `AddNewLineText` | Shows how to create a multi-line text watermark with Aspose.Pdf.Facades by using FormattedText, a... | +| [add-multi-line-text-watermark](./add-multi-line-text-watermark.cs) | Add Multi‑Line Text Watermark with Varying Font Sizes | `Document`, `Page`, `FindFont` | Demonstrates how to apply a multi‑line watermark to each page of a PDF, using different font size... | +| [add-multi-line-watermark-custom-font](./add-multi-line-watermark-custom-font.cs) | Add Multi‑Line Watermark with Custom Font to PDF | `Document`, `FormattedText`, `BindLogo` | Demonstrates loading a PDF from a memory stream and applying a multi‑line, custom‑styled watermar... | +| [add-page-number-stamp-leading-zeros](./add-page-number-stamp-leading-zeros.cs) | Add Page Number Stamp with Leading Zeros to PDF | `Document`, `PdfFileStamp`, `NumberingStyle` | Shows how to use Aspose.Pdf to stamp Arabic numeral page numbers with leading zeros on every page... | +| [add-page-number-stamp-to-pdf](./add-page-number-stamp-to-pdf.cs) | Add Page Number Stamp to PDF | `PdfFileStamp`, `AddPageNumber`, `StartingNumber` | Shows how to use Aspose.Pdf.Facades.PdfFileStamp to add a dynamic page‑number stamp (using the "#... | +| [add-qr-code-stamp-from-pdf-metadata](./add-qr-code-stamp-from-pdf-metadata.cs) | Add QR Code Stamp from PDF Metadata | `Document`, `Stamp`, `PdfFileStamp` | Demonstrates how to generate a QR code from a PDF's metadata and apply it as a stamp on the docum... | +| [add-repeating-background-watermark-image](./add-repeating-background-watermark-image.cs) | Add Repeating Background Watermark Image to PDF Pages | `PdfFileStamp`, `Stamp`, `BindImage` | Shows how to use PdfFileStamp with a single Stamp instance to place a semi‑transparent background... | +| [add-right-aligned-logo-stamp-to-pdf](./add-right-aligned-logo-stamp-to-pdf.cs) | Add Right-Aligned Logo Stamp to PDF | `Document`, `ImageStamp`, `AddStamp` | Shows how to place an image stamp (logo) at the right margin of each page in a PDF using Aspose.Pdf. | +| [add-semi-transparent-background-stamp](./add-semi-transparent-background-stamp.cs) | Add Semi-Transparent Background Stamp to PDF | `PdfFileStamp`, `Stamp`, `BindPdf` | Demonstrates how to apply an image as a background stamp on all pages of a PDF with 30% opacity u... | +| [add-transparent-confidential-text-stamp](./add-transparent-confidential-text-stamp.cs) | Add Transparent Confidential Text Stamp to Selected PDF Page... | `Document`, `PdfFileStamp`, `FormattedText` | Demonstrates applying a 70% opaque red "CONFIDENTIAL" text stamp to specific pages of a PDF using... | +| [apply-custom-line-height-stamp](./apply-custom-line-height-stamp.cs) | Apply Custom Line-Height Stamp to PDF | `Stamp`, `PdfFileStamp`, `FormattedText` | Demonstrates how to create a multi‑line watermark with custom line spacing using a formatted text... | +| [apply-external-pdf-template-stamp](./apply-external-pdf-template-stamp.cs) | Apply External PDF Template as Stamp on a Specific Page | `PdfFileStamp`, `Stamp`, `BindPdf` | Shows how to create a PdfFileStamp from an external template PDF and apply it only to the third p... | +| [apply-image-stamp-to-all-pdf-pages](./apply-image-stamp-to-all-pdf-pages.cs) | Apply Image Stamp to All PDF Pages | `PdfFileStamp`, `Stamp`, `BindPdf` | Demonstrates using PdfFileStamp and Stamp to add a semi‑transparent image stamp to every page of ... | +| [apply-pdf-page-stamp-as-background](./apply-pdf-page-stamp-as-background.cs) | Apply PDF Page Stamp as Background to All Pages | `PdfFileStamp`, `Stamp`, `BindPdf` | Demonstrates how to use Aspose.Pdf.Facades to stamp every page of a PDF with the first page of an... | +| [apply-rotated-image-stamp-to-pdf-pages](./apply-rotated-image-stamp-to-pdf-pages.cs) | Apply Rotated Image Stamp to PDF Pages | `PdfFileStamp`, `Stamp`, `Document` | Demonstrates how to add an image stamp rotated by 30° to the bottom‑right corner of every page in... | +| [apply-rotated-text-stamp-odd-pages](./apply-rotated-text-stamp-odd-pages.cs) | Apply Rotated Text Stamp to Odd Pages | `Document`, `TextStamp`, `FindFont` | Demonstrates adding a 30‑degree rotated text stamp to the left margin of every odd‑numbered page ... | +| [apply-rotating-stamps-to-pdf-pages](./apply-rotating-stamps-to-pdf-pages.cs) | Apply Rotating Stamps to Each PDF Page | `Document`, `PdfFileStamp`, `Stamp` | Demonstrates how to add a text stamp to every page of a PDF and rotate each stamp based on the pa... | | ... | | | *and 18 more files* | ## Category Statistics @@ -124,5 +124,5 @@ tool.Save("output.pdf"); - Review code examples in this folder for facades-stamps patterns -Updated: 2026-07-17 | Run: `20260717_171638_da3b3e` +Updated: 2026-08-20 | Run: `20260820_001147_12d7b3` diff --git a/facades-stamps/README.md b/facades-stamps/README.md deleted file mode 100644 index 0f72d9a1e..000000000 --- a/facades-stamps/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# Facades stamps - -> **Facades stamps** in PDF using C# / .NET -- **48** verified, compile-tested examples for **Aspose.PDF for .NET** 26.7.0. Each `.cs` file is a standalone, build-validated console example, generated and runtime-checked by an AI agent before publishing. - -- Category: `facades-stamps` -- Examples: 48 -- NuGet: `Aspose.PDF 26.7.0` -- target `net10.0` - -## Examples - -- [`add-background-image-watermark-to-specific-pdf-pages.cs`](./add-background-image-watermark-to-specific-pdf-pages.cs) -- Add background image watermark to specific pdf pages -- [`add-barcode-header-to-pdf-pages.cs`](./add-barcode-header-to-pdf-pages.cs) -- Add barcode header to pdf pages -- [`add-creation-date-stamp-to-pdf.cs`](./add-creation-date-stamp-to-pdf.cs) -- Add creation date stamp to pdf -- [`add-dynamic-text-stamp-to-pdf.cs`](./add-dynamic-text-stamp-to-pdf.cs) -- Add dynamic text stamp to pdf -- [`add-file-name-header-stamp-to-pdf.cs`](./add-file-name-header-stamp-to-pdf.cs) -- Add file name header stamp to pdf -- [`add-footer-date-stamp-to-last-page.cs`](./add-footer-date-stamp-to-last-page.cs) -- Add footer date stamp to last page -- [`add-footer-page-count-stamp.cs`](./add-footer-page-count-stamp.cs) -- Add footer page count stamp -- [`add-footer-stamp-10-points-above-bottom.cs`](./add-footer-stamp-10-points-above-bottom.cs) -- Add footer stamp 10 points above bottom -- [`add-header-stamp-to-all-pdf-pages.cs`](./add-header-stamp-to-all-pdf-pages.cs) -- Add header stamp to all pdf pages -- [`add-image-and-text-stamp-to-pdf.cs`](./add-image-and-text-stamp-to-pdf.cs) -- Add image and text stamp to pdf -- [`add-lowercase-roman-page-numbers-to-odd-pages.cs`](./add-lowercase-roman-page-numbers-to-odd-pages.cs) -- Add lowercase roman page numbers to odd pages -- [`add-multi-line-colored-header-stamp.cs`](./add-multi-line-colored-header-stamp.cs) -- Add multi line colored header stamp -- [`add-multi-line-text-watermark-pdf.cs`](./add-multi-line-text-watermark-pdf.cs) -- Add multi line text watermark pdf -- [`add-multi-line-watermark-pdf.cs`](./add-multi-line-watermark-pdf.cs) -- Add multi line watermark pdf -- [`add-multi-line-watermark-to-pdf.cs`](./add-multi-line-watermark-to-pdf.cs) -- Add multi line watermark to pdf -- [`add-multi-line-watermark-varying-font-sizes.cs`](./add-multi-line-watermark-varying-font-sizes.cs) -- Add multi line watermark varying font sizes -- [`add-page-number-stamp-with-leading-zeros.cs`](./add-page-number-stamp-with-leading-zeros.cs) -- Add page number stamp with leading zeros -- [`add-page-numbers-to-pdf.cs`](./add-page-numbers-to-pdf.cs) -- Add page numbers to pdf -- [`add-qr-code-verification-stamp.cs`](./add-qr-code-verification-stamp.cs) -- Add qr code verification stamp -- [`add-repeating-background-image-stamp.cs`](./add-repeating-background-image-stamp.cs) -- Add repeating background image stamp -- [`add-right-aligned-image-stamp-to-pdf.cs`](./add-right-aligned-image-stamp-to-pdf.cs) -- Add right aligned image stamp to pdf -- [`add-semi-transparent-background-stamp.cs`](./add-semi-transparent-background-stamp.cs) -- Add semi transparent background stamp -- [`add-semi-transparent-png-background-stamp.cs`](./add-semi-transparent-png-background-stamp.cs) -- Add semi transparent png background stamp -- [`add-text-stamp-overlay-to-pdf-pages.cs`](./add-text-stamp-overlay-to-pdf-pages.cs) -- Add text stamp overlay to pdf pages -- [`add-transparent-text-stamp-to-selected-pdf-pages.cs`](./add-transparent-text-stamp-to-selected-pdf-pages.cs) -- Add transparent text stamp to selected pdf pages -- [`apply-custom-colored-stamp-with-border.cs`](./apply-custom-colored-stamp-with-border.cs) -- Apply custom colored stamp with border -- [`apply-multi-line-text-stamp-1-5-line-spacing.cs`](./apply-multi-line-text-stamp-1-5-line-spacing.cs) -- Apply multi line text stamp 1 5 line spacing -- [`apply-pdf-page-stamp-as-background.cs`](./apply-pdf-page-stamp-as-background.cs) -- Apply pdf page stamp as background -- [`apply-pdf-stamp-preserve-filenames.cs`](./apply-pdf-stamp-preserve-filenames.cs) -- Apply pdf stamp preserve filenames -- [`apply-pdf-template-stamp-to-page.cs`](./apply-pdf-template-stamp-to-page.cs) -- Apply pdf template stamp to page -- [`apply-rotated-image-stamp-bottom-right.cs`](./apply-rotated-image-stamp-bottom-right.cs) -- Apply rotated image stamp bottom right -- [`apply-rotated-text-stamp-to-odd-pages.cs`](./apply-rotated-text-stamp-to-odd-pages.cs) -- Apply rotated text stamp to odd pages -- [`apply-rotating-text-stamps.cs`](./apply-rotating-text-stamps.cs) -- Apply rotating text stamps -- [`apply-text-stamp-to-even-pages.cs`](./apply-text-stamp-to-even-pages.cs) -- Apply text stamp to even pages -- [`apply-text-stamp-to-specific-pdf-pages.cs`](./apply-text-stamp-to-specific-pdf-pages.cs) -- Apply text stamp to specific pdf pages -- [`apply-text-watermark-all-pdf-pages.cs`](./apply-text-watermark-all-pdf-pages.cs) -- Apply text watermark all pdf pages -- [`apply-translucent-watermark-to-pdf.cs`](./apply-translucent-watermark-to-pdf.cs) -- Apply translucent watermark to pdf -- [`batch-add-multi-line-watermark-to-pdfs.cs`](./batch-add-multi-line-watermark-to-pdfs.cs) -- Batch add multi line watermark to pdfs -- [`batch-add-rotated-image-stamp.cs`](./batch-add-rotated-image-stamp.cs) -- Batch add rotated image stamp -- [`batch-apply-rotated-pdf-stamp.cs`](./batch-apply-rotated-pdf-stamp.cs) -- Batch apply rotated pdf stamp -- [`combine-image-text-pdf-stamp.cs`](./combine-image-text-pdf-stamp.cs) -- Combine image text pdf stamp -- [`create-multi-page-pdf-stamp.cs`](./create-multi-page-pdf-stamp.cs) -- Create multi page pdf stamp -- [`custom-font-stamp-branding.cs`](./custom-font-stamp-branding.cs) -- Custom font stamp branding -- [`merge-cover-page-background-pdf.cs`](./merge-cover-page-background-pdf.cs) -- Merge cover page background pdf -- [`overlay-disclaimer-pdf-first-page.cs`](./overlay-disclaimer-pdf-first-page.cs) -- Overlay disclaimer pdf first page -- [`rotate-text-stamp-45-degrees.cs`](./rotate-text-stamp-45-degrees.cs) -- Rotate text stamp 45 degrees -- [`rotate-text-stamp-90-degrees.cs`](./rotate-text-stamp-90-degrees.cs) -- Rotate text stamp 90 degrees -- [`stamp-pdf-with-dynamic-barcode.cs`](./stamp-pdf-with-dynamic-barcode.cs) -- Stamp pdf with dynamic barcode - -## See Also - -- [`AGENTS.md`](./AGENTS.md) -- category-specific anti-patterns, API surface, and conventions for AI coding agents -- [`../AGENTS.md`](../AGENTS.md) -- repository-wide agent guide -- [`../README.md`](../README.md) -- full category index and project overview -- [Aspose.PDF for .NET docs](https://docs.aspose.com/pdf/net/) - -> Each `.cs` file is a standalone, build-validated console example. Drop into a fresh `dotnet new console` project, add the `Aspose.PDF` NuGet (version above), and run. diff --git a/facades-stamps/add-background-image-watermark-to-specific-pdf-pages.cs b/facades-stamps/add-background-image-watermark-to-specific-pdf-pages.cs deleted file mode 100644 index b76157414..000000000 --- a/facades-stamps/add-background-image-watermark-to-specific-pdf-pages.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - // Input PDF, output PDF and watermark image paths - const string inputPdf = "input.pdf"; - const string outputPdf = "output.pdf"; - const string watermarkImage = "watermark.png"; - - // Verify files exist - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input file not found: {inputPdf}"); - return; - } - if (!File.Exists(watermarkImage)) - { - Console.Error.WriteLine($"Watermark image not found: {watermarkImage}"); - return; - } - - // Initialize PdfFileStamp facade and bind the source PDF - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.BindPdf(inputPdf); // Load source PDF - - // Create a stamp that will be used as a background watermark - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - - // Bind an image to the stamp (you could also use BindLogo for text) - stamp.BindImage(watermarkImage); - - // Make the stamp appear behind existing page content - stamp.IsBackground = true; - - // Apply the stamp only to pages 2 through 5 (1‑based indexing) - stamp.Pages = new int[] { 2, 3, 4, 5 }; - - // Add the configured stamp to the PDF - fileStamp.AddStamp(stamp); - - // Save the result to the output file - fileStamp.Save(outputPdf); - - // Close the facade (releases resources) - fileStamp.Close(); - - Console.WriteLine($"Background watermark applied to pages 2‑5 and saved as '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/add-background-watermark-to-specific-pdf-pages.cs b/facades-stamps/add-background-watermark-to-specific-pdf-pages.cs new file mode 100644 index 000000000..93ca5e385 --- /dev/null +++ b/facades-stamps/add-background-watermark-to-specific-pdf-pages.cs @@ -0,0 +1,58 @@ +using System; +using System.IO; +using System.Drawing; // For System.Drawing.Color +using Aspose.Pdf.Facades; // Facade classes: PdfFileStamp, Stamp, FormattedText, EncodingType + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "output.pdf"; + + // Verify input file exists + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"Input file not found: {inputPath}"); + return; + } + + // Initialize the PdfFileStamp facade (no using – it does not implement IDisposable) + PdfFileStamp fileStamp = new PdfFileStamp(); + + // Load the source PDF + fileStamp.BindPdf(inputPath); + + // Create a stamp object + Stamp stamp = new Stamp(); + + // Make the stamp a background watermark + stamp.IsBackground = true; + + // Apply the stamp only to pages 2 through 5 (1‑based indexing) + stamp.Pages = new int[] { 2, 3, 4, 5 }; + + // Prepare formatted text for the watermark + FormattedText ft = new FormattedText( + "CONFIDENTIAL", // Text to display + Color.LightGray, // Text color (System.Drawing.Color) + "Helvetica", // Font name + EncodingType.Winansi, // Text encoding + false, // Do not embed the font + 72); // Font size + + // Bind the formatted text to the stamp + stamp.BindLogo(ft); + + // Add the configured stamp to the PDF + fileStamp.AddStamp(stamp); + + // Save the resulting PDF + fileStamp.Save(outputPath); + + // Release resources + fileStamp.Close(); + + Console.WriteLine($"Background watermark applied to pages 2‑5 and saved as '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/add-barcode-header-to-pdf-pages.cs b/facades-stamps/add-barcode-header-to-pdf-pages.cs deleted file mode 100644 index 2a9549c57..000000000 --- a/facades-stamps/add-barcode-header-to-pdf-pages.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - // Paths – adjust as needed - const string inputPdfPath = "input.pdf"; - const string outputPdfPath = "output_with_barcode_header.pdf"; - const string barcodeImgPath = "barcode.png"; // pre‑generated barcode image - - // Verify files exist - if (!File.Exists(inputPdfPath)) - { - Console.Error.WriteLine($"Input PDF not found: {inputPdfPath}"); - return; - } - if (!File.Exists(barcodeImgPath)) - { - Console.Error.WriteLine($"Barcode image not found: {barcodeImgPath}"); - return; - } - - // PdfFileStamp does NOT implement IDisposable – no using block required. - // Set input and output files via properties (the recommended way). - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.InputFile = inputPdfPath; - fileStamp.OutputFile = outputPdfPath; - - // Add the barcode image as a header. - // The second argument is the top margin (in points) from the top edge of each page. - // Adjust the margin as needed to position the header correctly. - fileStamp.AddHeader(barcodeImgPath, topMargin: 20f); - - // Finalize and write the result. - fileStamp.Close(); - - Console.WriteLine($"Header with barcode added. Output saved to '{outputPdfPath}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/add-confidential-text-and-logo-stamp.cs b/facades-stamps/add-confidential-text-and-logo-stamp.cs new file mode 100644 index 000000000..41a8a3b9f --- /dev/null +++ b/facades-stamps/add-confidential-text-and-logo-stamp.cs @@ -0,0 +1,65 @@ +using System; +using System.IO; +using Aspose.Pdf.Facades; // Stamp, FormattedText, EncodingType +using System.Drawing; // for Color + +class Program +{ + static void Main() + { + // Paths – adjust as needed + const string inputPdf = "input.pdf"; + const string outputPdf = "output.pdf"; + const string logoPath = "logo.png"; + + // Verify files exist + if (!File.Exists(inputPdf)) + { + Console.Error.WriteLine($"Input PDF not found: {inputPdf}"); + return; + } + if (!File.Exists(logoPath)) + { + Console.Error.WriteLine($"Logo image not found: {logoPath}"); + return; + } + + // Initialize the PdfFileStamp facade and bind the source PDF + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(inputPdf); // loads the document to be stamped + + // Create formatted text for the word "Confidential" in bold + FormattedText confidentialText = new FormattedText( + "Confidential", // text + Color.Red, // text color (System.Drawing.Color) + "Helvetica-Bold", // bold font name + EncodingType.Winansi, // encoding + false, // embed font? + 36); // font size + + // Create a Stamp and bind both the text and the logo image + Stamp stamp = new Stamp(); + stamp.BindLogo(confidentialText); // bind the formatted text + stamp.BindImage(logoPath); // bind the logo image + + // Position the stamp (origin is the lower‑left corner of the stamp) + stamp.SetOrigin(100f, 500f); // X, Y in points + + // Optionally set the size of the image part of the stamp + stamp.SetImageSize(80f, 80f); // width, height in points + + // Make the stamp appear behind the page content (optional) + stamp.IsBackground = true; + + // Add the stamp to the PDF + fileStamp.AddStamp(stamp); + + // Save the stamped PDF + fileStamp.Save(outputPdf); + + // Close the facade (releases resources) + fileStamp.Close(); + + Console.WriteLine($"Stamped PDF saved to '{outputPdf}'."); + } +} diff --git a/facades-stamps/add-creation-date-stamp-to-pdf.cs b/facades-stamps/add-creation-date-stamp-to-pdf.cs deleted file mode 100644 index 55d52fe43..000000000 --- a/facades-stamps/add-creation-date-stamp-to-pdf.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using Aspose.Pdf; -using Aspose.Pdf.Text; -using Aspose.Pdf.Drawing; // needed for HorizontalAlignment & VerticalAlignment - -class Program -{ - static void Main() - { - // Paths to the source PDF and the resulting PDF - const string inputPath = "input.pdf"; - const string outputPath = "output.pdf"; - - // --------------------------------------------------------------------- - // Ensure an input PDF exists for the sandbox. If it does not, create a - // minimal document, add a single blank page and save it to the expected - // location. This follows the "hardcoded-input-file-generate-inline-first" - // rule required for the execution environment. - // --------------------------------------------------------------------- - if (!System.IO.File.Exists(inputPath)) - { - using (Document seed = new Document()) - { - seed.Pages.Add(); // add a blank page - seed.Save(inputPath); - } - } - - // Load the PDF document - Document pdfDocument = new Document(inputPath); - - // Use the document's creation date if available; otherwise fall back to current date - DateTime creationDate = pdfDocument.Info?.CreationDate ?? DateTime.Now; - string dateText = creationDate.ToString("yyyy-MM-dd"); - - // Create a TextStamp for the date - TextStamp dateStamp = new TextStamp(dateText) - { - TextState = { Font = FontRepository.FindFont("Helvetica"), FontSize = 12, ForegroundColor = Color.Black }, - HorizontalAlignment = HorizontalAlignment.Left, - VerticalAlignment = VerticalAlignment.Top, - XIndent = 20f, // left margin - YIndent = 20f // top margin - }; - - // Add the stamp to every page (or just the first page if preferred) - foreach (Page page in pdfDocument.Pages) - { - page.AddStamp(dateStamp); - } - - // Save the modified PDF - pdfDocument.Save(outputPath); - } -} diff --git a/facades-stamps/add-creation-date-stamp.cs b/facades-stamps/add-creation-date-stamp.cs new file mode 100644 index 000000000..466dac5a6 --- /dev/null +++ b/facades-stamps/add-creation-date-stamp.cs @@ -0,0 +1,51 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Text; + +class AddCreationDateStamp +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "output.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"File not found: {inputPath}"); + return; + } + + // Load the source PDF (use using for deterministic disposal) + using (Document doc = new Document(inputPath)) + { + // Retrieve the document creation date and format it as yyyy-MM-dd + string creationDate = doc.Info.CreationDate.ToString("yyyy-MM-dd"); + + // Create a TextStamp for the header + TextStamp stamp = new TextStamp(creationDate) + { + TextState = { + Font = FontRepository.FindFont("Helvetica"), + FontSize = 12, + ForegroundColor = Aspose.Pdf.Color.Black + }, + HorizontalAlignment = HorizontalAlignment.Left, + VerticalAlignment = VerticalAlignment.Top, + XIndent = 0, + YIndent = 20 // points from the top edge + }; + + // Add the stamp to every page + foreach (Page page in doc.Pages) + { + page.AddStamp(stamp); + } + + // Save the modified document + doc.Save(outputPath); + + Console.WriteLine($"Creation date stamp added. Output saved to '{outputPath}'."); + } + } +} diff --git a/facades-stamps/add-custom-border-stamp-to-pdf.cs b/facades-stamps/add-custom-border-stamp-to-pdf.cs new file mode 100644 index 000000000..ea54809e9 --- /dev/null +++ b/facades-stamps/add-custom-border-stamp-to-pdf.cs @@ -0,0 +1,47 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Annotations; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "stamped_output.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"File not found: {inputPath}"); + return; + } + + // Load the PDF document + using (Document doc = new Document(inputPath)) + { + // Define the rectangle where the stamp will appear (llx, lly, urx, ury) + Aspose.Pdf.Rectangle stampRect = new Aspose.Pdf.Rectangle(100, 500, 300, 550); + + // Create a rubber‑stamp annotation on the first page + StampAnnotation stamp = new StampAnnotation(doc.Pages[1], stampRect) + { + // Optional text shown when the annotation is selected + Contents = "Important Section" + }; + + // Set the border color + stamp.Color = Aspose.Pdf.Color.Red; + + // Set custom border thickness (requires a Border instance with the parent annotation) + stamp.Border = new Border(stamp) { Width = 3 }; + + // Add the annotation to the page + doc.Pages[1].Annotations.Add(stamp); + + // Save the modified PDF + doc.Save(outputPath); + } + + Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/add-dynamic-text-stamp-to-pdf.cs b/facades-stamps/add-dynamic-text-stamp-to-pdf.cs index 29020dd1d..609ffef27 100644 --- a/facades-stamps/add-dynamic-text-stamp-to-pdf.cs +++ b/facades-stamps/add-dynamic-text-stamp-to-pdf.cs @@ -1,51 +1,56 @@ using System; using System.IO; -using System.Drawing; -using Aspose.Pdf.Facades; +using Aspose.Pdf; +using Aspose.Pdf.Text; // for TextStamp +using Aspose.Pdf.Annotations; // not needed but harmless class Program { static void Main() { - // Input and output PDF paths - const string inputPdf = "input.pdf"; - const string outputPdf = "stamped_output.pdf"; + const string inputPath = "input.pdf"; + const string outputPath = "stamped_output.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"File not found: {inputPath}"); + return; + } // Dynamic values to embed in the stamp string author = "John Doe"; string date = DateTime.Now.ToString("yyyy-MM-dd"); - // Verify input file exists - if (!File.Exists(inputPdf)) + // Create the stamp text using string interpolation + string stampText = $"Author: {author} | Date: {date}"; + + // Process the PDF + using (Document doc = new Document(inputPath)) { - Console.Error.WriteLine($"Input file not found: {inputPdf}"); - return; + // Create a TextStamp with the interpolated text + TextStamp textStamp = new TextStamp(stampText) + { + // Example visual settings (optional) + HorizontalAlignment = HorizontalAlignment.Right, + VerticalAlignment = VerticalAlignment.Bottom, + Opacity = 0.5f, + // Adjust the stamp to fit the page width if needed + AutoAdjustFontSizeToFitStampRectangle = true, + // Position can be fine‑tuned via margins + RightMargin = 20, + BottomMargin = 20 + }; + + // Apply the stamp to each page (or a specific page) + foreach (Page page in doc.Pages) + { + page.AddStamp(textStamp); + } + + // Save the modified PDF + doc.Save(outputPath); } - // Create formatted text with interpolation (all styling via constructor) - FormattedText formattedText = new FormattedText( - $"Author: {author}, Date: {date}", - Color.Black, // text color - "Helvetica", // font name - EncodingType.Winansi, - false, // embed font? - 12); // font size - - // Build a Stamp and bind the formatted text - Stamp stamp = new Stamp(); - stamp.BindLogo(formattedText); - stamp.SetOrigin(0, 20); // X,Y from bottom‑left corner - stamp.IsBackground = false; // place on top of page content - stamp.Opacity = 0.8f; // semi‑transparent - // Alignment and indent properties are not available on Stamp; positioning is handled via SetOrigin. - - // Apply the stamp to all pages of the document - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.BindPdf(inputPdf); - fileStamp.AddStamp(stamp); - fileStamp.Save(outputPdf); - fileStamp.Close(); - - Console.WriteLine($"Stamped PDF saved to '{outputPdf}'."); + Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); } -} +} \ No newline at end of file diff --git a/facades-stamps/add-file-name-header-stamp-to-pdf.cs b/facades-stamps/add-file-name-header-stamp-to-pdf.cs index 672a93a5a..c9bfe94cd 100644 --- a/facades-stamps/add-file-name-header-stamp-to-pdf.cs +++ b/facades-stamps/add-file-name-header-stamp-to-pdf.cs @@ -1,8 +1,7 @@ using System; using System.IO; using Aspose.Pdf; -using Aspose.Pdf.Facades; -using Aspose.Pdf.Text; // for EncodingType +using Aspose.Pdf.Text; // for TextStamp class Program { @@ -17,29 +16,32 @@ static void Main() return; } - // Get the file name to use in the header - string fileName = Path.GetFileName(inputPath); - - // Initialize the PdfFileStamp facade - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.InputFile = inputPath; - fileStamp.OutputFile = outputPath; + // Load the PDF document + Document pdfDocument = new Document(inputPath); - // Create formatted text for the header (using System.Drawing.Color as required by FormattedText) - FormattedText header = new FormattedText( - fileName, - System.Drawing.Color.Black, - "Helvetica", - EncodingType.Winansi, - false, - 12); - - // Add the header with a top margin (e.g., 20 points) - fileStamp.AddHeader(header, 20); + // Prepare the header stamp – display the file name of the PDF + string fileName = Path.GetFileName(inputPath); + TextStamp headerStamp = new TextStamp(fileName) + { + // Position the stamp at the top of the page (header) + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Top, + YIndent = 20f // distance from the top edge + }; + // Configure the visual appearance of the stamp + headerStamp.TextState.Font = FontRepository.FindFont("Helvetica"); + headerStamp.TextState.FontSize = 12; + headerStamp.TextState.ForegroundColor = Aspose.Pdf.Color.Black; + + // Add the stamp to every page in the document + foreach (Page page in pdfDocument.Pages) + { + page.AddStamp(headerStamp); + } - // Save the result - fileStamp.Close(); + // Save the stamped PDF + pdfDocument.Save(outputPath); Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); } -} \ No newline at end of file +} diff --git a/facades-stamps/add-footer-date-stamp-to-last-page.cs b/facades-stamps/add-footer-date-stamp-to-last-pdf-page.cs similarity index 52% rename from facades-stamps/add-footer-date-stamp-to-last-page.cs rename to facades-stamps/add-footer-date-stamp-to-last-pdf-page.cs index b02d19d4c..08535acd0 100644 --- a/facades-stamps/add-footer-date-stamp-to-last-page.cs +++ b/facades-stamps/add-footer-date-stamp-to-last-pdf-page.cs @@ -16,33 +16,29 @@ static void Main() return; } - // Load the document + // Load the PDF document Document doc = new Document(inputPath); - // Get the last page (1‑based index) + // Get the last page Page lastPage = doc.Pages[doc.Pages.Count]; - // Prepare the footer text with the current date (MM-dd-yyyy) - string dateText = DateTime.Now.ToString("MM-dd-yyyy"); - - // Create a TextStamp for the footer - TextStamp stamp = new TextStamp(dateText); - // Set font, size and color via TextState + // Create a text stamp with the current date (MM-dd-yyyy) + TextStamp stamp = new TextStamp(DateTime.Now.ToString("MM-dd-yyyy")); stamp.TextState.Font = FontRepository.FindFont("Helvetica"); stamp.TextState.FontSize = 12; + // Use Aspose.Pdf.Color to avoid ambiguity with System.Drawing.Color stamp.TextState.ForegroundColor = Aspose.Pdf.Color.Black; - // Position the stamp at the bottom centre of the page stamp.HorizontalAlignment = HorizontalAlignment.Center; stamp.VerticalAlignment = VerticalAlignment.Bottom; - // Distance from the bottom edge (you can adjust as needed) - stamp.YIndent = 10f; + stamp.YIndent = 10; // distance from the bottom edge - // Add the stamp only to the last page + // Add the stamp to the last page only lastPage.AddStamp(stamp); // Save the modified PDF doc.Save(outputPath); - // Document.Close() does not exist in Aspose.Pdf; the object is disposed by GC or a using block. + // Document does not have a Close() method; dispose if desired + doc.Dispose(); - Console.WriteLine($"Footer with date added to page {lastPage.Number}, saved as '{outputPath}'."); + Console.WriteLine($"Footer added to last page: {outputPath}"); } -} +} \ No newline at end of file diff --git a/facades-stamps/add-footer-page-count-stamp.cs b/facades-stamps/add-footer-page-count-stamp.cs deleted file mode 100644 index 5e451ab66..000000000 --- a/facades-stamps/add-footer-page-count-stamp.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - const string inputPath = "input.pdf"; - const string outputPath = "output_with_footer.pdf"; - - if (!File.Exists(inputPath)) - { - Console.Error.WriteLine($"Input file not found: {inputPath}"); - return; - } - - // Initialize PdfFileStamp facade - using (PdfFileStamp fileStamp = new PdfFileStamp()) - { - // Bind the source PDF - fileStamp.BindPdf(inputPath); - - // Add a footer that shows the total page count. - // The placeholder {page_count} is replaced with the total number of pages. - // AddPageNumber places the text at the bottom centre of each page. - fileStamp.AddPageNumber("{page_count}"); - - // Save the result - fileStamp.Save(outputPath); - - // Close the facade (optional, Dispose will also close) - fileStamp.Close(); - } - - Console.WriteLine($"Footer stamp added. Output saved to '{outputPath}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/add-footer-stamp-10-points-above-bottom.cs b/facades-stamps/add-footer-stamp-10-points-above-bottom.cs index 5cb1b7c32..f047a811d 100644 --- a/facades-stamps/add-footer-stamp-10-points-above-bottom.cs +++ b/facades-stamps/add-footer-stamp-10-points-above-bottom.cs @@ -1,8 +1,7 @@ using System; using System.IO; -using System.Drawing; // System.Drawing.Color -using Aspose.Pdf; // Core PDF classes -using Aspose.Pdf.Facades; // PdfFileStamp, FormattedText, EncodingType +using Aspose.Pdf; +using Aspose.Pdf.Facades; class Program { @@ -10,40 +9,26 @@ static void Main() { const string inputPath = "input.pdf"; const string outputPath = "output.pdf"; - const string footerText = "Confidential"; - // Verify input file exists if (!File.Exists(inputPath)) { Console.Error.WriteLine($"Input file not found: {inputPath}"); return; } - // Create a FormattedText object for the footer. - // Use System.Drawing.Color, specify font name, encoding, embed flag and a float font size. - Aspose.Pdf.Facades.FormattedText footer = new Aspose.Pdf.Facades.FormattedText( - footerText, - System.Drawing.Color.Gray, // Text color (System.Drawing.Color) - "Helvetica", // Font name - Aspose.Pdf.Facades.EncodingType.Winansi, // Encoding - false, // Do not embed font - 12f); // Font size (float) - - // Initialize the PdfFileStamp facade. - Aspose.Pdf.Facades.PdfFileStamp fileStamp = new Aspose.Pdf.Facades.PdfFileStamp(); - - // Bind the source PDF. - fileStamp.BindPdf(inputPath); - - // Add the footer 10 points above the bottom edge of each page. - fileStamp.AddFooter(footer, 10f); + // Create a PdfFileStamp facade and bind the source PDF + using (PdfFileStamp fileStamp = new PdfFileStamp()) + { + fileStamp.BindPdf(inputPath); - // Save the stamped PDF. - fileStamp.Save(outputPath); + // Add a footer 10 points above the bottom edge of each page + fileStamp.AddFooter(new FormattedText("Footer text"), 10); - // Release resources. - fileStamp.Close(); + // Save the stamped PDF + fileStamp.Save(outputPath); + fileStamp.Close(); // optional, Dispose() will also close + } - Console.WriteLine($"Footer stamp added. Output saved to '{outputPath}'."); + Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); } -} +} \ No newline at end of file diff --git a/facades-stamps/add-footer-with-page-count.cs b/facades-stamps/add-footer-with-page-count.cs new file mode 100644 index 000000000..2d124cca6 --- /dev/null +++ b/facades-stamps/add-footer-with-page-count.cs @@ -0,0 +1,38 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "output_with_footer.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"Input file not found: {inputPath}"); + return; + } + + // PdfFileStamp does not implement IDisposable, so we do not use a using block. + // Use the parameterless constructor and bind the source PDF via BindPdf(). + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(inputPath); + + // Add a footer that shows the current page number and total page count. + // The placeholder "#" is replaced with the current page number. + // The placeholder "{page_count}" is replaced with the total number of pages. + // Position the footer at the bottom middle of each page. + fileStamp.AddPageNumber("Page # of {page_count}", PdfFileStamp.PosBottomMiddle); + + // Save the result to the specified output file. + fileStamp.Save(outputPath); + + // Close the facade to release resources. + fileStamp.Close(); + + Console.WriteLine($"Footer added and saved to '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/add-header-stamp-to-all-pdf-pages.cs b/facades-stamps/add-header-stamp-to-all-pdf-pages.cs deleted file mode 100644 index 53c7534d2..000000000 --- a/facades-stamps/add-header-stamp-to-all-pdf-pages.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf.Facades; // Facade API for stamping -using Aspose.Pdf.Text; // FormattedText and EncodingType -using System.Drawing; // System.Drawing.Color required by FormattedText - -class Program -{ - static void Main() - { - const string inputPath = "input.pdf"; - const string outputPath = "output.pdf"; - const string companyName = "Acme Corporation"; - - if (!File.Exists(inputPath)) - { - Console.Error.WriteLine($"Input file not found: {inputPath}"); - return; - } - - // Initialize the PdfFileStamp facade and bind the source PDF - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.BindPdf(inputPath); - - // Load the document only to obtain the page count (required for iteration) - using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document(inputPath)) - { - int pageCount = doc.Pages.Count; // 1‑based indexing - - // Iterate through each page and add a header stamp with the company name - for (int i = 1; i <= pageCount; i++) - { - // Create a formatted text object for the header - FormattedText headerText = new FormattedText( - companyName, // text - Color.Black, // text color (System.Drawing.Color) - "Helvetica", // font name - EncodingType.Winansi, // encoding - false, // embed font? - 12); // font size - - // Create a stamp and bind the formatted text - Stamp stamp = new Stamp(); - stamp.BindLogo(headerText); - - // Configure stamp appearance (optional) - stamp.IsBackground = false; // place on top of page content - stamp.Opacity = 1.0f; // fully opaque - - // Restrict the stamp to the current page only - stamp.Pages = new int[] { i }; - - // Add the stamp to the file - fileStamp.AddStamp(stamp); - } - } - - // Save the stamped PDF and release resources - fileStamp.Save(outputPath); - fileStamp.Close(); - - Console.WriteLine($"Header stamp added to all pages. Output saved to '{outputPath}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/add-header-stamp-to-pdf-pages.cs b/facades-stamps/add-header-stamp-to-pdf-pages.cs new file mode 100644 index 000000000..ba783726a --- /dev/null +++ b/facades-stamps/add-header-stamp-to-pdf-pages.cs @@ -0,0 +1,44 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Text; // TextStamp lives here + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "output.pdf"; + const string companyName = "Acme Corporation"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"Input file not found: {inputPath}"); + return; + } + + // Load the PDF and add a header stamp to every page + using (Document doc = new Document(inputPath)) + { + foreach (Page page in doc.Pages) + { + // Create a TextStamp that will act as the header + TextStamp headerStamp = new TextStamp(companyName); + headerStamp.TextState.Font = FontRepository.FindFont("Helvetica"); + headerStamp.TextState.FontSize = 12; + headerStamp.TextState.ForegroundColor = Aspose.Pdf.Color.Black; + headerStamp.HorizontalAlignment = HorizontalAlignment.Center; + headerStamp.VerticalAlignment = VerticalAlignment.Top; + headerStamp.YIndent = 20; // distance from the top edge + + // Apply the stamp to the current page + page.AddStamp(headerStamp); + } + + // Save the modified PDF + doc.Save(outputPath); + } + + Console.WriteLine($"Header stamp added to all pages. Output saved to '{outputPath}'."); + } +} diff --git a/facades-stamps/add-image-and-text-stamp-to-pdf.cs b/facades-stamps/add-image-and-text-stamp-to-pdf.cs deleted file mode 100644 index 0eef28769..000000000 --- a/facades-stamps/add-image-and-text-stamp-to-pdf.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - const string inputPdf = "input.pdf"; - const string outputPdf = "stamped_output.pdf"; - const string logoImage = "logo.png"; - - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input PDF not found: {inputPdf}"); - return; - } - if (!File.Exists(logoImage)) - { - Console.Error.WriteLine($"Logo image not found: {logoImage}"); - return; - } - - // Initialize the facade and bind the source PDF - using (PdfFileStamp fileStamp = new PdfFileStamp()) - { - fileStamp.BindPdf(inputPdf); - - // ---------- Image stamp (company logo) ---------- - Stamp imageStamp = new Stamp(); - // Position the logo (example coordinates) - imageStamp.SetOrigin(50f, 750f); // X, Y from bottom-left - // Desired size of the logo - imageStamp.SetImageSize(100f, 50f); // Width, Height - // Bind the image file - imageStamp.BindImage(logoImage); - // Add the image stamp to the document - fileStamp.AddStamp(imageStamp); - - // ---------- Text stamp (Confidential) ---------- - // FormattedText constructor requires System.Drawing.Color - // Bold text is achieved by using a bold font (e.g., Helvetica-Bold) - FormattedText ft = new FormattedText( - "Confidential", // text - System.Drawing.Color.Red, // text color - "Helvetica-Bold", // font name (bold) - EncodingType.Winansi, // encoding - false, // isEmbedded - 36); // font size - - Stamp textStamp = new Stamp(); - // Position the text (example coordinates) - textStamp.SetOrigin(200f, 750f); - // Bind the formatted text as a stamp - textStamp.BindLogo(ft); - // Add the text stamp to the document - fileStamp.AddStamp(textStamp); - - // Save the stamped PDF - fileStamp.Save(outputPdf); - fileStamp.Close(); - } - - Console.WriteLine($"Stamped PDF saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/add-image-stamp-to-pdfs-preserve-filenames.cs b/facades-stamps/add-image-stamp-to-pdfs-preserve-filenames.cs new file mode 100644 index 000000000..a1f2f12b4 --- /dev/null +++ b/facades-stamps/add-image-stamp-to-pdfs-preserve-filenames.cs @@ -0,0 +1,52 @@ +using System; +using System.IO; +using Aspose.Pdf.Facades; // Facade APIs for stamping + +class Program +{ + static void Main() + { + // Folder containing the original PDFs + const string sourceFolder = @"C:\InputPdfs"; + // Folder where stamped PDFs will be saved + const string targetFolder = @"C:\StampedPdfs"; + // Path to the image that will be used as a stamp + const string stampImagePath = @"C:\Stamp\stamp.png"; + + // Ensure the target directory exists + Directory.CreateDirectory(targetFolder); + + // Process each PDF file in the source folder + foreach (string inputPath in Directory.GetFiles(sourceFolder, "*.pdf")) + { + // Preserve the original file name + string fileName = Path.GetFileName(inputPath); + string outputPath = Path.Combine(targetFolder, fileName); + + // Create the PdfFileStamp facade + PdfFileStamp fileStamp = new PdfFileStamp(); + + // Bind the source PDF (no output file property – we will save explicitly) + fileStamp.BindPdf(inputPath); + + // Configure the stamp (image based) + Stamp stamp = new Stamp(); + stamp.BindImage(stampImagePath); // Use the image as stamp content + stamp.IsBackground = true; // Place stamp behind page content + stamp.Opacity = 0.5f; // Semi‑transparent + stamp.SetOrigin(100, 100); // Position of the stamp on each page + stamp.SetImageSize(150, 150); // Size of the stamp image + + // Add the stamp to the PDF + fileStamp.AddStamp(stamp); + + // Save the stamped PDF to the target location + fileStamp.Save(outputPath); + + // Close the facade (releases resources) + fileStamp.Close(); + } + + Console.WriteLine("All PDFs have been stamped and saved."); + } +} \ No newline at end of file diff --git a/facades-stamps/add-lower-roman-page-numbers-odd-pages.cs b/facades-stamps/add-lower-roman-page-numbers-odd-pages.cs new file mode 100644 index 000000000..4b3c6ae8b --- /dev/null +++ b/facades-stamps/add-lower-roman-page-numbers-odd-pages.cs @@ -0,0 +1,55 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Drawing; +using Aspose.Pdf.Text; + +class Program +{ + static void Main() + { + const string inputPdf = "input.pdf"; + const string outputPdf = "output.pdf"; + + if (!File.Exists(inputPdf)) + { + Console.Error.WriteLine($"Input file not found: {inputPdf}"); + return; + } + + // Load the document. + Document doc = new Document(inputPdf); + int pageCount = doc.Pages.Count; // 1‑based page count + + // Iterate over odd pages only and add a lower‑case Roman numeral page number. + for (int i = 1; i <= pageCount; i++) + { + if (i % 2 == 0) // skip even pages + continue; + + // Create a PageNumberStamp that will be replaced by the page number. + PageNumberStamp stamp = new PageNumberStamp() + { + // Position the stamp at the bottom‑center of the page. + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Bottom, + // Use lower‑case Roman numerals. + NumberingStyle = NumberingStyle.NumeralsRomanLowercase, + // Adjust bottom margin (20 points from the bottom). + BottomMargin = 20 + }; + + // Configure the visual appearance of the stamp. + stamp.TextState.Font = FontRepository.FindFont("Helvetica"); + stamp.TextState.FontSize = 12; + stamp.TextState.ForegroundColor = Color.Black; + + // Add the stamp to the current page. + doc.Pages[i].AddStamp(stamp); + } + + // Save the modified PDF. + doc.Save(outputPdf); + Console.WriteLine($"Page numbers added (lower‑roman, odd pages) to '{outputPdf}'."); + } +} diff --git a/facades-stamps/add-lowercase-roman-page-numbers-to-odd-pages.cs b/facades-stamps/add-lowercase-roman-page-numbers-to-odd-pages.cs deleted file mode 100644 index 8f2911fc6..000000000 --- a/facades-stamps/add-lowercase-roman-page-numbers-to-odd-pages.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Text; - -class Program -{ - static void Main() - { - const string inputPath = "input.pdf"; - const string outputPath = "odd_roman_pages.pdf"; - - if (!File.Exists(inputPath)) - { - Console.Error.WriteLine($"File not found: {inputPath}"); - return; - } - - // Open the source PDF inside a using block for deterministic disposal - using (Document doc = new Document(inputPath)) - { - int oddPageCounter = 0; // tracks the sequence number for odd pages - - // Pages are 1‑based in Aspose.Pdf - for (int i = 1; i <= doc.Pages.Count; i++) - { - if (i % 2 == 1) // process only odd pages - { - oddPageCounter++; - - // Create a page number stamp - PageNumberStamp stamp = new PageNumberStamp(); - - // Use lower‑case Roman numerals - stamp.NumberingStyle = NumberingStyle.NumeralsRomanLowercase; - - // The format must contain '#', which will be replaced by the number - stamp.Format = "#"; - - // Set the starting number so that the sequence increments only on odd pages - stamp.StartingNumber = oddPageCounter; - - // Optional: position the stamp at the bottom centre of the page - stamp.HorizontalAlignment = HorizontalAlignment.Center; - stamp.VerticalAlignment = VerticalAlignment.Bottom; - - // Apply the stamp to the current page - doc.Pages[i].AddStamp(stamp); - } - } - - // Save the modified PDF - doc.Save(outputPath); - } - - Console.WriteLine($"Page numbers added to odd pages. Output saved as '{outputPath}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/add-multi-line-colored-header-stamp.cs b/facades-stamps/add-multi-line-colored-header-stamp.cs index 496b3ea12..45029380a 100644 --- a/facades-stamps/add-multi-line-colored-header-stamp.cs +++ b/facades-stamps/add-multi-line-colored-header-stamp.cs @@ -1,6 +1,9 @@ using System; +using System.IO; using Aspose.Pdf; -using Aspose.Pdf.Text; +using Aspose.Pdf.Facades; +using Aspose.Pdf.Text; // FormattedText, EncodingType +using System.Drawing; // System.Drawing.Color class Program { @@ -9,46 +12,55 @@ static void Main() const string inputPdf = "input.pdf"; const string outputPdf = "output.pdf"; - // Create a minimal PDF if it does not already exist in the sandbox. - if (!System.IO.File.Exists(inputPdf)) + if (!File.Exists(inputPdf)) { - using (Document seed = new Document()) - { - seed.Pages.Add(); // at least one blank page - seed.Save(inputPdf); - } + Console.Error.WriteLine($"Input file not found: {inputPdf}"); + return; } - // Load the source PDF document + // Load the document to obtain page dimensions (assumes all pages have same size) Document doc = new Document(inputPdf); + float pageWidth = (float)doc.Pages[1].PageInfo.Width; // cast double → float + float pageHeight = (float)doc.Pages[1].PageInfo.Height; // cast double → float - // Define the header lines (text, color, vertical offset from the top) - var headerLines = new (string Text, Aspose.Pdf.Color Color, float YIndent)[] - { - ("First Header Line", Aspose.Pdf.Color.Blue, 20f), - ("Second Header Line", Aspose.Pdf.Color.Green, 40f), - ("Third Header Line", Aspose.Pdf.Color.Red, 60f) - }; + // Initialize the PdfFileStamp facade using the recommended BindPdf method + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(inputPdf); - // Apply the header lines to every page - foreach (Page page in doc.Pages) - { - foreach (var line in headerLines) - { - TextStamp stamp = new TextStamp(line.Text); - stamp.TextState.Font = FontRepository.FindFont("Helvetica"); - stamp.TextState.FontSize = 24; - stamp.TextState.ForegroundColor = line.Color; - stamp.HorizontalAlignment = HorizontalAlignment.Center; - stamp.VerticalAlignment = VerticalAlignment.Top; - stamp.YIndent = line.YIndent; // distance from the top edge - page.AddStamp(stamp); - } - } + // ---------- First header line (red) ---------- + Aspose.Pdf.Facades.Stamp redStamp = new Aspose.Pdf.Facades.Stamp(); // fully‑qualified to avoid CS0104 + FormattedText redText = new FormattedText( + "First Header Line", + System.Drawing.Color.Red, + "Helvetica", + EncodingType.Winansi, + false, + 14); + redStamp.BindLogo(redText); + // Position near the top of the page (Y measured from bottom) + redStamp.SetOrigin(0, pageHeight - 40); + // Removed HorizontalAlignment – not supported on Facades.Stamp + fileStamp.AddStamp(redStamp); + + // ---------- Second header line (blue) ---------- + Aspose.Pdf.Facades.Stamp blueStamp = new Aspose.Pdf.Facades.Stamp(); // fully‑qualified + FormattedText blueText = new FormattedText( + "Second Header Line", + System.Drawing.Color.Blue, + "Helvetica", + EncodingType.Winansi, + false, + 14); + blueStamp.BindLogo(blueText); + // Slightly lower than the first line + blueStamp.SetOrigin(0, pageHeight - 60); + // Removed HorizontalAlignment – not supported on Facades.Stamp + fileStamp.AddStamp(blueStamp); - // Save the stamped PDF - doc.Save(outputPdf); + // Save the modified PDF + fileStamp.Save(outputPdf); + fileStamp.Close(); Console.WriteLine($"Multi‑line header stamp applied and saved to '{outputPdf}'."); } -} \ No newline at end of file +} diff --git a/facades-stamps/add-multi-line-text-watermark-facade.cs b/facades-stamps/add-multi-line-text-watermark-facade.cs new file mode 100644 index 000000000..47564b4de --- /dev/null +++ b/facades-stamps/add-multi-line-text-watermark-facade.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using System.Drawing; // needed for System.Drawing.Color used by FormattedText +using Aspose.Pdf; +using Aspose.Pdf.Facades; // Facades namespace contains FormattedText, EncodingType, Stamp, PdfFileStamp + +class Program +{ + static void Main() + { + const string inputPdf = "input.pdf"; + const string outputPdf = "watermarked.pdf"; + + if (!File.Exists(inputPdf)) + { + Console.Error.WriteLine($"Input file not found: {inputPdf}"); + return; + } + + // Initialize the PdfFileStamp facade and bind the source PDF + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(inputPdf); + + // Create a FormattedText object for the watermark. + // Constructor parameters: text, System.Drawing.Color, font name, EncodingType, isEmbedded, font size (float) + Aspose.Pdf.Facades.FormattedText watermarkText = new Aspose.Pdf.Facades.FormattedText( + "Confidential", // first line + System.Drawing.Color.Gray, // text color (System.Drawing.Color) + "Helvetica", // font name + Aspose.Pdf.Facades.EncodingType.Winansi, // encoding + false, // not embedded + 48f); // font size (float) + + // Add additional lines to the watermark + watermarkText.AddNewLineText("Do Not Distribute"); + watermarkText.AddNewLineText("Company Internal Use Only"); + + // Create a Stamp, bind the FormattedText, and configure it as a background watermark + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + stamp.BindLogo(watermarkText); + stamp.IsBackground = true; // place behind page content + stamp.Opacity = 0.3f; // semi‑transparent + + // Add the stamp to all pages of the document + fileStamp.AddStamp(stamp); + + // Save the result + fileStamp.Save(outputPdf); + fileStamp.Close(); + + Console.WriteLine($"Watermarked PDF saved to '{outputPdf}'."); + } +} diff --git a/facades-stamps/add-multi-line-text-watermark-pdf.cs b/facades-stamps/add-multi-line-text-watermark-pdf.cs deleted file mode 100644 index dd1a1554e..000000000 --- a/facades-stamps/add-multi-line-text-watermark-pdf.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf.Facades; // PdfFileStamp facade -using Aspose.Pdf.Text; // FormattedText, EncodingType -using System.Drawing; // System.Drawing.Color required by FormattedText - -class Program -{ - static void Main() - { - const string inputPdf = "input.pdf"; - const string outputPdf = "watermarked.pdf"; - - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"File not found: {inputPdf}"); - return; - } - - // Initialize the PdfFileStamp facade and bind the source PDF - PdfFileStamp stamp = new PdfFileStamp(); - stamp.BindPdf(inputPdf); - - // Create a FormattedText object for the watermark. - // Constructor parameters: text, text color, font name, encoding, isEmbedded, font size - FormattedText ft = new FormattedText( - "Confidential", // first line - Color.Gray, // text color (System.Drawing.Color) - "Helvetica", // font name - EncodingType.Winansi, // encoding - false, // embed font? - 48); // font size - - // Add additional lines using AddNewLineText - ft.AddNewLineText("Do Not Distribute"); - ft.AddNewLineText("Company Internal Use Only"); - - // Add the multi‑line text as a header (appears on every page). - // The second argument is the vertical offset from the top of the page. - stamp.AddHeader(ft, 0); - - // Save the result - stamp.Save(outputPdf); - stamp.Close(); - - Console.WriteLine($"Watermarked PDF saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/add-multi-line-text-watermark.cs b/facades-stamps/add-multi-line-text-watermark.cs new file mode 100644 index 000000000..9a77a6b34 --- /dev/null +++ b/facades-stamps/add-multi-line-text-watermark.cs @@ -0,0 +1,71 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Text; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "watermarked.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"File not found: {inputPath}"); + return; + } + + // Load the PDF document + Document pdfDocument = new Document(inputPath); + + // Define watermark lines with their respective font sizes + var lines = new (string Text, float FontSize)[] + { + ("CONFIDENTIAL", 48f), + ("DO NOT DISTRIBUTE", 24f) + }; + + // Common text state settings (color, font) + Font font = FontRepository.FindFont("Helvetica"); + Aspose.Pdf.Color textColor = Aspose.Pdf.Color.Red; + + // Positioning offsets (relative to page centre) + // Start from the centre and move upward for each subsequent line + foreach (Page page in pdfDocument.Pages) + { + float yOffset = 0f; // reset for each page + foreach (var (text, size) in lines) + { + // Create a TextState for this line + TextState state = new TextState + { + Font = font, + FontSize = size, + ForegroundColor = textColor + }; + + // Create a TextStamp with the line text and its TextState + TextStamp stamp = new TextStamp(text, state) + { + Background = true, // appear behind page content + Opacity = 0.5f, // semi‑transparent + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + YIndent = yOffset // offset from centre + }; + + // Add the stamp to the current page + page.AddStamp(stamp); + + // Move the next line upward (negative Y direction) + yOffset -= size + 10f; // line height + spacing + } + } + + // Save the watermarked PDF + pdfDocument.Save(outputPath); + + Console.WriteLine($"Watermarked PDF saved to '{outputPath}'."); + } +} diff --git a/facades-stamps/add-multi-line-watermark-custom-font.cs b/facades-stamps/add-multi-line-watermark-custom-font.cs new file mode 100644 index 000000000..0e664e24e --- /dev/null +++ b/facades-stamps/add-multi-line-watermark-custom-font.cs @@ -0,0 +1,69 @@ +using System; +using System.IO; +using System.Drawing; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + // ------------------------------------------------------------ + // 1. Ensure an input PDF exists – create a minimal one‑page PDF + // because the sandbox does not contain external files. + // ------------------------------------------------------------ + const string inputPath = "input.pdf"; + if (!File.Exists(inputPath)) + { + using (var placeholder = new Document()) + { + placeholder.Pages.Add(); + placeholder.Save(inputPath); + } + } + + // ------------------------------------------------------------ + // 2. Load the PDF from a memory stream (as the original task + // requires). + // ------------------------------------------------------------ + byte[] pdfBytes = File.ReadAllBytes(inputPath); + using (var inputStream = new MemoryStream(pdfBytes)) + using (var doc = new Document(inputStream)) + { + // -------------------------------------------------------- + // 3. Prepare the multi‑line watermark text with custom font + // size and colour. + // -------------------------------------------------------- + string watermarkText = "Confidential\nDo Not Distribute"; + var formattedText = new Aspose.Pdf.Facades.FormattedText( + watermarkText, + System.Drawing.Color.Red, // text colour + "Helvetica", // font name + Aspose.Pdf.Facades.EncodingType.Winansi, + false, // embed font flag + 48f); // font size + + // -------------------------------------------------------- + // 4. Create a stamp, bind the formatted text and set its + // appearance (background, opacity, position). + // -------------------------------------------------------- + var stamp = new Aspose.Pdf.Facades.Stamp(); + stamp.BindLogo(formattedText); + stamp.IsBackground = true; // place behind page content + stamp.Opacity = 0.3f; // semi‑transparent + stamp.SetOrigin(100f, 400f); // X, Y position on the page + + // -------------------------------------------------------- + // 5. Apply the stamp to all pages of the document. + // -------------------------------------------------------- + var fileStamp = new Aspose.Pdf.Facades.PdfFileStamp(doc); + fileStamp.AddStamp(stamp); + + // -------------------------------------------------------- + // 6. Save the watermarked PDF. + // -------------------------------------------------------- + fileStamp.Save("watermarked.pdf"); + fileStamp.Close(); + } + } +} diff --git a/facades-stamps/add-multi-line-watermark-pdf.cs b/facades-stamps/add-multi-line-watermark-pdf.cs deleted file mode 100644 index c5075a365..000000000 --- a/facades-stamps/add-multi-line-watermark-pdf.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.IO; -using System.Drawing; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - // Paths for source PDF and output PDF - const string inputPdf = "input.pdf"; - const string outputPdf = "watermarked_output.pdf"; - - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input file not found: {inputPdf}"); - return; - } - - // --------------------------------------------------------------------- - // 1. Initialise the PdfFileStamp facade (modern API – BindPdf / Save) - // --------------------------------------------------------------------- - PdfFileStamp pdfStamp = new PdfFileStamp(); - pdfStamp.BindPdf(inputPdf); - - // --------------------------------------------------------------------- - // 2. Build the watermark text using FormattedText (all styling via ctor) - // --------------------------------------------------------------------- - // • Text contains line‑breaks (\n) for multiple lines. - // • Color is a System.Drawing.Color (Aspose.Pdf.Color is not accepted). - // • Font name, encoding and size are supplied in the constructor. - // • Custom line height is not directly configurable via a property; the - // default line spacing derived from the font size is used. If precise - // control is required, create separate stamps per line and position - // them individually. - // --------------------------------------------------------------------- - FormattedText ft = new FormattedText( - "CONFIDENTIAL\nDO NOT DISTRIBUTE\nFOR INTERNAL USE ONLY", - Color.Red, // foreground colour (System.Drawing) - "Helvetica", // font name - EncodingType.Winansi, // encoding - false, // embed the font? false = use system font - 36); // font size (points) - // Note: FormattedText does not expose a LineSpacing property. The default - // line spacing based on the font size is applied. - - // --------------------------------------------------------------------- - // 3. Create a Stamp, bind the FormattedText and configure visual options - // --------------------------------------------------------------------- - Stamp stamp = new Stamp(); - stamp.BindLogo(ft); - // Position the stamp – centre it on the page. SetOrigin expects the lower‑left corner. - stamp.SetOrigin(100f, 400f); // example coordinates; change as needed - stamp.Opacity = 0.5f; // 50 % transparent - stamp.IsBackground = true; // render behind existing page content - - // --------------------------------------------------------------------- - // 4. Add the stamp to every page and save the result - // --------------------------------------------------------------------- - pdfStamp.AddStamp(stamp); - pdfStamp.Save(outputPdf); - pdfStamp.Close(); - - Console.WriteLine($"Watermarked PDF saved to '{outputPdf}'."); - } -} diff --git a/facades-stamps/add-multi-line-watermark-to-pdf.cs b/facades-stamps/add-multi-line-watermark-to-pdf.cs deleted file mode 100644 index f930639f5..000000000 --- a/facades-stamps/add-multi-line-watermark-to-pdf.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.IO; -using System.Text; -using Aspose.Pdf; -using Aspose.Pdf.Facades; -using Aspose.Pdf.Text; - -class Program -{ - static void Main() - { - // --------------------------------------------------------------------- - // 1. Create a minimal PDF in memory – this replaces the missing "input.pdf" - // --------------------------------------------------------------------- - using (var seedDoc = new Document()) - { - seedDoc.Pages.Add(); // add a blank page (you can add content if you wish) - - using (var seedStream = new MemoryStream()) - { - seedDoc.Save(seedStream); - seedStream.Position = 0; // rewind so PdfFileStamp can read from the start - - // --------------------------------------------------------------- - // 2. Apply a multi‑line watermark using PdfFileStamp (stream overload) - // --------------------------------------------------------------- - using (var fileStamp = new Aspose.Pdf.Facades.PdfFileStamp()) - { - fileStamp.BindPdf(seedStream); - - string watermarkText = "Confidential\nDo Not Distribute"; - - // FormattedText: text, color, font name, encoding, embed flag, font size - var formatted = new Aspose.Pdf.Facades.FormattedText( - watermarkText, - System.Drawing.Color.Red, - "Helvetica", - Aspose.Pdf.Facades.EncodingType.Winansi, - false, - 48); - - var stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindLogo(formatted); - stamp.SetOrigin(100, 400); // lower‑left corner of the page - stamp.Opacity = 0.5f; // semi‑transparent - stamp.IsBackground = true; // render behind existing content - - fileStamp.AddStamp(stamp); - - // ----------------------------------------------------------- - // 3. Save the result – here we write to a file for demonstration - // ----------------------------------------------------------- - using (var outputStream = new MemoryStream()) - { - fileStamp.Save(outputStream); - File.WriteAllBytes("watermarked.pdf", outputStream.ToArray()); - } - } - } - } - } -} diff --git a/facades-stamps/add-multi-line-watermark-varying-font-sizes.cs b/facades-stamps/add-multi-line-watermark-varying-font-sizes.cs deleted file mode 100644 index b6698e325..000000000 --- a/facades-stamps/add-multi-line-watermark-varying-font-sizes.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using Aspose.Pdf; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - const string inputPdf = "input.pdf"; - const string outputPdf = "watermarked.pdf"; - - // ------------------------------------------------------------ - // Create a minimal source PDF so the example can run in a sandbox - // ------------------------------------------------------------ - using (var seed = new Document()) - { - // Add a single blank page (you could add more content if needed) - seed.Pages.Add(); - // Save it to the expected input path - seed.Save(inputPdf); - } - - // Load the source document to obtain page dimensions and count - Document doc = new Document(inputPdf); - int pageCount = doc.Pages.Count; - int[] allPages = new int[pageCount]; - for (int i = 0; i < pageCount; i++) - allPages[i] = i + 1; // pages are 1‑based - - // Bind the PdfFileMend facade to the source PDF - PdfFileMend mend = new PdfFileMend(); - mend.BindPdf(inputPdf); - - // Layout parameters (points) - float topMargin = 100f; // distance from the top edge of the page - float lineSpacing = 30f; // space between successive lines - float leftMargin = 0f; // left edge (adjust as needed) - float rightMargin = (float)doc.Pages[1].PageInfo.Width; // page width as float - - // Helper that adds a single line of watermark text - void AddWatermarkLine(string text, System.Drawing.Color color, float fontSize, float yOffsetFromTop) - { - // Convert page height (double) to float for calculations - float pageHeight = (float)doc.Pages[1].PageInfo.Height; - - // Upper‑right Y coordinate (measured from the top of the page) - float ury = pageHeight - yOffsetFromTop; - // Lower‑left Y coordinate – give the rectangle a height roughly equal to the font size - float lly = ury - fontSize; - float llx = leftMargin; - float urx = rightMargin; - - var formattedText = new FormattedText( - text, - color, // System.Drawing.Color - "Helvetica", - EncodingType.Winansi, - false, - fontSize); - - // Add the text to all pages - mend.AddText(formattedText, allPages, llx, lly, urx, ury); - } - - // ----- First line (largest font) ----- - AddWatermarkLine("CONFIDENTIAL", System.Drawing.Color.Red, 48f, topMargin); - - // ----- Second line (medium font) ----- - AddWatermarkLine("Do Not Distribute", System.Drawing.Color.Blue, 36f, topMargin + lineSpacing); - - // ----- Third line (smallest font) ----- - AddWatermarkLine("Company XYZ", System.Drawing.Color.Green, 24f, topMargin + 2 * lineSpacing); - - // Save the modified PDF - mend.Save(outputPdf); - mend.Close(); - } -} diff --git a/facades-stamps/add-page-number-stamp-leading-zeros.cs b/facades-stamps/add-page-number-stamp-leading-zeros.cs new file mode 100644 index 000000000..84fca067a --- /dev/null +++ b/facades-stamps/add-page-number-stamp-leading-zeros.cs @@ -0,0 +1,40 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "output.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"Input file not found: {inputPath}"); + return; + } + + // Load the source PDF inside a using block for deterministic disposal. + using (Document doc = new Document(inputPath)) + { + // Initialize PdfFileStamp with the loaded document. + PdfFileStamp fileStamp = new PdfFileStamp(doc); + + // Use Arabic numerals and ensure leading zeros via the format string. + fileStamp.NumberingStyle = NumberingStyle.NumeralsArabic; + // The '#' placeholder will be replaced by the page number. + // Prefix with zeros to get leading zeros (e.g., 001, 002, ...). + fileStamp.AddPageNumber("00#"); + + // Save the stamped PDF. + fileStamp.Save(outputPath); + + // Close the facade (required to release internal resources). + fileStamp.Close(); + } + + Console.WriteLine($"Page-number stamped PDF saved to '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/add-page-number-stamp-to-pdf.cs b/facades-stamps/add-page-number-stamp-to-pdf.cs new file mode 100644 index 000000000..ce621ccd4 --- /dev/null +++ b/facades-stamps/add-page-number-stamp-to-pdf.cs @@ -0,0 +1,35 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "output.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"File not found: {inputPath}"); + return; + } + + // Initialize the facade with input and output files + PdfFileStamp fileStamp = new PdfFileStamp(inputPath, outputPath); + + // Optional: set the starting page number (default is 1) + fileStamp.StartingNumber = 1; + + // Add a page‑number stamp. + // Aspose.Pdf uses the '#' character as a placeholder that is replaced + // with the actual page number during stamping. + fileStamp.AddPageNumber("Page #"); + + // Persist changes and release resources + fileStamp.Close(); + + Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/add-page-number-stamp-with-leading-zeros.cs b/facades-stamps/add-page-number-stamp-with-leading-zeros.cs deleted file mode 100644 index 2997b3db8..000000000 --- a/facades-stamps/add-page-number-stamp-with-leading-zeros.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Text; - -class Program -{ - static void Main() - { - const string inputPath = "input.pdf"; - const string outputPath = "output.pdf"; - - // --------------------------------------------------------------------- - // Ensure an input PDF exists for the sandbox. Create a minimal document - // if the file is not present. This satisfies the "hardcoded-input-file- - // generate-inline-first" rule. - // --------------------------------------------------------------------- - if (!File.Exists(inputPath)) - { - using (Document seed = new Document()) - { - // Add a single blank page (optionally add some content). - Page page = seed.Pages.Add(); - page.Paragraphs.Add(new TextFragment("Sample page")); - seed.Save(inputPath); - } - } - - // Load the PDF document - Document doc = new Document(inputPath); - - // Define common stamp settings - Font font = FontRepository.FindFont("Helvetica"); - float fontSize = 12f; - Aspose.Pdf.Color fontColor = Aspose.Pdf.Color.Black; - HorizontalAlignment hAlign = HorizontalAlignment.Center; - VerticalAlignment vAlign = VerticalAlignment.Bottom; - float yIndent = 20f; // distance from the bottom edge - - // Add a page‑number stamp with leading zeros to every page - for (int i = 1; i <= doc.Pages.Count; i++) - { - // Format the page number with leading zeros (e.g., 001, 002, ...) - string pageNumber = i.ToString("D3"); // adjust the digit count as needed - - TextStamp stamp = new TextStamp(pageNumber); - stamp.TextState.Font = font; - stamp.TextState.FontSize = fontSize; - stamp.TextState.ForegroundColor = fontColor; - stamp.HorizontalAlignment = hAlign; - stamp.VerticalAlignment = vAlign; - stamp.YIndent = yIndent; - - doc.Pages[i].AddStamp(stamp); - } - - // Save the stamped PDF - doc.Save(outputPath); - } -} diff --git a/facades-stamps/add-page-numbers-to-pdf.cs b/facades-stamps/add-page-numbers-to-pdf.cs deleted file mode 100644 index 53b1da697..000000000 --- a/facades-stamps/add-page-numbers-to-pdf.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - const string inputPath = "input.pdf"; - const string outputPath = "output.pdf"; - - if (!File.Exists(inputPath)) - { - Console.Error.WriteLine($"Input file not found: {inputPath}"); - return; - } - - // PdfFileStamp works with the Facades API. - // The constructor takes the source PDF and the destination PDF. - // AddPageNumber uses the '#' character as a placeholder that Aspose.Pdf replaces - // with the current page number during stamping. - using (PdfFileStamp fileStamp = new PdfFileStamp(inputPath, outputPath)) - { - fileStamp.AddPageNumber("Page #"); // "Page #" will become "Page 1", "Page 2", etc. - fileStamp.Close(); // Finalizes and writes the output file. - } - - Console.WriteLine($"Page numbers added and saved to '{outputPath}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/add-qr-code-stamp-from-pdf-metadata.cs b/facades-stamps/add-qr-code-stamp-from-pdf-metadata.cs new file mode 100644 index 000000000..f0d93f61f --- /dev/null +++ b/facades-stamps/add-qr-code-stamp-from-pdf-metadata.cs @@ -0,0 +1,60 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "output_qr.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"File not found: {inputPath}"); + return; + } + + // Load the PDF document + using (Document doc = new Document(inputPath)) + { + // Collect some metadata to encode in the QR code + string meta = $"Title:{doc.Info.Title};Author:{doc.Info.Author};Subject:{doc.Info.Subject}"; + + // Generate QR code image bytes (replace with real QR generation logic) + byte[] qrBytes = GenerateQrCode(meta); + + // Create a stamp and bind the QR image + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + using (MemoryStream ms = new MemoryStream(qrBytes)) + { + stamp.BindImage(ms); + } + + // Configure stamp appearance + stamp.IsBackground = false; // place on top of page content + stamp.Opacity = 0.9f; // slightly transparent + stamp.SetOrigin(50, 750); // position (X, Y) from bottom-left + stamp.SetImageSize(100, 100); // width and height in points + + // Apply the stamp to the PDF using PdfFileStamp + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(inputPath); + fileStamp.AddStamp(stamp); + fileStamp.Save(outputPath); + fileStamp.Close(); + } + + Console.WriteLine($"QR code stamp added to '{outputPath}'."); + } + + // Placeholder method for QR code generation. + // Replace with an actual QR code library that returns PNG bytes. + static byte[] GenerateQrCode(string data) + { + // For demonstration purposes, return an empty byte array. + // In production, generate a PNG image of the QR code and return its bytes. + return new byte[0]; + } +} \ No newline at end of file diff --git a/facades-stamps/add-qr-code-verification-stamp.cs b/facades-stamps/add-qr-code-verification-stamp.cs deleted file mode 100644 index e13052aa8..000000000 --- a/facades-stamps/add-qr-code-verification-stamp.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Text; // TextStamp, FontRepository, FontStyles - -class ProductVerificationStamp -{ - static void Main() - { - const string inputPdfPath = "product_catalog.pdf"; // source PDF - const string outputPdfPath = "product_catalog_stamped.pdf"; - const string qrImagePath = "qr_code.png"; // QR code image file - const string description = "Product Verification\nScan QR code to verify authenticity"; - - // ------------------------------------------------------------ - // Validate required files - // ------------------------------------------------------------ - if (!File.Exists(inputPdfPath)) - { - Console.Error.WriteLine($"Input PDF not found: {inputPdfPath}"); - return; - } - if (!File.Exists(qrImagePath)) - { - Console.Error.WriteLine($"QR code image not found: {qrImagePath}"); - return; - } - - // ------------------------------------------------------------ - // Load the PDF document - // ------------------------------------------------------------ - Document pdfDocument = new Document(inputPdfPath); - - // ------------------------------------------------------------ - // 1) Image stamp – the QR code - // ------------------------------------------------------------ - ImageStamp qrStamp = new ImageStamp(qrImagePath) - { - Background = false, // draw on top of page content - Opacity = 0.9f, - XIndent = 100f, // position from left (points) - YIndent = 500f, // position from bottom (points) - Width = 120f, - Height = 120f - }; - - // ------------------------------------------------------------ - // 2) Text stamp – descriptive verification text - // ------------------------------------------------------------ - TextStamp txtStamp = new TextStamp(description) - { - Background = false, - Opacity = 0.9f, - XIndent = 240f, - YIndent = 500f - }; - txtStamp.TextState.Font = FontRepository.FindFont("Helvetica"); - txtStamp.TextState.FontSize = 12; - txtStamp.TextState.FontStyle = FontStyles.Regular; - txtStamp.TextState.ForegroundColor = Aspose.Pdf.Color.Black; - - // ------------------------------------------------------------ - // Add both stamps to every page (or change to a specific page set) - // ------------------------------------------------------------ - foreach (Page page in pdfDocument.Pages) - { - page.AddStamp(qrStamp); - page.AddStamp(txtStamp); - } - - // ------------------------------------------------------------ - // Save the stamped PDF - // ------------------------------------------------------------ - pdfDocument.Save(outputPdfPath); - Console.WriteLine($"Stamped PDF saved to '{outputPdfPath}'."); - } -} diff --git a/facades-stamps/add-repeating-background-image-stamp.cs b/facades-stamps/add-repeating-background-image-stamp.cs deleted file mode 100644 index bd3bf18b9..000000000 --- a/facades-stamps/add-repeating-background-image-stamp.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf.Facades; // PdfFileStamp and Stamp are in this namespace - -class Program -{ - static void Main() - { - // Paths for the source PDF, the watermark image, and the output PDF - const string inputPdf = "input.pdf"; - const string watermark = "watermark.png"; - const string outputPdf = "watermarked_output.pdf"; - - // Verify that required files exist - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input PDF not found: {inputPdf}"); - return; - } - if (!File.Exists(watermark)) - { - Console.Error.WriteLine($"Watermark image not found: {watermark}"); - return; - } - - // Create the PdfFileStamp facade - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.InputFile = inputPdf; // source document - fileStamp.OutputFile = outputPdf; // destination document - - // Create a single Stamp instance that will be applied to all pages - Stamp stamp = new Stamp(); - - // Bind the image that will be used as the watermark - stamp.BindImage(watermark); - - // Make the stamp a background element so it appears behind page content - stamp.IsBackground = true; - - // Optional: set opacity (0.0 = fully transparent, 1.0 = fully opaque) - stamp.Opacity = 0.5f; - - // By default, Pages == null, meaning the stamp is applied to every page. - // If you need to limit pages, assign an int[] array, e.g. stamp.Pages = new int[] {1,3,5}; - - // Add the stamp to the file - fileStamp.AddStamp(stamp); - - // Persist changes and release resources - fileStamp.Close(); - - Console.WriteLine($"Watermarked PDF saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/add-repeating-background-watermark-image.cs b/facades-stamps/add-repeating-background-watermark-image.cs new file mode 100644 index 000000000..5f49254c7 --- /dev/null +++ b/facades-stamps/add-repeating-background-watermark-image.cs @@ -0,0 +1,63 @@ +using System; +using System.IO; +using Aspose.Pdf; // Core PDF classes +using Aspose.Pdf.Facades; // Facades API (PdfFileStamp, Stamp) + +class Program +{ + static void Main() + { + // Paths – adjust as needed + const string inputPdf = "input.pdf"; + const string outputPdf = "output.pdf"; + const string watermarkImage = "watermark.png"; + + // Verify files exist + if (!File.Exists(inputPdf)) + { + Console.Error.WriteLine($"Input PDF not found: {inputPdf}"); + return; + } + if (!File.Exists(watermarkImage)) + { + Console.Error.WriteLine($"Watermark image not found: {watermarkImage}"); + return; + } + + // ------------------------------------------------------------ + // 1. Initialise PdfFileStamp facade + // ------------------------------------------------------------ + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.InputFile = inputPdf; // source PDF + fileStamp.OutputFile = outputPdf; // destination PDF + + // ------------------------------------------------------------ + // 2. Create a single Stamp instance that will be applied to + // every page (Pages = null) as a background image. + // ------------------------------------------------------------ + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + + // Bind the image that will be used as the watermark + stamp.BindImage(watermarkImage); + + // Make the stamp a background element (appears behind page content) + stamp.IsBackground = true; + + // Optional visual settings + stamp.Opacity = 0.3f; // semi‑transparent + stamp.SetImageSize(150, 150); // size of the watermark on the page + stamp.SetOrigin(0, 0); // position (lower‑left corner) + + // Pages = null means the stamp is applied to all pages. + // No need to set it explicitly, but shown here for clarity. + stamp.Pages = null; + + // ------------------------------------------------------------ + // 3. Add the stamp to the document and finalize + // ------------------------------------------------------------ + fileStamp.AddStamp(stamp); + fileStamp.Close(); // Saves the output file and releases resources + + Console.WriteLine($"Watermarked PDF saved to '{outputPdf}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/add-right-aligned-image-stamp-to-pdf.cs b/facades-stamps/add-right-aligned-image-stamp-to-pdf.cs deleted file mode 100644 index 1d4f666a1..000000000 --- a/facades-stamps/add-right-aligned-image-stamp-to-pdf.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; - -class Program -{ - static void Main() - { - const string inputPdf = "input.pdf"; - const string outputPdf = "output.pdf"; - const string logoImage = "logo.png"; - - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input PDF not found: {inputPdf}"); - return; - } - if (!File.Exists(logoImage)) - { - Console.Error.WriteLine($"Logo image not found: {logoImage}"); - return; - } - - // Load the PDF document inside a using block for proper disposal - using (Document doc = new Document(inputPdf)) - { - // Create an image stamp from the logo file - ImageStamp logoStamp = new ImageStamp(logoImage); - - // Align the stamp to the right margin of the page - logoStamp.HorizontalAlignment = HorizontalAlignment.Right; - - // Optional: set other visual properties - logoStamp.VerticalAlignment = VerticalAlignment.Center; - logoStamp.Opacity = 0.8f; // semi‑transparent - - // Apply the stamp to each page (or target specific pages as needed) - foreach (Page page in doc.Pages) - { - page.AddStamp(logoStamp); - } - - // Save the modified PDF - doc.Save(outputPdf); - } - - Console.WriteLine($"Logo stamp added with right alignment. Saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/add-right-aligned-logo-stamp-to-pdf.cs b/facades-stamps/add-right-aligned-logo-stamp-to-pdf.cs new file mode 100644 index 000000000..642aa4f22 --- /dev/null +++ b/facades-stamps/add-right-aligned-logo-stamp-to-pdf.cs @@ -0,0 +1,48 @@ +using System; +using System.IO; +using Aspose.Pdf; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "output.pdf"; + const string logoPath = "logo.png"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"Input PDF not found: {inputPath}"); + return; + } + + if (!File.Exists(logoPath)) + { + Console.Error.WriteLine($"Logo image not found: {logoPath}"); + return; + } + + // Load the source PDF + using (Document doc = new Document(inputPath)) + { + // Create an image stamp from the logo file and configure alignment + ImageStamp stamp = new ImageStamp(logoPath) + { + HorizontalAlignment = HorizontalAlignment.Right, + VerticalAlignment = VerticalAlignment.Center, + Opacity = 0.8f // 80% opacity + }; + + // Apply the stamp to every page in the document + foreach (Page page in doc.Pages) + { + page.AddStamp(stamp); + } + + // Save the modified PDF + doc.Save(outputPath); + } + + Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); + } +} diff --git a/facades-stamps/add-semi-transparent-background-stamp.cs b/facades-stamps/add-semi-transparent-background-stamp.cs index b31533942..052421c7d 100644 --- a/facades-stamps/add-semi-transparent-background-stamp.cs +++ b/facades-stamps/add-semi-transparent-background-stamp.cs @@ -2,14 +2,14 @@ using System.IO; using Aspose.Pdf; using Aspose.Pdf.Facades; -using Aspose.Pdf.Text; // required for FormattedText and EncodingType class Program { static void Main() { - const string inputPdf = "input.pdf"; - const string outputPdf = "output.pdf"; + const string inputPdf = "input.pdf"; // source PDF + const string stampImg = "stamp.png"; // image to use as background stamp + const string outputPdf = "output.pdf"; // result PDF if (!File.Exists(inputPdf)) { @@ -17,30 +17,26 @@ static void Main() return; } - // Create a text stamp that will be placed as a background. - // Opacity 0.3 = 30% transparency. - // BindLogo attaches formatted text to the stamp. - FormattedText ft = new FormattedText( - "BACKGROUND", // text to display - System.Drawing.Color.Gray, // text color (System.Drawing is required here) - "Helvetica", // font name - EncodingType.Winansi, // encoding - false, // embed font? - 72); // font size + if (!File.Exists(stampImg)) + { + Console.Error.WriteLine($"Aspose.Pdf.Facades.Stamp image not found: {stampImg}"); + return; + } + // Initialize the facade and bind the source PDF + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(inputPdf); + + // Create a stamp, bind the image, set opacity and background flag Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.IsBackground = true; // place behind page content - stamp.Opacity = 0.3f; // 30% opacity - stamp.BindLogo(ft); // use the formatted text as the stamp content - stamp.SetOrigin(100, 400); // position of the stamp (optional) - stamp.SetImageSize(300, 200); // size of the stamp (optional) + stamp.BindImage(stampImg); // use the image as stamp content + stamp.Opacity = 0.3f; // 30% opacity + stamp.IsBackground = true; // place stamp behind page content - // Use the PdfFileStamp facade to apply the stamp to the whole document. - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.BindPdf(inputPdf); // load source PDF - fileStamp.AddStamp(stamp); // add the configured stamp - fileStamp.Save(outputPdf); // write result - fileStamp.Close(); // release resources + // Add the stamp to all pages and save the result + fileStamp.AddStamp(stamp); + fileStamp.Save(outputPdf); + fileStamp.Close(); Console.WriteLine($"Background stamp applied. Output saved to '{outputPdf}'."); } diff --git a/facades-stamps/add-semi-transparent-png-background-stamp.cs b/facades-stamps/add-semi-transparent-png-background-stamp.cs deleted file mode 100644 index 9077148a2..000000000 --- a/facades-stamps/add-semi-transparent-png-background-stamp.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - const string inputPdf = "input.pdf"; - const string outputPdf = "output.pdf"; - const string stampImage = "background.png"; - - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input file not found: {inputPdf}"); - return; - } - - if (!File.Exists(stampImage)) - { - Console.Error.WriteLine($"Stamp image not found: {stampImage}"); - return; - } - - // Load the source PDF to obtain page dimensions (assumes all pages share the same size) - double pageWidth, pageHeight; - using (Document doc = new Document(inputPdf)) - { - pageWidth = doc.Pages[1].PageInfo.Width; - pageHeight = doc.Pages[1].PageInfo.Height; - } - - // Initialize the facade for stamping - using (PdfFileStamp fileStamp = new PdfFileStamp()) - { - // Bind the source PDF - fileStamp.BindPdf(inputPdf); - - // Create and configure the stamp - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindImage(stampImage); // PNG image to use as stamp - stamp.SetImageSize((float)pageWidth, (float)pageHeight); // Cover entire page - stamp.SetOrigin(0, 0); // Position at lower‑left corner - stamp.Opacity = 0.5f; // Semi‑transparent - stamp.IsBackground = true; // Place behind page content - - // Add the stamp to all pages - fileStamp.AddStamp(stamp); - - // Save the stamped PDF - fileStamp.Save(outputPdf); - fileStamp.Close(); - } - - Console.WriteLine($"Background stamp applied and saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/add-text-stamp-overlay-to-pdf-pages.cs b/facades-stamps/add-text-stamp-overlay-to-pdf-pages.cs deleted file mode 100644 index b826e1383..000000000 --- a/facades-stamps/add-text-stamp-overlay-to-pdf-pages.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Drawing; -using Aspose.Pdf; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - // --------------------------------------------------------------------- - // Create a simple source PDF so the example can run in an empty sandbox. - // --------------------------------------------------------------------- - const string inputPdf = "input.pdf"; - const string outputPdf = "output.pdf"; - - // Create a one‑page PDF and save it to the expected input path. - using (Document seed = new Document()) - { - seed.Pages.Add(); - seed.Save(inputPdf); - } - - // --------------------------------------------------------------- - // Initialize the PdfFileStamp facade using the modern API (BindPdf). - // --------------------------------------------------------------- - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.BindPdf(inputPdf); // replaces the obsolete InputFile property - - // --------------------------------------------------------------- - // Build the stamp content. - // --------------------------------------------------------------- - // FormattedText constructor allows us to set text, color, font, encoding, - // whether the text is bold/italic, and the font size in one call. - Aspose.Pdf.Facades.FormattedText ft = new Aspose.Pdf.Facades.FormattedText( - "CONFIDENTIAL", - System.Drawing.Color.Red, // text color (fully qualified) - "Helvetica", // font name - Aspose.Pdf.Facades.EncodingType.Winansi, // encoding - false, // isBold (false) - 36); // font size - - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindLogo(ft); - // Ensure the stamp is drawn on top of existing page content. - stamp.IsBackground = false; - // Optional: position the stamp (origin is measured from the lower‑left corner). - stamp.SetOrigin(100, 400); - - // Apply the stamp to all pages (default behaviour). - fileStamp.AddStamp(stamp); - - // Save the stamped document using the modern API (Save). - fileStamp.Save(outputPdf); - fileStamp.Close(); - - Console.WriteLine($"Stamp applied. Output saved to '{outputPdf}'."); - } -} diff --git a/facades-stamps/add-transparent-confidential-text-stamp.cs b/facades-stamps/add-transparent-confidential-text-stamp.cs new file mode 100644 index 000000000..e9c85b61d --- /dev/null +++ b/facades-stamps/add-transparent-confidential-text-stamp.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "output.pdf"; + + // Specify the pages that should receive the stamp (1‑based indexing) + int[] pagesToStamp = new int[] { 1, 3, 5 }; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"File not found: {inputPath}"); + return; + } + + // Load the source PDF + using (Document doc = new Document(inputPath)) + { + // Initialize the facade with the loaded document + PdfFileStamp fileStamp = new PdfFileStamp(doc); + + // Create the formatted text that will appear as the stamp + // Parameters: text, color (System.Drawing.Color), font name, encoding, embedded flag, font size + Aspose.Pdf.Facades.FormattedText formattedText = new Aspose.Pdf.Facades.FormattedText( + "CONFIDENTIAL", + System.Drawing.Color.Red, + "Helvetica", + Aspose.Pdf.Facades.EncodingType.Winansi, + false, + 48); + + // Configure the stamp + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + stamp.BindLogo(formattedText); // bind the text to the stamp + stamp.IsBackground = true; // place the stamp behind page content + stamp.Opacity = 0.7f; // 70% opacity + stamp.Pages = pagesToStamp; // apply only to selected pages + + // Add the stamp to the document and save + fileStamp.AddStamp(stamp); + fileStamp.Save(outputPath); + fileStamp.Close(); + } + + Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/add-transparent-text-stamp-to-selected-pdf-pages.cs b/facades-stamps/add-transparent-text-stamp-to-selected-pdf-pages.cs deleted file mode 100644 index caf0de262..000000000 --- a/facades-stamps/add-transparent-text-stamp-to-selected-pdf-pages.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - // Paths for input and output PDFs - const string inputPdf = "input.pdf"; - const string outputPdf = "output.pdf"; - - // Verify input file exists - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input file not found: {inputPdf}"); - return; - } - - // Create a PdfFileStamp facade (does NOT implement IDisposable) - PdfFileStamp fileStamp = new PdfFileStamp(); - - // Bind the source PDF file - fileStamp.BindPdf(inputPdf); - - // Create a text stamp using FormattedText - // Constructor: FormattedText(string text, System.Drawing.Color color, - // string fontName, EncodingType encoding, bool isEmbedded, double fontSize) - FormattedText ft = new FormattedText( - "CONFIDENTIAL", // stamp text - System.Drawing.Color.Red, // text color - "Helvetica", // font name - EncodingType.Winansi, // encoding - false, // embed font? - 48); // font size - - // Initialize the stamp and bind the formatted text - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindLogo(ft); // set the text as stamp content - - // Set stamp properties - stamp.Opacity = 0.7f; // 70% opacity (0.0 to 1.0) - stamp.IsBackground = true; // place stamp behind page content - stamp.Pages = new int[] { 1, 3, 5 }; // apply only to selected pages (example) - - // Add the stamp to the document - fileStamp.AddStamp(stamp); - - // Save the stamped PDF - fileStamp.Save(outputPdf); - - // Close the facade (releases internal resources) - fileStamp.Close(); - - Console.WriteLine($"Stamped PDF saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/apply-custom-colored-stamp-with-border.cs b/facades-stamps/apply-custom-colored-stamp-with-border.cs deleted file mode 100644 index d0fe4d629..000000000 --- a/facades-stamps/apply-custom-colored-stamp-with-border.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Annotations; -using Aspose.Pdf.Drawing; // for Rectangle -using Aspose.Pdf; // for Color (fully qualified when needed) - -class Program -{ - static void Main() - { - const string inputPath = "input.pdf"; - const string outputPath = "stamped_output.pdf"; - - if (!File.Exists(inputPath)) - { - Console.Error.WriteLine($"File not found: {inputPath}"); - return; - } - - // Load the PDF document inside a using block for deterministic disposal - using (Document doc = new Document(inputPath)) - { - // Define the stamp rectangle (coordinates are in points; origin is bottom‑left) - // Here we place a 150x50 stamp near the top‑left corner of each page - Aspose.Pdf.Rectangle stampRect = new Aspose.Pdf.Rectangle(50, 750, 200, 800); - - // Iterate over all pages (Aspose.Pdf uses 1‑based indexing) - for (int i = 1; i <= doc.Pages.Count; i++) - { - Page page = doc.Pages[i]; - - // Create a rubber‑stamp annotation on the current page - StampAnnotation stamp = new StampAnnotation(page, stampRect) - { - // Text displayed inside the stamp - Contents = "IMPORTANT", - - // Border color – this also defines the visual color of the stamp - Color = Aspose.Pdf.Color.Red - }; - - // Set custom border thickness (width in points) - // Border constructor requires the parent annotation instance - stamp.Border = new Border(stamp) { Width = 2 }; - - // Add the annotation to the page - page.Annotations.Add(stamp); - } - - // Save the modified PDF - doc.Save(outputPath); - } - - Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/apply-custom-line-height-stamp.cs b/facades-stamps/apply-custom-line-height-stamp.cs new file mode 100644 index 000000000..4b60086eb --- /dev/null +++ b/facades-stamps/apply-custom-line-height-stamp.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "watermarked.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"File not found: {inputPath}"); + return; + } + + // Create formatted text with custom line spacing (extra spacing after each line) + FormattedText formattedText = new FormattedText(); + formattedText.AddNewLineText("CONFIDENTIAL", 5f); // 5 points extra spacing + formattedText.AddNewLineText("DO NOT DISTRIBUTE", 5f); + formattedText.AddNewLineText("FOR INTERNAL USE ONLY", 5f); + + // Create a stamp and bind the formatted text to it + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + stamp.BindLogo(formattedText); + + // Position the stamp (XIndent, YIndent) and set appearance + stamp.SetOrigin(100, 400); // place near the center of the page + stamp.Opacity = 0.3f; // semi‑transparent + stamp.IsBackground = true; // draw behind page content + + // Apply the stamp to all pages using PdfFileStamp facade + using (PdfFileStamp fileStamp = new PdfFileStamp()) + { + fileStamp.BindPdf(inputPath); // load source PDF + fileStamp.AddStamp(stamp); // add the prepared stamp + fileStamp.Save(outputPath); // save the result + fileStamp.Close(); // close resources + } + + Console.WriteLine($"Watermarked PDF saved to '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/apply-external-pdf-template-stamp.cs b/facades-stamps/apply-external-pdf-template-stamp.cs new file mode 100644 index 000000000..dbaf7a5cc --- /dev/null +++ b/facades-stamps/apply-external-pdf-template-stamp.cs @@ -0,0 +1,54 @@ +using System; +using System.IO; +using Aspose.Pdf.Facades; // Facade classes: PdfFileStamp, Stamp + +class Program +{ + static void Main() + { + // Paths – adjust as needed + const string inputPdf = "input.pdf"; // PDF to be stamped + const string templatePdf = "template.pdf"; // PDF whose page will be used as stamp + const string outputPdf = "output.pdf"; + + // Verify files exist + if (!File.Exists(inputPdf)) + { + Console.Error.WriteLine($"Input PDF not found: {inputPdf}"); + return; + } + if (!File.Exists(templatePdf)) + { + Console.Error.WriteLine($"Template PDF not found: {templatePdf}"); + return; + } + + // Initialize the facade for stamping + PdfFileStamp fileStamp = new PdfFileStamp(); + + // Bind the source PDF (the document that will receive the stamp) + fileStamp.BindPdf(inputPdf); + + // Create a stamp that uses a page from the external template PDF + Stamp stamp = new Stamp(); + + // Use the first page of the template PDF as the stamp content + // (adjust the page number if a different page is required) + stamp.BindPdf(templatePdf, 1); + + // Apply the stamp only to page 3 of the target document + stamp.Pages = new int[] { 3 }; + + // Add the configured stamp to the facade + fileStamp.AddStamp(stamp); + + // Save the result + fileStamp.Save(outputPdf); + + // Release resources (PdfFileStamp does not implement IDisposable, + // so we call Close() explicitly) + fileStamp.Close(); + + Console.WriteLine($"Stamped PDF saved to '{outputPdf}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/apply-image-stamp-to-all-pdf-pages.cs b/facades-stamps/apply-image-stamp-to-all-pdf-pages.cs new file mode 100644 index 000000000..e52c6fd09 --- /dev/null +++ b/facades-stamps/apply-image-stamp-to-all-pdf-pages.cs @@ -0,0 +1,46 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPdf = "input.pdf"; + const string outputPdf = "output.pdf"; + const string stampImagePath = "stamp.png"; + + if (!File.Exists(inputPdf)) + { + Console.Error.WriteLine($"Input file not found: {inputPdf}"); + return; + } + if (!File.Exists(stampImagePath)) + { + Console.Error.WriteLine($"Aspose.Pdf.Facades.Stamp image not found: {stampImagePath}"); + return; + } + + // Initialize the facade and bind the source PDF. + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(inputPdf); // Load source PDF + + // Create a stamp that will be applied to all pages. + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + stamp.BindImage(stampImagePath); // Use an image as the stamp + stamp.IsBackground = true; // Place stamp behind page content + stamp.Opacity = 0.5f; // Semi‑transparent + stamp.SetOrigin(100, 500); // Position (X, Y) from lower‑left corner + stamp.SetImageSize(150, 100); // Desired width and height + + // Leave stamp.Pages = null (default) so the stamp affects every page. + fileStamp.AddStamp(stamp); // Add the stamp to the document + + // Save the result and release resources. + fileStamp.Save(outputPdf); + fileStamp.Close(); + + Console.WriteLine($"Aspose.Pdf.Facades.Stamp applied to all pages. Output saved to '{outputPdf}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/apply-multi-line-text-stamp-1-5-line-spacing.cs b/facades-stamps/apply-multi-line-text-stamp-1-5-line-spacing.cs deleted file mode 100644 index 39411dc40..000000000 --- a/facades-stamps/apply-multi-line-text-stamp-1-5-line-spacing.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; -using Aspose.Pdf.Text; - -class Program -{ - static void Main() - { - const string inputPdf = "input.pdf"; - const string outputPdf = "watermarked.pdf"; - - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"File not found: {inputPdf}"); - return; - } - - // Create formatted text with multiple lines. - // First line is added via constructor, subsequent lines via AddNewLineText with line spacing. - FormattedText formatted = new FormattedText( - "Confidential", // first line text - System.Drawing.Color.Red, // text color (System.Drawing.Color is required here) - "Helvetica", // font name - EncodingType.Winansi, // encoding - false, // embed font - 36); // font size - - // Add additional lines; the second parameter is the extra line spacing (in points). - // Using 1.5f as the additional spacing to achieve a 1.5 line‑spacing effect. - formatted.AddNewLineText("Do Not Distribute", 1.5f); - formatted.AddNewLineText("Authorized Personnel Only", 1.5f); - - // Create a stamp and bind the formatted text to it. - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindLogo(formatted); // bind the multi‑line text - stamp.IsBackground = true; // place behind page content - stamp.Opacity = 0.5f; // semi‑transparent - stamp.SetOrigin(100, 400); // position on the page (X, Y) - - // Apply the stamp to the entire PDF using PdfFileStamp. - PdfFileStamp pdfStamp = new PdfFileStamp(); - pdfStamp.BindPdf(inputPdf); // load source PDF - pdfStamp.AddStamp(stamp); // add the prepared stamp - pdfStamp.Save(outputPdf); // save the result - pdfStamp.Close(); // release resources - - Console.WriteLine($"Watermarked PDF saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/apply-pdf-page-stamp-as-background.cs b/facades-stamps/apply-pdf-page-stamp-as-background.cs index be3469bc1..f9495cd98 100644 --- a/facades-stamps/apply-pdf-page-stamp-as-background.cs +++ b/facades-stamps/apply-pdf-page-stamp-as-background.cs @@ -22,23 +22,25 @@ static void Main() return; } - // ---------- Lifecycle: create ---------- + // ---------- Create ---------- + // PdfFileStamp is the facade for stamping operations PdfFileStamp fileStamp = new PdfFileStamp(); - // ---------- Lifecycle: load ---------- + // ---------- Load ---------- // Bind the source PDF that will receive the stamp fileStamp.BindPdf(inputPdf); // Create a stamp that uses the first page of the stamp PDF - Stamp stamp = new Stamp(); + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); stamp.BindPdf(stampPdf, 1); // page number is 1‑based - stamp.IsBackground = true; // place stamp behind page content - stamp.Pages = null; // null means all pages are affected + stamp.IsBackground = true; // place stamp behind page content + // By default stamp.Pages is null, meaning all pages are affected - // ---------- Apply stamp ---------- + // ---------- Apply ---------- fileStamp.AddStamp(stamp); - // ---------- Lifecycle: save ---------- + // ---------- Save ---------- + // Save the stamped document to the output path fileStamp.Save(outputPdf); fileStamp.Close(); diff --git a/facades-stamps/apply-pdf-stamp-preserve-filenames.cs b/facades-stamps/apply-pdf-stamp-preserve-filenames.cs deleted file mode 100644 index ed64b4f20..000000000 --- a/facades-stamps/apply-pdf-stamp-preserve-filenames.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - // Folder containing the original PDFs - const string sourceFolder = @"C:\InputPdfs"; - // Folder where stamped PDFs will be saved - const string destinationFolder = @"C:\StampedPdfs"; - // Path to the PDF file that will be used as a stamp (first page will be the stamp) - const string stampPdfPath = @"C:\Stamp\stamp.pdf"; - - // Ensure the destination directory exists - Directory.CreateDirectory(destinationFolder); - - // Process each PDF file in the source folder - foreach (string inputFilePath in Directory.GetFiles(sourceFolder, "*.pdf")) - { - // Preserve the original file name - string fileName = Path.GetFileName(inputFilePath); - string outputFilePath = Path.Combine(destinationFolder, fileName); - - // Create the PdfFileStamp facade - PdfFileStamp fileStamp = new PdfFileStamp(); - // Specify input and output files via properties (as required by the rule) - fileStamp.InputFile = inputFilePath; - fileStamp.OutputFile = outputFilePath; - - // Create a stamp object and bind the first page of the stamp PDF - Stamp stamp = new Stamp(); - stamp.BindPdf(stampPdfPath, 1); // Use page 1 of the stamp PDF - stamp.IsBackground = true; // Place stamp behind page content - stamp.Opacity = 0.5f; // Semi‑transparent - - // Add the stamp to the document - fileStamp.AddStamp(stamp); - - // Close the facade – this writes the stamped PDF to the output path - fileStamp.Close(); - } - - Console.WriteLine("All PDFs have been stamped and saved to the destination folder."); - } -} \ No newline at end of file diff --git a/facades-stamps/apply-pdf-template-stamp-to-page.cs b/facades-stamps/apply-pdf-template-stamp-to-page.cs deleted file mode 100644 index 998625852..000000000 --- a/facades-stamps/apply-pdf-template-stamp-to-page.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - // Paths – adjust as needed - const string inputPdf = "input.pdf"; // PDF to be stamped - const string templatePdf = "template.pdf"; // PDF containing the stamp page - const string outputPdf = "output.pdf"; - - // Verify files exist - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input file not found: {inputPdf}"); - return; - } - if (!File.Exists(templatePdf)) - { - Console.Error.WriteLine($"Template file not found: {templatePdf}"); - return; - } - - // Initialize the PdfFileStamp facade - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.InputFile = inputPdf; // source document - fileStamp.OutputFile = outputPdf; // destination document - - // Create a stamp that uses page 1 of the template PDF - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindPdf(templatePdf, 1); // Bind the template page as stamp content - stamp.Pages = new int[] { 3 }; // Apply stamp only to page 3 of the target PDF - stamp.IsBackground = false; // Aspose.Pdf.Facades.Stamp appears on top (set true for background) - - // Add the stamp to the file and finalize - fileStamp.AddStamp(stamp); - fileStamp.Close(); - - Console.WriteLine($"Aspose.Pdf.Facades.Stamp applied. Output saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/apply-rotated-image-stamp-bottom-right.cs b/facades-stamps/apply-rotated-image-stamp-bottom-right.cs deleted file mode 100644 index 6a115f856..000000000 --- a/facades-stamps/apply-rotated-image-stamp-bottom-right.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - const string inputPdf = "input.pdf"; - const string outputPdf = "output.pdf"; - const string imagePath = "stamp.png"; - - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input PDF not found: {inputPdf}"); - return; - } - if (!File.Exists(imagePath)) - { - Console.Error.WriteLine($"Aspose.Pdf.Facades.Stamp image not found: {imagePath}"); - return; - } - - // Initialize the facade with input and output files - PdfFileStamp fileStamp = new PdfFileStamp(inputPdf, outputPdf); - - // Create a stamp and bind the image - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindImage(imagePath); - - // Define stamp size (width, height) in points - const float stampWidth = 100f; - const float stampHeight = 100f; - stamp.SetImageSize(stampWidth, stampHeight); - - // Rotate the stamp by an arbitrary angle (30 degrees) - stamp.Rotation = 30f; // Facades Aspose.Pdf.Facades.Stamp uses a float for rotation - - // Position the stamp at the bottom‑right corner of each page - // Page dimensions are available after binding the PDF - float pageWidth = fileStamp.PageWidth; - // Y coordinate is 0 (bottom); X is page width minus stamp width - stamp.SetOrigin(pageWidth - stampWidth, 0f); - - // Apply the stamp to all pages (null means all pages) - stamp.Pages = null; - - // Add the configured stamp to the document - fileStamp.AddStamp(stamp); - - // Save and close the facade - fileStamp.Close(); - - Console.WriteLine($"Rotated image stamp applied and saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/apply-rotated-image-stamp-to-pdf-pages.cs b/facades-stamps/apply-rotated-image-stamp-to-pdf-pages.cs new file mode 100644 index 000000000..6f83fa361 --- /dev/null +++ b/facades-stamps/apply-rotated-image-stamp-to-pdf-pages.cs @@ -0,0 +1,66 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPdf = "input.pdf"; // source PDF + const string outputPdf = "output.pdf"; // result PDF + const string stampImage = "stamp.png"; // image to use as stamp + + if (!File.Exists(inputPdf)) + { + Console.Error.WriteLine($"Input file not found: {inputPdf}"); + return; + } + if (!File.Exists(stampImage)) + { + Console.Error.WriteLine($"Stamp image not found: {stampImage}"); + return; + } + + // Load the source PDF to obtain page dimensions. + Document srcDoc = new Document(inputPdf); + + // Initialize the facade and bind the source PDF. + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(inputPdf); + + // Desired stamp size (in points) and margins. + const float stampWidth = 80f; // width of the stamp image + const float stampHeight = 80f; // height of the stamp image + const float rightMargin = 10f; // distance from the right edge + const float bottomMargin = 10f; // distance from the bottom edge + const float rotationAngle = 30f; // rotation in degrees + + // Iterate over every page and add a rotated image stamp to the bottom‑right corner. + foreach (Page page in srcDoc.Pages) + { + // Create a new stamp for the current page. + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + stamp.BindImage(stampImage); // use the image as stamp + stamp.SetImageSize(stampWidth, stampHeight); + stamp.Rotation = rotationAngle; + + // Calculate the origin (lower‑left corner of the stamp) so that the stamp + // sits at the bottom‑right corner of the page. + // Page coordinates: (0,0) is lower‑left. + float originX = (float)page.PageInfo.Width - rightMargin - stampWidth; + float originY = bottomMargin; // distance from bottom edge + stamp.SetOrigin(originX, originY); + + // Apply the stamp only to the current page. + stamp.Pages = new int[] { page.Number }; + fileStamp.AddStamp(stamp); + } + + // Save the result and release resources. + fileStamp.Save(outputPdf); + fileStamp.Close(); + + Console.WriteLine($"Rotated image stamp applied. Output saved to '{outputPdf}'."); + } +} diff --git a/facades-stamps/apply-rotated-text-stamp-odd-pages.cs b/facades-stamps/apply-rotated-text-stamp-odd-pages.cs new file mode 100644 index 000000000..a1c9e5125 --- /dev/null +++ b/facades-stamps/apply-rotated-text-stamp-odd-pages.cs @@ -0,0 +1,55 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Text; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "output.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"File not found: {inputPath}"); + return; + } + + // Load the PDF document + using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document(inputPath)) + { + // Iterate over all pages (1‑based indexing) + for (int i = 1; i <= doc.Pages.Count; i++) + { + // Apply stamp only to odd‑numbered pages + if (i % 2 == 1) + { + // Create a textual stamp + Aspose.Pdf.TextStamp stamp = new Aspose.Pdf.TextStamp("CONFIDENTIAL"); + + // Set arbitrary rotation angle (30 degrees) + stamp.RotateAngle = 30; + + // Position the stamp near the left margin + stamp.XIndent = 10; // distance from the left edge + // Vertically centre the stamp on the page + stamp.YIndent = doc.Pages[i].PageInfo.Height / 2; + + // Configure text appearance using Aspose.Pdf.Color (cross‑platform) + stamp.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Helvetica"); + stamp.TextState.FontSize = 24; + stamp.TextState.ForegroundColor = Aspose.Pdf.Color.Red; + + // Add the stamp to the current page + doc.Pages[i].AddStamp(stamp); + } + } + + // Save the modified PDF + doc.Save(outputPath); + } + + Console.WriteLine($"Rotated text stamp applied to odd pages. Saved as '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/apply-rotated-text-stamp-to-odd-pages.cs b/facades-stamps/apply-rotated-text-stamp-to-odd-pages.cs deleted file mode 100644 index 16d5397a1..000000000 --- a/facades-stamps/apply-rotated-text-stamp-to-odd-pages.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Text; // TextStamp, FontRepository, TextState -using System.Drawing; // System.Drawing.Color for convenience - -class Program -{ - static void Main() - { - const string inputPath = "input.pdf"; - const string outputPath = "output.pdf"; - const string stampText = "CONFIDENTIAL"; - - if (!File.Exists(inputPath)) - { - Console.Error.WriteLine($"Input file not found: {inputPath}"); - return; - } - - // Load the source PDF - using (Document doc = new Document(inputPath)) - { - // Iterate over pages and add the rotated stamp to odd‑numbered pages - foreach (Page page in doc.Pages) - { - if (page.Number % 2 == 1) // odd page - { - // Create a TextStamp (simpler than Facades.Stamp for this scenario) - TextStamp textStamp = new TextStamp(stampText); - - // Configure appearance - textStamp.TextState.Font = FontRepository.FindFont("Helvetica"); - textStamp.TextState.FontSize = 24; - textStamp.TextState.ForegroundColor = Aspose.Pdf.Color.Red; - // Use RotateAngle instead of the non‑existent Rotation property - textStamp.RotateAngle = 30f; // 30 degree rotation - - // Position: left margin (10 points from left) and vertically centered - textStamp.HorizontalAlignment = HorizontalAlignment.Left; - textStamp.XIndent = 10f; // distance from left edge - textStamp.VerticalAlignment = VerticalAlignment.Center; - // YIndent left at default (0) – Center alignment will place it in the middle of the page - - // Add the stamp to the current page - page.AddStamp(textStamp); - } - } - - // Save the modified document - doc.Save(outputPath); - } - - Console.WriteLine($"Rotated text stamp applied. Output saved to '{outputPath}'."); - } -} diff --git a/facades-stamps/apply-rotating-stamps-to-pdf-pages.cs b/facades-stamps/apply-rotating-stamps-to-pdf-pages.cs new file mode 100644 index 000000000..a55883087 --- /dev/null +++ b/facades-stamps/apply-rotating-stamps-to-pdf-pages.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "stamped_output.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"Input file not found: {inputPath}"); + return; + } + + // Determine the number of pages in the source PDF. + int pageCount; + using (Document srcDoc = new Document(inputPath)) + { + pageCount = srcDoc.Pages.Count; // 1‑based page count + } + + // Initialize the facade for stamping. + PdfFileStamp fileStamp = new PdfFileStamp(inputPath, outputPath); + + // Apply a stamp to each page with a rotation based on its index. + for (int pageIndex = 1; pageIndex <= pageCount; pageIndex++) + { + // Create a new stamp instance. + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + + // Use simple text as the stamp content. + stamp.BindLogo(new FormattedText($"Page {pageIndex}")); + + // Example rotation: 30° per page, wrapped within 0‑360°. + stamp.Rotation = (pageIndex * 30) % 360; + + // Restrict the stamp to the current page only. + stamp.Pages = new int[] { pageIndex }; + + // Add the configured stamp to the document. + fileStamp.AddStamp(stamp); + } + + // Finalize and save the stamped PDF. + fileStamp.Close(); + + Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/apply-rotating-text-stamps.cs b/facades-stamps/apply-rotating-text-stamps.cs deleted file mode 100644 index 3c1a57418..000000000 --- a/facades-stamps/apply-rotating-text-stamps.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; -using Aspose.Pdf.Text; // for FormattedText - -class Program -{ - static void Main() - { - const string inputPath = "input.pdf"; - const string outputPath = "stamped_output.pdf"; - - if (!File.Exists(inputPath)) - { - Console.Error.WriteLine($"Input file not found: {inputPath}"); - return; - } - - // Load the document to obtain the page count. - using (Document doc = new Document(inputPath)) - { - int pageCount = doc.Pages.Count; - - // Initialize the PdfFileStamp facade. - using (PdfFileStamp fileStamp = new PdfFileStamp()) - { - // Bind the source PDF. - fileStamp.BindPdf(inputPath); - - // Create a separate stamp for each page with a unique rotation. - for (int i = 1; i <= pageCount; i++) - { - // Example: rotation angle increases by 15 degrees per page. - float rotationAngle = (i - 1) * 15f; - - // Create a simple text stamp. - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - // Use a text logo as the stamp content. - stamp.BindLogo(new FormattedText( - $"Page {i}", - System.Drawing.Color.Black, - "Helvetica", - EncodingType.Winansi, - false, - 24)); - - // Apply rotation. - stamp.Rotation = rotationAngle; - - // Restrict the stamp to the current page only. - stamp.Pages = new int[] { i }; - - // Add the stamp to the facade. - fileStamp.AddStamp(stamp); - } - - // Save the result. - fileStamp.Save(outputPath); - fileStamp.Close(); - } - } - - Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/apply-semi-transparent-png-background-stamp.cs b/facades-stamps/apply-semi-transparent-png-background-stamp.cs new file mode 100644 index 000000000..faec0b281 --- /dev/null +++ b/facades-stamps/apply-semi-transparent-png-background-stamp.cs @@ -0,0 +1,56 @@ +using System; +using System.IO; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPdf = "input.pdf"; + const string outputPdf = "output.pdf"; + const string stampImage = "stamp.png"; + + if (!File.Exists(inputPdf)) + { + Console.Error.WriteLine($"Input file not found: {inputPdf}"); + return; + } + + if (!File.Exists(stampImage)) + { + Console.Error.WriteLine($"Stamp image not found: {stampImage}"); + return; + } + + // Initialize the facade for stamping + using (PdfFileStamp fileStamp = new PdfFileStamp()) + { + // Load the source PDF + fileStamp.BindPdf(inputPdf); + + // Create a stamp and bind the PNG image + Stamp stamp = new Stamp(); + stamp.BindImage(stampImage); + + // Make the stamp semi‑transparent + stamp.Opacity = 0.5f; + + // Place the stamp behind the page content + stamp.IsBackground = true; + + // Resize the stamp to cover the whole page + stamp.SetImageSize((float)fileStamp.PageWidth, (float)fileStamp.PageHeight); + + // Apply the stamp to all pages (null means all pages) + stamp.Pages = null; + + // Add the stamp to the document + fileStamp.AddStamp(stamp); + + // Save the stamped PDF + fileStamp.Save(outputPdf); + } + + Console.WriteLine($"Background stamp applied and saved to '{outputPdf}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/apply-stamp-to-even-pdf-pages.cs b/facades-stamps/apply-stamp-to-even-pdf-pages.cs new file mode 100644 index 000000000..d74c19af6 --- /dev/null +++ b/facades-stamps/apply-stamp-to-even-pdf-pages.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; + const string outputPath = "output.pdf"; + + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"Input file not found: {inputPath}"); + return; + } + + // Determine total number of pages in the source PDF. + int pageCount; + using (Document doc = new Document(inputPath)) + { + pageCount = doc.Pages.Count; // 1‑based page count + } + + // Build an array containing only even page numbers. + int evenCount = pageCount / 2; + int[] evenPages = new int[evenCount]; + int idx = 0; + for (int i = 2; i <= pageCount; i += 2) + { + evenPages[idx++] = i; + } + + // Configure PdfFileStamp facade. + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.InputFile = inputPath; + fileStamp.OutputFile = outputPath; + + // Create a stamp (e.g., a simple text stamp) and assign even pages. + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + // Example: bind a text logo as the stamp content. + stamp.BindLogo(new FormattedText("CONFIDENTIAL", System.Drawing.Color.Red, "Helvetica", EncodingType.Winansi, false, 48)); + stamp.IsBackground = true; // place stamp behind page content + stamp.Pages = evenPages; // apply only to even pages + + // Add the stamp to the document and finalize. + fileStamp.AddStamp(stamp); + fileStamp.Close(); // saves the output file + + Console.WriteLine($"Stamp applied to even pages. Output saved to '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/apply-text-stamp-to-even-pages.cs b/facades-stamps/apply-text-stamp-to-even-pages.cs deleted file mode 100644 index 1cf233f7e..000000000 --- a/facades-stamps/apply-text-stamp-to-even-pages.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; -using Aspose.Pdf.Text; - -class Program -{ - static void Main() - { - const string inputPdf = "input.pdf"; - const string outputPdf = "output_even_pages.pdf"; - - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input file not found: {inputPdf}"); - return; - } - - // Load the document to determine the total number of pages. - using (Document doc = new Document(inputPdf)) - { - int pageCount = doc.Pages.Count; // 1‑based indexing - - // Build an array containing only the even page numbers. - int evenCount = pageCount / 2; - int[] evenPages = new int[evenCount]; - int idx = 0; - for (int i = 2; i <= pageCount; i += 2) - { - evenPages[idx++] = i; - } - - // Create a text stamp that will be applied to the even pages. - FormattedText ft = new FormattedText( - "Even Page Aspose.Pdf.Facades.Stamp", // text - System.Drawing.Color.Gray, // text color (System.Drawing.Color is required here) - "Helvetica", // font name - EncodingType.Winansi, // encoding - false, // embed font - 36); // font size - - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindLogo(ft); // bind the formatted text to the stamp - stamp.IsBackground = true; // place the stamp behind page content - stamp.Pages = evenPages; // restrict stamping to even pages only - - // Apply the stamp using PdfFileStamp facade. - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.BindPdf(inputPdf); // load source PDF - fileStamp.AddStamp(stamp); // add the configured stamp - fileStamp.Save(outputPdf); // write result - fileStamp.Close(); // release resources - } - - Console.WriteLine($"Aspose.Pdf.Facades.Stamp applied to even pages. Output saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/apply-text-stamp-to-specific-pdf-pages.cs b/facades-stamps/apply-text-stamp-to-specific-pdf-pages.cs index c1e7e6dea..9bd8ba0b1 100644 --- a/facades-stamps/apply-text-stamp-to-specific-pdf-pages.cs +++ b/facades-stamps/apply-text-stamp-to-specific-pdf-pages.cs @@ -1,58 +1,41 @@ using System; using System.IO; -using Aspose.Pdf.Facades; // Facade APIs for stamping -using Aspose.Pdf; // Core PDF types (Document, Page, etc.) -using Aspose.Pdf.Text; // For FormattedText (requires System.Drawing.Color) +using System.Drawing; // System.Drawing.Color for FormattedText +using Aspose.Pdf.Facades; // PdfFileMend, FormattedText, EncodingType -// Apply a text stamp only on pages 1, 5 and 10 of an existing PDF. class Program { static void Main() { - const string inputPdf = "input.pdf"; - const string outputPdf = "stamped_output.pdf"; + const string inputPath = "input.pdf"; + const string outputPath = "stamped_output.pdf"; - if (!File.Exists(inputPdf)) + if (!File.Exists(inputPath)) { - Console.Error.WriteLine($"Input file not found: {inputPdf}"); + Console.Error.WriteLine($"Input file not found: {inputPath}"); return; } - // Initialize the PdfFileStamp facade. - using (PdfFileStamp fileStamp = new PdfFileStamp()) - { - // Bind the source PDF file. - fileStamp.BindPdf(inputPdf); - - // Create a text stamp using FormattedText. - // Note: FormattedText constructor requires System.Drawing.Color. - FormattedText ft = new FormattedText( - "CONFIDENTIAL", // Text to display - System.Drawing.Color.Red, // Text color - "Helvetica", // Font name - EncodingType.Winansi, // Encoding - false, // Embedded flag - 36); // Font size - - // Create the stamp object (fully qualified to avoid ambiguity). - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindLogo(ft); // Attach the formatted text. - stamp.IsBackground = true; // Render behind page content. - stamp.Opacity = 0.5f; // Semi‑transparent. - - // Restrict the stamp to pages 1, 5 and 10. - stamp.Pages = new int[] { 1, 5, 10 }; - - // Add the configured stamp to the PDF. - fileStamp.AddStamp(stamp); - - // Save the result. The Save method writes the output file. - fileStamp.Save(outputPdf); - - // Close releases resources (optional because of using). - fileStamp.Close(); - } - - Console.WriteLine($"Stamp applied to pages 1, 5, 10. Output saved as '{outputPdf}'."); + // Prepare the formatted text (watermark) – use System.Drawing.Color and a float font size. + FormattedText formattedText = new FormattedText( + "CONFIDENTIAL", // text + Color.Red, // System.Drawing.Color + "Helvetica", // font name + EncodingType.Winansi, // encoding + false, // embed font? + 36f); // font size (float) + + // Pages that should receive the stamp. + int[] targetPages = { 1, 5, 10 }; + + // Use PdfFileMend (not PdfFileStamp) to add the text to the selected pages. + PdfFileMend mend = new PdfFileMend(); + mend.BindPdf(inputPath); + // AddText overload: (FormattedText, int[] pages, float llx, float lly, float urx, float ury) + mend.AddText(formattedText, targetPages, 100f, 500f, 300f, 550f); + mend.Save(outputPath); + mend.Close(); + + Console.WriteLine($"Text stamp applied to pages 1,5,10. Output saved to '{outputPath}'."); } -} \ No newline at end of file +} diff --git a/facades-stamps/apply-text-watermark-all-pdf-pages.cs b/facades-stamps/apply-text-watermark-all-pdf-pages.cs deleted file mode 100644 index b74148605..000000000 --- a/facades-stamps/apply-text-watermark-all-pdf-pages.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - const string inputPath = "input.pdf"; - const string outputPath = "stamped_output.pdf"; - - if (!File.Exists(inputPath)) - { - Console.Error.WriteLine($"Input file not found: {inputPath}"); - return; - } - - // Create a text stamp (watermark) - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - - // FormattedText constructor sets text, color, font, encoding, embed flag, and size - FormattedText ft = new FormattedText( - "CONFIDENTIAL", // text - System.Drawing.Color.Red, // text color - "Helvetica", // font name - EncodingType.Winansi, // encoding - false, // embed font - 48); // font size - - stamp.BindLogo(ft); // bind the text to the stamp - stamp.IsBackground = true; // place stamp behind page content - stamp.Opacity = 0.5f; // semi‑transparent - stamp.Pages = null; // null means all pages will be affected - - // Apply the stamp to the whole document using the Facades API - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.BindPdf(inputPath); // load source PDF - fileStamp.AddStamp(stamp); // add the configured stamp - fileStamp.Save(outputPath); // write result - fileStamp.Close(); // release resources - - Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/apply-translucent-text-watermark.cs b/facades-stamps/apply-translucent-text-watermark.cs new file mode 100644 index 000000000..305a25b74 --- /dev/null +++ b/facades-stamps/apply-translucent-text-watermark.cs @@ -0,0 +1,56 @@ +using System; +using System.IO; +using System.Text; +using System.Drawing; // System.Drawing.Color is required for FormattedText +using Aspose.Pdf.Facades; // Facade API for stamping + +class Program +{ + static void Main() + { + const string inputPdf = "input.pdf"; // source PDF + const string outputPdf = "output.pdf"; // destination PDF + + if (!File.Exists(inputPdf)) + { + Console.Error.WriteLine($"File not found: {inputPdf}"); + return; + } + + // Initialize the PdfFileStamp facade and bind the source PDF + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(inputPdf); // load source document + + // Create a text stamp (watermark) using FormattedText. + // FormattedText constructor requires System.Drawing.Color for the text color. + FormattedText ft = new FormattedText( + "CONFIDENTIAL", // watermark text + Color.Red, // text color + "Helvetica", // font name + EncodingType.Winansi, // encoding + false, // embed font? + 48); // font size + + // Create the stamp object (fully qualified to avoid ambiguity) + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + + // Bind the formatted text to the stamp + stamp.BindLogo(ft); + + // Set the stamp to appear as a background (behind page content) + stamp.IsBackground = true; + + // Set opacity to 50% (0.5). Property type is float. + stamp.Opacity = 0.5f; + + // By default, Pages = null means the stamp is applied to all pages. + // Add the stamp to the document. + fileStamp.AddStamp(stamp); + + // Save the result and release resources. + fileStamp.Save(outputPdf); + fileStamp.Close(); + + Console.WriteLine($"Translucent watermark applied. Output saved to '{outputPdf}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/apply-translucent-watermark-to-pdf.cs b/facades-stamps/apply-translucent-watermark-to-pdf.cs deleted file mode 100644 index f0ca84acb..000000000 --- a/facades-stamps/apply-translucent-watermark-to-pdf.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - const string inputPath = "input.pdf"; - const string outputPath = "output.pdf"; - - if (!File.Exists(inputPath)) - { - Console.Error.WriteLine($"Input file not found: {inputPath}"); - return; - } - - // Initialize PdfFileStamp facade and specify input/output files - using (PdfFileStamp fileStamp = new PdfFileStamp()) - { - fileStamp.InputFile = inputPath; - fileStamp.OutputFile = outputPath; - - // Create a stamp with 50% opacity (translucent watermark) - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp - { - Opacity = 0.5f, // 0.0 (fully transparent) to 1.0 (opaque) - IsBackground = true // place stamp behind page content - }; - - // Define watermark text using FormattedText (requires System.Drawing.Color) - FormattedText watermark = new FormattedText( - "CONFIDENTIAL", // text - System.Drawing.Color.LightGray, // text color - "Helvetica", // font name - EncodingType.Winansi, // encoding - false, // embed font - 48); // font size - - // Bind the text to the stamp - stamp.BindLogo(watermark); - - // Apply the stamp to all pages - fileStamp.AddStamp(stamp); - - // Close the facade to finalize the output file - fileStamp.Close(); - } - - Console.WriteLine($"Translucent watermark applied. Output saved to '{outputPath}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/batch-add-multi-line-watermark-to-pdfs.cs b/facades-stamps/batch-add-multi-line-watermark-to-pdfs.cs index 2d27cdb09..18b55d8e7 100644 --- a/facades-stamps/batch-add-multi-line-watermark-to-pdfs.cs +++ b/facades-stamps/batch-add-multi-line-watermark-to-pdfs.cs @@ -1,76 +1,66 @@ using System; using System.IO; -using Aspose.Pdf.Facades; // PdfFileStamp, Stamp, FormattedText, EncodingType +using System.Drawing; // System.Drawing.Color, System.Drawing.Rectangle +using Aspose.Pdf; // Aspose.Pdf.Color, Aspose.Pdf.Rectangle, etc. +using Aspose.Pdf.Facades; // PdfFileStamp, Stamp, FormattedText, EncodingType class Program { - static void Main(string[] args) + static void Main() { - // Input folder (first argument) and output folder (second argument) – defaults if not supplied - string inputFolder = args.Length > 0 ? args[0] : "InputPdfs"; - string outputFolder = args.Length > 1 ? args[1] : "WatermarkedPdfs"; + // Folder containing source PDFs + const string inputFolder = "input_pdfs"; + // Folder where watermarked PDFs will be written + const string outputFolder = "output_pdfs"; - // Ensure both directories exist (create if missing) if (!Directory.Exists(inputFolder)) { - Console.WriteLine($"Input folder '{inputFolder}' does not exist. Creating it…"); - Directory.CreateDirectory(inputFolder); - Console.WriteLine("Place PDF files into the input folder and re‑run the program."); - return; // nothing to process yet + Console.Error.WriteLine($"Input folder not found: {inputFolder}"); + return; } + + // Ensure the output directory exists Directory.CreateDirectory(outputFolder); - // Process every PDF file in the input folder - string[] pdfFiles = Directory.GetFiles(inputFolder, "*.pdf"); - if (pdfFiles.Length == 0) - { - Console.WriteLine($"No PDF files found in '{inputFolder}'." ); - return; - } + // Multi‑line watermark text + string watermarkText = "CONFIDENTIAL\nDo Not Distribute"; - foreach (string sourcePath in pdfFiles) - { - string fileName = Path.GetFileNameWithoutExtension(sourcePath); - string destPath = Path.Combine(outputFolder, fileName + "_watermarked.pdf"); + // Create a FormattedText object that defines the watermark appearance + // NOTE: use System.Drawing.Color for the color argument and a float for the font size + Aspose.Pdf.Facades.FormattedText ft = new Aspose.Pdf.Facades.FormattedText( + watermarkText, // text (supports line breaks) + System.Drawing.Color.Red, // text color (System.Drawing.Color) + "Helvetica", // font name + Aspose.Pdf.Facades.EncodingType.Winansi, // text encoding + false, // embed font flag + 48f); // font size (float) - AddMultiLineWatermark(sourcePath, destPath); - } + // Process each PDF file in the input folder + foreach (string inputPath in Directory.GetFiles(inputFolder, "*.pdf")) + { + string fileNameWithoutExt = Path.GetFileNameWithoutExtension(inputPath); + string outputPath = Path.Combine(outputFolder, $"{fileNameWithoutExt}_watermarked.pdf"); - Console.WriteLine("Batch watermarking completed."); - } + // Initialize the PdfFileStamp facade and bind the source PDF + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(inputPath); // loads the PDF to be stamped - // Adds the same multi‑line text watermark to all pages of a PDF file - static void AddMultiLineWatermark(string sourcePdf, string outputPdf) - { - // Create multi‑line formatted text (uses System.Drawing.Color as required by FormattedText) - FormattedText watermarkText = new FormattedText( - "CONFIDENTIAL\nDo Not Distribute", // two lines separated by newline - System.Drawing.Color.Red, // text color - "Helvetica", // font name - EncodingType.Winansi, // encoding - false, // embed font flag - 36); // font size + // Configure the stamp (watermark) + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + stamp.BindLogo(ft); // use the formatted text as the stamp content + stamp.IsBackground = true; // place the watermark behind page content + stamp.Opacity = 0.5f; // semi‑transparent appearance + // Optional: adjust position; (0,0) is bottom‑left of the page + stamp.SetOrigin(0, 0); - // Configure the stamp that will carry the formatted text - Stamp stamp = new Stamp(); - stamp.BindLogo(watermarkText); // attach the text to the stamp - stamp.IsBackground = true; // render behind page content - stamp.Opacity = 0.5f; // semi‑transparent - stamp.SetOrigin(100, 400); // position of the watermark on each page - stamp.Pages = null; // apply to all pages (null means every page) + // Add the stamp to the document (applies to all pages by default) + fileStamp.AddStamp(stamp); - // Use PdfFileStamp facade to apply the stamp - PdfFileStamp fileStamp = new PdfFileStamp(); - try - { - fileStamp.BindPdf(sourcePdf); // load source PDF - fileStamp.AddStamp(stamp); // add the configured stamp - fileStamp.Save(outputPdf); // write the watermarked PDF - } - finally - { - // Close releases resources; PdfFileStamp does not implement IDisposable + // Save the watermarked PDF and release resources + fileStamp.Save(outputPath); fileStamp.Close(); + + Console.WriteLine($"Watermarked: {inputPath} → {outputPath}"); } } } diff --git a/facades-stamps/batch-add-rotated-image-stamp-to-first-page.cs b/facades-stamps/batch-add-rotated-image-stamp-to-first-page.cs new file mode 100644 index 000000000..4928ab62b --- /dev/null +++ b/facades-stamps/batch-add-rotated-image-stamp-to-first-page.cs @@ -0,0 +1,57 @@ +using System; +using System.IO; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + // Directory containing the PDFs to process + string inputDirectory = @"C:\PdfFolder"; + // Directory where stamped PDFs will be saved + string outputDirectory = Path.Combine(inputDirectory, "Stamped"); + Directory.CreateDirectory(outputDirectory); + + // Get all PDF files in the input directory + string[] pdfFiles = Directory.GetFiles(inputDirectory, "*.pdf"); + + foreach (string pdfPath in pdfFiles) + { + // Build output file name (original name with "_stamped" suffix) + string fileNameWithoutExt = Path.GetFileNameWithoutExtension(pdfPath); + string outputPath = Path.Combine(outputDirectory, fileNameWithoutExt + "_stamped.pdf"); + + // Initialize the PdfFileStamp facade (does NOT implement IDisposable) + PdfFileStamp fileStamp = new PdfFileStamp(); + + // Bind the source PDF file + fileStamp.BindPdf(pdfPath); + + // Create a stamp object + Stamp stamp = new Stamp(); + + // Bind an image to be used as the stamp (provide a valid image path) + stamp.BindImage("stampImage.png"); + + // Rotate the stamp by the desired angle (e.g., 45 degrees) + stamp.Rotation = 45f; + + // Apply the stamp only to the first page + stamp.Pages = new int[] { 1 }; + + // Optionally place the stamp behind page content + stamp.IsBackground = true; + + // Add the configured stamp to the PDF + fileStamp.AddStamp(stamp); + + // Save the stamped PDF to the output path + fileStamp.Save(outputPath); + + // Close the facade to release resources + fileStamp.Close(); + } + + Console.WriteLine("Batch stamping completed."); + } +} \ No newline at end of file diff --git a/facades-stamps/batch-add-rotated-image-stamp.cs b/facades-stamps/batch-add-rotated-image-stamp.cs deleted file mode 100644 index 5c66290e2..000000000 --- a/facades-stamps/batch-add-rotated-image-stamp.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main(string[] args) - { - // Expect two arguments: input folder and output folder. - if (args.Length < 2) - { - Console.Error.WriteLine("Usage: BatchStamp "); - return; - } - - string inputFolder = args[0]; - string outputFolder = args[1]; - - if (!Directory.Exists(inputFolder)) - { - Console.Error.WriteLine($"Input folder does not exist: {inputFolder}"); - return; - } - - Directory.CreateDirectory(outputFolder); - - // Path to the image that will be used as a stamp. - const string stampImagePath = "stamp.png"; - - if (!File.Exists(stampImagePath)) - { - Console.Error.WriteLine($"Stamp image not found: {stampImagePath}"); - return; - } - - // Process each PDF file in the input folder. - foreach (string pdfPath in Directory.GetFiles(inputFolder, "*.pdf")) - { - string fileName = Path.GetFileName(pdfPath); - string outputPath = Path.Combine(outputFolder, fileName); - - try - { - // Initialize the facade. - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.InputFile = pdfPath; - fileStamp.OutputFile = outputPath; - - // Create a stamp, bind the image, set its position, size and rotation. - Stamp stamp = new Stamp(); - stamp.BindImage(stampImagePath); - stamp.SetOrigin(100, 500); // Position (X, Y) from the lower‑left corner. - stamp.SetImageSize(150, 150); // Width and height of the image. - stamp.Rotation = 45; // Rotate 45 degrees. - stamp.Pages = new int[] { 1 }; // Apply only to the first page. - - // Add the stamp to the document and finalize. - fileStamp.AddStamp(stamp); - fileStamp.Close(); - - Console.WriteLine($"Stamped: {fileName}"); - } - catch (Exception ex) - { - Console.Error.WriteLine($"Error processing '{fileName}': {ex.Message}"); - } - } - } -} \ No newline at end of file diff --git a/facades-stamps/batch-apply-rotated-pdf-stamp.cs b/facades-stamps/batch-apply-rotated-pdf-stamp.cs index a1dd3d4b9..10310e34f 100644 --- a/facades-stamps/batch-apply-rotated-pdf-stamp.cs +++ b/facades-stamps/batch-apply-rotated-pdf-stamp.cs @@ -6,61 +6,60 @@ class Program { static void Main() { - // UNC paths to the source PDFs, the stamp PDF, and the output folder - const string sourceFolder = @"\\NetworkShare\PdfFiles"; - const string stampPdfPath = @"\\NetworkShare\Stamp\stamp.pdf"; - const string outputFolder = @"\\NetworkShare\StampedPdfFiles"; + // Network locations – adjust as needed + const string inputFolder = @"\\Server\Share\PDFs"; + const string outputFolder = @"\\Server\Share\StampedPDFs"; + const string stampPdfPath = @"\\Server\Share\Stamp\stamp.pdf"; - // Ensure the output directory exists - try - { - Directory.CreateDirectory(outputFolder); - } - catch (Exception ex) - { - Console.Error.WriteLine($"Failed to create output folder '{outputFolder}': {ex.Message}"); - return; - } + // Stamp configuration + const int stampPageNumber = 1; // page in the stamp PDF to use + const float rotationDegrees = 45f; // desired rotation angle - // Retrieve all PDF files from the source folder - string[] pdfFiles; - try + // Validate folders + if (!Directory.Exists(inputFolder)) { - pdfFiles = Directory.GetFiles(sourceFolder, "*.pdf"); - } - catch (Exception ex) - { - Console.Error.WriteLine($"Failed to enumerate PDF files in '{sourceFolder}': {ex.Message}"); + Console.Error.WriteLine($"Input folder not found: {inputFolder}"); return; } + Directory.CreateDirectory(outputFolder); - foreach (string inputPath in pdfFiles) + // Process each PDF in the network share + string[] pdfFiles = Directory.GetFiles(inputFolder, "*.pdf"); + foreach (string sourcePath in pdfFiles) { - string fileName = Path.GetFileNameWithoutExtension(inputPath); - string outputPath = Path.Combine(outputFolder, $"{fileName}_stamped.pdf"); + string fileName = Path.GetFileName(sourcePath); + string targetPath = Path.Combine(outputFolder, fileName); try { // Initialise the facade for stamping - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.InputFile = inputPath; // source PDF - fileStamp.OutputFile = outputPath; // destination PDF + Aspose.Pdf.Facades.PdfFileStamp fileStamp = new Aspose.Pdf.Facades.PdfFileStamp(); + + // Bind the source PDF document + fileStamp.BindPdf(sourcePath); + + // Create a stamp from a page of another PDF + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + stamp.BindPdf(stampPdfPath, stampPageNumber); + stamp.Rotation = rotationDegrees; // rotate the stamp (degrees) - // Create a stamp that uses the first page of another PDF - Stamp stamp = new Stamp(); - stamp.BindPdf(stampPdfPath, 1); // bind page 1 of the stamp PDF - stamp.Rotation = 45f; // rotate the stamp (degrees) - stamp.IsBackground = true; // place stamp behind page content + // Apply the stamp to all pages (null means every page) + stamp.Pages = null; - // Apply the stamp to all pages of the source document + // Add the configured stamp to the document fileStamp.AddStamp(stamp); - fileStamp.Close(); // saves the output file - Console.WriteLine($"Stamped file saved: {outputPath}"); + // Save the stamped PDF to the output location + fileStamp.Save(targetPath); + + // Release resources held by the facade + fileStamp.Close(); + + Console.WriteLine($"Stamped PDF saved: {targetPath}"); } catch (Exception ex) { - Console.Error.WriteLine($"Error processing '{inputPath}': {ex.Message}"); + Console.Error.WriteLine($"Error processing '{sourcePath}': {ex.Message}"); } } } diff --git a/facades-stamps/combine-image-text-pdf-stamp.cs b/facades-stamps/combine-image-text-pdf-stamp.cs index c1fc24a1f..1f202ed35 100644 --- a/facades-stamps/combine-image-text-pdf-stamp.cs +++ b/facades-stamps/combine-image-text-pdf-stamp.cs @@ -2,62 +2,65 @@ using System.IO; using Aspose.Pdf; using Aspose.Pdf.Facades; -using System.Drawing; // Required for System.Drawing.Color +using Aspose.Pdf.Text; // for FormattedText and EncodingType class Program { static void Main() { - const string inputPdf = "input.pdf"; + // Paths for the source PDF, logo image and the output PDF + const string inputPdf = "input.pdf"; + const string logoImage = "logo.png"; const string outputPdf = "output.pdf"; - const string logoPath = "logo.png"; - const string customText = "Confidential"; - // Validate input files + // Verify that required files exist if (!File.Exists(inputPdf)) { Console.Error.WriteLine($"Input PDF not found: {inputPdf}"); return; } - if (!File.Exists(logoPath)) + if (!File.Exists(logoImage)) { - Console.Error.WriteLine($"Logo image not found: {logoPath}"); + Console.Error.WriteLine($"Logo image not found: {logoImage}"); return; } - // Bind the source PDF + // Create a PdfFileStamp facade and specify input/output files PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.BindPdf(inputPdf); + fileStamp.InputFile = inputPdf; + fileStamp.OutputFile = outputPdf; - // Create a stamp that will contain both an image and text - // Fully qualify the Stamp type to avoid ambiguity between Aspose.Pdf.Stamp and Aspose.Pdf.Facades.Stamp + // Create a Aspose.Pdf.Facades.Stamp object that will hold both image and text Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); // ----- Image part ----- - stamp.BindImage(logoPath); // Set the logo image - stamp.SetImageSize(50, 50); // Width & height (points) - stamp.SetOrigin(100, 700); // Position on the page (X, Y) + // Bind the logo image to the stamp + stamp.BindImage(logoImage); + // Position the image (origin) and set its size + stamp.SetOrigin(100, 700); // X, Y coordinates (bottom‑left origin) + stamp.SetImageSize(100, 100); // Width, Height in points + stamp.Opacity = 0.9f; // Slightly transparent + stamp.IsBackground = false; // Draw on top of page content // ----- Text part ----- - // Create FormattedText with the desired content, color, font, encoding, embed flag and size - FormattedText formattedText = new FormattedText( - customText, // Text to display - System.Drawing.Color.Black, // Text color (System.Drawing.Color) + // Create formatted text for the custom caption + FormattedText ft = new FormattedText( + "Confidential Document", // Text + System.Drawing.Color.Red, // Text color (System.Drawing.Color is required) "Helvetica", // Font name - EncodingType.Winansi, - false, // Embedded flag - 24f); // Font size (float) + EncodingType.Winansi, // Encoding + false, // Embedded flag + 24); // Font size - // Bind the formatted text to the same stamp (this is the correct way; there is no 'Text' property) - stamp.BindLogo(formattedText); + // Bind the formatted text to the same stamp + stamp.BindLogo(ft); - // Add the combined stamp to the document (applies to all pages) + // Add the combined stamp to the PDF file fileStamp.AddStamp(stamp); - // Save the stamped PDF - fileStamp.Save(outputPdf); + // Close the facade to finalize and write the output PDF fileStamp.Close(); - Console.WriteLine($"Stamped PDF saved to '{outputPdf}'."); + Console.WriteLine($"Aspose.Pdf.Facades.Stamp with image and text saved to '{outputPdf}'."); } -} +} \ No newline at end of file diff --git a/facades-stamps/combine-multiple-pdfs-into-multi-page-stamp.cs b/facades-stamps/combine-multiple-pdfs-into-multi-page-stamp.cs new file mode 100644 index 000000000..fa51ba16d --- /dev/null +++ b/facades-stamps/combine-multiple-pdfs-into-multi-page-stamp.cs @@ -0,0 +1,67 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; +using Aspose.Pdf.Text; + +class Program +{ + static void Main() + { + // --------------------------------------------------------------------- + // 1. Create sample stamp PDFs (stamp1.pdf, stamp2.pdf, stamp3.pdf). + // --------------------------------------------------------------------- + string[] stampSources = { "stamp1.pdf", "stamp2.pdf", "stamp3.pdf" }; + for (int i = 0; i < stampSources.Length; i++) + { + using (Document doc = new Document()) + { + Page page = doc.Pages.Add(); + page.Paragraphs.Add(new TextFragment($"Stamp page {i + 1}")); + doc.Save(stampSources[i]); + } + } + + // --------------------------------------------------------------------- + // 2. Create the target PDF that will receive the stamp. + // --------------------------------------------------------------------- + string targetPdfPath = "target.pdf"; + using (Document targetDoc = new Document()) + { + Page page = targetDoc.Pages.Add(); + page.Paragraphs.Add(new TextFragment("Target PDF page 1")); + targetDoc.Save(targetPdfPath); + } + + // --------------------------------------------------------------------- + // 3. Combine the stamp PDFs into a single multi‑page PDF. + // --------------------------------------------------------------------- + string combinedStampPath = "combinedStamp.pdf"; + PdfFileEditor editor = new PdfFileEditor(); + editor.Concatenate(stampSources, combinedStampPath); + + // --------------------------------------------------------------------- + // 4. Prepare the PdfFileStamp facade for the target document. + // --------------------------------------------------------------------- + string outputPdfPath = "targetStamped.pdf"; + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(targetPdfPath); + + // --------------------------------------------------------------------- + // 5. Create a Stamp object bound to the first page of the combined PDF. + // --------------------------------------------------------------------- + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + stamp.BindPdf(combinedStampPath, 1); // first page of combined stamp PDF + stamp.IsBackground = true; // place behind existing content + stamp.Pages = null; // apply to all pages of the target PDF + + // --------------------------------------------------------------------- + // 6. Apply the stamp and save the result. + // --------------------------------------------------------------------- + fileStamp.AddStamp(stamp); + fileStamp.Save(outputPdfPath); + fileStamp.Close(); + + Console.WriteLine($"Stamped PDF saved to '{outputPdfPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/create-multi-page-pdf-stamp.cs b/facades-stamps/create-multi-page-pdf-stamp.cs deleted file mode 100644 index 2c1066a06..000000000 --- a/facades-stamps/create-multi-page-pdf-stamp.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - // Paths for the target PDF, the output PDF and the stamp PDFs - const string inputPdf = "input.pdf"; - const string outputPdf = "output.pdf"; - string[] stampPdfs = { "stamp1.pdf", "stamp2.pdf", "stamp3.pdf" }; - - // Validate existence of files - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input file not found: {inputPdf}"); - return; - } - - foreach (string sp in stampPdfs) - { - if (!File.Exists(sp)) - { - Console.Error.WriteLine($"Stamp file not found: {sp}"); - return; - } - } - - // Initialize the facade and bind the target document - Aspose.Pdf.Facades.PdfFileStamp fileStamp = new Aspose.Pdf.Facades.PdfFileStamp(); - try - { - // Bind the source PDF that will receive the stamps - fileStamp.BindPdf(inputPdf); - - // Create a stamp for each PDF file and add it to the facade - foreach (string stampPath in stampPdfs) - { - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - - // Use the first page of the stamp PDF as the stamp content - stamp.BindPdf(stampPath, 1); - - // Place the stamp behind existing page content - stamp.IsBackground = true; - - // Optional: set origin (lower‑left corner) and other properties - stamp.SetOrigin(0, 0); - // stamp.SetImageSize(width, height); - // stamp.Opacity = 0.8f; - - // Add the configured stamp to the file stamp object - fileStamp.AddStamp(stamp); - } - - // Save the resulting PDF with all stamps applied - fileStamp.Save(outputPdf); - } - finally - { - // Ensure resources are released and the output file is finalized - fileStamp.Close(); - } - - Console.WriteLine($"Multi‑page stamp applied. Output saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/custom-font-stamp-branding.cs b/facades-stamps/custom-font-stamp-branding.cs index 31f15887b..6d9c614e9 100644 --- a/facades-stamps/custom-font-stamp-branding.cs +++ b/facades-stamps/custom-font-stamp-branding.cs @@ -2,8 +2,8 @@ using System.IO; using Aspose.Pdf; using Aspose.Pdf.Facades; -using Aspose.Pdf.Text; // FontRepository, Font, FontTypes -using System.Drawing; // Color +using Aspose.Pdf.Text; +using System.Drawing; // for System.Drawing.Color class Program { @@ -11,44 +11,48 @@ static void Main() { const string inputPdfPath = "input.pdf"; const string outputPdfPath = "output_branded.pdf"; - const string fontName = "Arial"; // system‑installed TrueType font - const string stampText = "My Brand"; + const string fontFilePath = "MyBrandFont.ttf"; + const string stampText = "MyBrand"; - // 1. Create a minimal source PDF because the sandbox has no files. - using (Document seed = new Document()) + if (!File.Exists(inputPdfPath)) { - seed.Pages.Add(); // add a blank page - seed.Save(inputPdfPath); + Console.Error.WriteLine($"Input PDF not found: {inputPdfPath}"); + return; + } + if (!File.Exists(fontFilePath)) + { + Console.Error.WriteLine($"Font file not found: {fontFilePath}"); + return; } - // 2. Resolve the font name. FindFont returns a Font object; we only need the name. - // This avoids the overload that expects a Stream. - Aspose.Pdf.Text.Font customFont = FontRepository.FindFont(fontName); - - // 3. Prepare the stamp using the loaded font. - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.BindPdf(inputPdfPath); + // Load the custom TrueType font so Aspose recognises it. + Aspose.Pdf.Text.Font customFont = FontRepository.OpenFont(fontFilePath); + // The font name used in the PDF – usually the file name without extension. + string fontName = Path.GetFileNameWithoutExtension(fontFilePath); - // FormattedText expects the font name; the font is already resolved above. + // FormattedText expects System.Drawing.Color, not Aspose.Pdf.Color. Aspose.Pdf.Facades.FormattedText formattedText = new Aspose.Pdf.Facades.FormattedText( stampText, // text to display - System.Drawing.Color.Black, // text color - fontName, // font name (must match the loaded font) + System.Drawing.Color.Black, // text colour + fontName, // font name (must match the TTF family name) Aspose.Pdf.Facades.EncodingType.Winansi, - false, // do not embed via this flag (font already loaded) - 48f); // font size + true, // embed the font in the PDF + 48f); // font size (float) + // Create a stamp and bind the formatted text. Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); stamp.BindLogo(formattedText); - stamp.SetOrigin(100, 500); // position (bottom‑left corner) - stamp.Opacity = 0.5f; // semi‑transparent - stamp.IsBackground = true; // render behind page content - - // 4. Apply the stamp and save the result. - fileStamp.AddStamp(stamp); - fileStamp.Save(outputPdfPath); - fileStamp.Close(); - - Console.WriteLine($"Stamped PDF saved to '{outputPdfPath}'."); + stamp.IsBackground = false; // place on top of page content + stamp.Opacity = 0.7f; // semi‑transparent + stamp.SetOrigin(100, 700); // position (X, Y) in points + + // Use the modern facade API (BindPdf / Save) instead of the obsolete properties. + Aspose.Pdf.Facades.PdfFileStamp pdfStamp = new Aspose.Pdf.Facades.PdfFileStamp(); + pdfStamp.BindPdf(inputPdfPath); + pdfStamp.AddStamp(stamp); + pdfStamp.Save(outputPdfPath); + pdfStamp.Close(); + + Console.WriteLine($"Branded PDF saved to '{outputPdfPath}'."); } } diff --git a/facades-stamps/index.json b/facades-stamps/index.json index 39b2e7830..190e589c8 100644 --- a/facades-stamps/index.json +++ b/facades-stamps/index.json @@ -1,35 +1,37 @@ { "category": "facades-stamps", - "nuget_version": "26.7.0", - "last_updated": "2026-07-18T01:12:46Z", + "nuget_version": "26.8.0", + "last_updated": "2026-08-20T08:03:52Z", "examples": { - "add-multi-line-text-watermark-pdf": { - "title": "Add Multi-Line Text Watermark to PDF", - "filename": "add-multi-line-text-watermark-pdf.cs", - "description": "Shows how to create a multi-line text watermark and add it as a header on every page of a PDF using Aspose.Pdf's PdfFileStamp facade.", + "add-multi-line-text-watermark-facade": { + "title": "Add Multi-Line Text Watermark to PDF using Facades", + "filename": "add-multi-line-text-watermark-facade.cs", + "description": "Shows how to create a multi-line text watermark with Aspose.Pdf.Facades by using FormattedText, adding extra lines via AddNewLineText, and applying it as a background stamp to all pages of a PDF.", "tags": [ "watermark", - "multiline", + "formattedtext", + "stamp", "pdf", - "header", - "Aspose.Pdf" + "facades" ], "apis_used": [ - "PdfFileStamp.BindPdf", - "PdfFileStamp.AddHeader", - "PdfFileStamp.Save", - "PdfFileStamp.Close", + "PdfFileStamp", "FormattedText", - "FormattedText.AddNewLineText" + "FormattedText.AddNewLineText", + "Stamp", + "Stamp.BindLogo", + "Stamp.IsBackground", + "PdfFileStamp.AddStamp", + "PdfFileStamp.Save" ], - "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "difficulty": "intermediate", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "rotate-text-stamp-45-degrees": { "title": "Rotate Text Stamp 45 Degrees in PDF", "filename": "rotate-text-stamp-45-degrees.cs", - "description": "Demonstrates creating a TextStamp, setting its rotation to 45 degrees around its center, and applying it to all pages of a PDF using Aspose.Pdf.", + "description": "Shows how to add a TextStamp to a PDF page and rotate it 45° around its centre using the RotateAngle property.", "tags": [ "text-stamp", "rotation", @@ -39,65 +41,68 @@ ], "apis_used": [ "Aspose.Pdf.Document", - "Aspose.Pdf.Page.AddStamp", + "Aspose.Pdf.Page", "Aspose.Pdf.Text.TextStamp", - "Aspose.Pdf.Text.FontRepository.FindFont", - "Aspose.Pdf.Color" + "Aspose.Pdf.Page.AddStamp", + "Aspose.Pdf.Document.Save" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "apply-pdf-page-stamp-as-background": { "title": "Apply PDF Page Stamp as Background to All Pages", "filename": "apply-pdf-page-stamp-as-background.cs", - "description": "Shows how to use Aspose.Pdf.Facades to bind a source PDF, create a background stamp from another PDF's first page, and apply it to every page of the document.", + "description": "Demonstrates how to use Aspose.Pdf.Facades to stamp every page of a PDF with the first page of another PDF, placing the stamp behind the existing content.", "tags": [ "pdf", "stamp", "background", "facade", - "Aspose.Pdf" + "Aspose" ], "apis_used": [ - "PdfFileStamp", + "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.Facades.Stamp", "PdfFileStamp.BindPdf", - "Stamp", "Stamp.BindPdf", "Stamp.IsBackground", "PdfFileStamp.AddStamp", "PdfFileStamp.Save" ], - "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "difficulty": "intermediate", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "apply-pdf-template-stamp-to-page": { - "title": "Apply PDF Template Stamp to Specific Page", - "filename": "apply-pdf-template-stamp-to-page.cs", - "description": "Shows how to use Aspose.Pdf.Facades.PdfFileStamp and Stamp to bind a page from an external template PDF and place it as a stamp on the third page of another PDF.", + "apply-external-pdf-template-stamp": { + "title": "Apply External PDF Template as Stamp on a Specific Page", + "filename": "apply-external-pdf-template-stamp.cs", + "description": "Shows how to create a PdfFileStamp from an external template PDF and apply it only to the third page of another PDF document.", "tags": [ "pdf", "stamp", "template", - "aspose", - "csharp" + "Aspose.Pdf", + "c#" ], "apis_used": [ "Aspose.Pdf.Facades.PdfFileStamp", "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.Stamp.BindPdf", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", - "Aspose.Pdf.Facades.PdfFileStamp.Close" + "PdfFileStamp.BindPdf", + "Stamp.BindPdf", + "Stamp.Pages", + "PdfFileStamp.AddStamp", + "PdfFileStamp.Save", + "PdfFileStamp.Close" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-lowercase-roman-page-numbers-to-odd-pages": { - "title": "Add Lowercase Roman Page Numbers to Odd Pages", - "filename": "add-lowercase-roman-page-numbers-to-odd-pages.cs", - "description": "Demonstrates how to add page numbers in lowercase Roman numerals to only the odd pages of a PDF using Aspose.Pdf's PageNumberStamp.", + "add-lower-roman-page-numbers-odd-pages": { + "title": "Add Lower‑Roman Page Numbers to Odd Pages", + "filename": "add-lower-roman-page-numbers-odd-pages.cs", + "description": "Demonstrates how to add page numbers in lower‑case Roman numerals to only the odd pages of a PDF using Aspose.Pdf's PageNumberStamp.", "tags": [ "page-number", "roman", @@ -109,17 +114,19 @@ "Aspose.Pdf.Document", "Aspose.Pdf.Text.PageNumberStamp", "Aspose.Pdf.Text.NumberingStyle", + "Aspose.Pdf.Text.FontRepository", "Aspose.Pdf.Page.AddStamp", - "Aspose.Pdf.Document.Save" + "Aspose.Pdf.Document.Save", + "Aspose.Pdf.Drawing.HorizontalAlignment" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "combine-image-text-pdf-stamp": { - "title": "Combine Image and Text in a PDF Stamp", + "title": "Combine Image and Text into a PDF Stamp", "filename": "combine-image-text-pdf-stamp.cs", - "description": "Demonstrates creating a stamp that contains both a logo image and formatted text, then applying the combined stamp to all pages of a PDF using Aspose.Pdf.Facades.", + "description": "Demonstrates creating a single stamp that contains a logo image and formatted text, then applying it to a PDF document using Aspose.Pdf.Facades.", "tags": [ "stamp", "image", @@ -131,520 +138,506 @@ "Aspose.Pdf.Facades.PdfFileStamp", "Aspose.Pdf.Facades.Stamp", "Aspose.Pdf.Facades.Stamp.BindImage", - "Aspose.Pdf.Facades.Stamp.SetImageSize", - "Aspose.Pdf.Facades.Stamp.SetOrigin", "Aspose.Pdf.Facades.Stamp.BindLogo", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", - "Aspose.Pdf.Facades.PdfFileStamp.Save" + "Aspose.Pdf.Text.FormattedText" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-header-stamp-to-all-pdf-pages": { + "add-header-stamp-to-pdf-pages": { "title": "Add Header Stamp to All PDF Pages", - "filename": "add-header-stamp-to-all-pdf-pages.cs", - "description": "Demonstrates iterating through a PDF document and adding a header stamp with a company name to each page using Aspose.Pdf.Facades.", + "filename": "add-header-stamp-to-pdf-pages.cs", + "description": "Shows how to load a PDF with Aspose.Pdf, iterate through its Pages collection, and add a centered header TextStamp containing a company name to each page.", "tags": [ "header", "stamp", "pdf", - "facade", - "iteration" + "aspose", + "csharp" ], "apis_used": [ - "Aspose.Pdf.Facades.PdfFileStamp", "Aspose.Pdf.Document", - "Aspose.Pdf.Text.FormattedText", - "Aspose.Pdf.Facades.Stamp", - "PdfFileStamp.BindPdf", - "Stamp.BindLogo", - "PdfFileStamp.AddStamp", - "PdfFileStamp.Save" + "Aspose.Pdf.Page", + "Aspose.Pdf.Text.TextStamp", + "Aspose.Pdf.Text.FontRepository.FindFont", + "Aspose.Pdf.Page.AddStamp", + "Aspose.Pdf.Document.Save" ], - "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "difficulty": "beginner", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-footer-date-stamp-to-last-page": { + "add-footer-date-stamp-to-last-pdf-page": { "title": "Add Footer Date Stamp to Last PDF Page", - "filename": "add-footer-date-stamp-to-last-page.cs", - "description": "Shows how to add a footer stamp with the current date (MM-dd-yyyy) to only the last page of a PDF using Aspose.Pdf.", + "filename": "add-footer-date-stamp-to-last-pdf-page.cs", + "description": "Demonstrates how to insert a footer stamp containing the current date (MM-dd-yyyy) on the last page of a PDF using Aspose.Pdf.", "tags": [ + "pdf", "footer", "stamp", "date", - "last-page", - "pdf" + "Aspose.Pdf" ], "apis_used": [ "Aspose.Pdf.Document", "Aspose.Pdf.Page", "Aspose.Pdf.Text.TextStamp", "Aspose.Pdf.FontRepository.FindFont", + "Aspose.Pdf.Color", "Aspose.Pdf.Page.AddStamp", "Aspose.Pdf.Document.Save" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "apply-rotating-text-stamps": { - "title": "Apply Rotating Text Stamps to PDF Pages", - "filename": "apply-rotating-text-stamps.cs", - "description": "Shows how to add a text stamp to each page of a PDF and rotate it differently per page using Aspose.Pdf.Facades.PdfFileStamp.", + "apply-rotating-stamps-to-pdf-pages": { + "title": "Apply Rotating Stamps to Each PDF Page", + "filename": "apply-rotating-stamps-to-pdf-pages.cs", + "description": "Demonstrates how to add a text stamp to every page of a PDF and rotate each stamp based on the page index using Aspose.Pdf.Facades.", "tags": [ + "pdf", "stamp", "rotation", - "pdf", "facade", - "text" + "aspose" ], "apis_used": [ "Aspose.Pdf.Document", "Aspose.Pdf.Facades.PdfFileStamp", "Aspose.Pdf.Facades.Stamp", "Aspose.Pdf.Facades.Stamp.BindLogo", + "Aspose.Pdf.Facades.Stamp.Rotation", "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", - "Aspose.Pdf.Facades.PdfFileStamp.Save", - "Aspose.Pdf.Text.FormattedText" + "Aspose.Pdf.Facades.PdfFileStamp.Close" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-background-image-watermark-to-specific-pdf-pages": { - "title": "Add Background Image Watermark to Specific PDF Pages", - "filename": "add-background-image-watermark-to-specific-pdf-pages.cs", - "description": "Demonstrates how to apply an image watermark as a background stamp to pages 2‑5 of a PDF using Aspose.Pdf.Facades.", + "add-background-watermark-to-specific-pdf-pages": { + "title": "Add Background Watermark to Specific PDF Pages", + "filename": "add-background-watermark-to-specific-pdf-pages.cs", + "description": "Demonstrates how to apply a light‑gray background watermark to pages 2‑5 of a PDF using Aspose.Pdf.Facades.", "tags": [ "watermark", "background", "pdf", - "stamp", - "Aspose.Pdf" + "Aspose.Pdf", + "pages" ], "apis_used": [ "Aspose.Pdf.Facades.PdfFileStamp", "Aspose.Pdf.Facades.Stamp", - "PdfFileStamp.BindPdf", - "Stamp.BindImage", - "Stamp.IsBackground", - "Stamp.Pages", - "PdfFileStamp.AddStamp", - "PdfFileStamp.Save" + "Aspose.Pdf.Facades.FormattedText", + "Aspose.Pdf.Facades.EncodingType", + "Aspose.Pdf.Facades.Stamp.BindLogo", + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "batch-add-multi-line-watermark-to-pdfs": { - "title": "Batch Add Multi-Line Watermark to PDFs", + "title": "Batch Add Multi‑Line Watermark to PDFs", "filename": "batch-add-multi-line-watermark-to-pdfs.cs", - "description": "Shows how to iterate through a folder of PDF files and apply the same multi-line text watermark to every page of each document using Aspose.Pdf.Facades.", + "description": "Demonstrates how to process all PDF files in a folder and apply the same multi‑line text watermark to each document using Aspose.Pdf facades.", "tags": [ "watermark", - "batch", "pdf", - "Aspose.Pdf", - "facade" + "batch", + "stamp", + "Aspose.Pdf" ], "apis_used": [ "Aspose.Pdf.Facades.PdfFileStamp", "Aspose.Pdf.Facades.Stamp", "Aspose.Pdf.Facades.FormattedText", - "Aspose.Pdf.Facades.EncodingType", - "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", - "Aspose.Pdf.Facades.PdfFileStamp.Save" + "PdfFileStamp.BindPdf", + "PdfFileStamp.AddStamp", + "PdfFileStamp.Save", + "Stamp.BindLogo", + "Stamp.SetOrigin" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "apply-pdf-stamp-preserve-filenames": { - "title": "Apply PDF Stamp and Preserve Original Filenames", - "filename": "apply-pdf-stamp-preserve-filenames.cs", - "description": "Demonstrates how to batch‑apply a PDF stamp to each document in a folder using Aspose.Pdf.Facades and save the stamped PDFs to a separate directory while keeping the original file names.", + "add-image-stamp-to-pdfs-preserve-filenames": { + "title": "Add Image Stamp to PDFs and Preserve Filenames", + "filename": "add-image-stamp-to-pdfs-preserve-filenames.cs", + "description": "Iterates over PDF files in a source folder, applies an image stamp to each page using the PdfFileStamp facade, and saves the stamped PDFs to a target folder while keeping the original file names.", "tags": [ "pdf", "stamp", - "facade", - "batch", - "aspose" + "image", + "aspose", + "facade" ], "apis_used": [ "Aspose.Pdf.Facades.PdfFileStamp", "Aspose.Pdf.Facades.Stamp", - "PdfFileStamp.InputFile", - "PdfFileStamp.OutputFile", - "PdfFileStamp.AddStamp", - "PdfFileStamp.Close", - "Stamp.BindPdf" + "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", + "Aspose.Pdf.Facades.Stamp.BindImage", + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", + "Aspose.Pdf.Facades.PdfFileStamp.Save" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "overlay-disclaimer-pdf-first-page": { - "title": "Overlay Disclaimer PDF on First Page Using PdfFileStamp", - "filename": "overlay-disclaimer-pdf-first-page.cs", - "description": "Shows how to use Aspose.Pdf.Facades.PdfFileStamp and Stamp to overlay a legal disclaimer PDF onto the first page of a target PDF document.", + "overlay-legal-disclaimer-with-pdffilestamp": { + "title": "Overlay Legal Disclaimer on First Page Using PdfFileStamp", + "filename": "overlay-legal-disclaimer-with-pdffilestamp.cs", + "description": "Shows how to apply a disclaimer PDF as a background stamp on the first page of multiple target PDFs using Aspose.Pdf's PdfFileStamp facade.", "tags": [ "pdf", "stamp", "disclaimer", - "overlay", - "aspose" + "aspose", + "facade" ], "apis_used": [ "Aspose.Pdf.Facades.PdfFileStamp", "Aspose.Pdf.Facades.Stamp", - "PdfFileStamp.AddStamp", - "Stamp.BindPdf", - "Stamp.IsBackground", - "Stamp.Pages", - "PdfFileStamp.Close" + "Aspose.Pdf.Facades.Stamp.BindPdf", + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", + "Aspose.Pdf.Facades.PdfFileStamp.Close" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "apply-translucent-watermark-to-pdf": { - "title": "Apply Translucent Watermark to All PDF Pages", - "filename": "apply-translucent-watermark-to-pdf.cs", - "description": "Shows how to use PdfFileStamp and Stamp with 50% opacity to add a translucent text watermark to every page of a PDF document.", + "apply-translucent-text-watermark": { + "title": "Apply Translucent Text Watermark to All PDF Pages", + "filename": "apply-translucent-text-watermark.cs", + "description": "Demonstrates how to use Aspose.Pdf.Facades to add a semi‑transparent text watermark to every page of a PDF document.", "tags": [ "watermark", "opacity", "pdf", - "stamps", - "Aspose.Pdf" + "facade", + "text-stamp" ], "apis_used": [ "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", + "Aspose.Pdf.Facades.PdfFileStamp.Save", "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.FormattedText", - "PdfFileStamp.AddStamp", - "Stamp.BindLogo", - "Stamp.Opacity", - "Stamp.IsBackground", - "PdfFileStamp.Close" + "Aspose.Pdf.Facades.Stamp.BindLogo", + "Aspose.Pdf.Facades.Stamp.Opacity" ], - "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "difficulty": "beginner", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "apply-rotated-image-stamp-bottom-right": { - "title": "Apply Rotated Image Stamp to Bottom Right of PDF Pages", - "filename": "apply-rotated-image-stamp-bottom-right.cs", - "description": "Demonstrates how to add an image stamp rotated 30° to the bottom‑right corner of every page using Aspose.Pdf.Facades.", + "apply-rotated-image-stamp-to-pdf-pages": { + "title": "Apply Rotated Image Stamp to PDF Pages", + "filename": "apply-rotated-image-stamp-to-pdf-pages.cs", + "description": "Demonstrates how to add an image stamp rotated by 30° to the bottom‑right corner of every page in a PDF using the Aspose.Pdf Facades API.", "tags": [ - "image-stamp", + "stamp", + "image", "rotation", "pdf", - "facade", - "bottom-right" + "facade" ], "apis_used": [ "Aspose.Pdf.Facades.PdfFileStamp", "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", - "Aspose.Pdf.Facades.Stamp.BindImage", + "Aspose.Pdf.Document", + "Aspose.Pdf.Page", "Aspose.Pdf.Facades.Stamp.SetImageSize", "Aspose.Pdf.Facades.Stamp.Rotation", "Aspose.Pdf.Facades.Stamp.SetOrigin", - "Aspose.Pdf.Facades.PdfFileStamp.Close" + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-page-numbers-to-pdf": { - "title": "Add Page Numbers to PDF using PdfFileStamp", - "filename": "add-page-numbers-to-pdf.cs", - "description": "Demonstrates stamping a PDF with dynamic page numbers using the PdfFileStamp facade and the '#' placeholder.", + "add-page-number-stamp-to-pdf": { + "title": "Add Page Number Stamp to PDF", + "filename": "add-page-number-stamp-to-pdf.cs", + "description": "Shows how to use Aspose.Pdf.Facades.PdfFileStamp to add a dynamic page‑number stamp (using the \"#\" placeholder) to every page of a PDF document.", "tags": [ "pdf", - "page-number", "stamp", + "page-number", "facade", - "aspdf" + "csharp" ], "apis_used": [ "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.PdfFileStamp.AddPageNumber", - "Aspose.Pdf.Facades.PdfFileStamp.Close" + "PdfFileStamp.AddPageNumber", + "PdfFileStamp.StartingNumber", + "PdfFileStamp.Close" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-multi-line-watermark-to-pdf": { - "title": "Add Multi‑Line Watermark to PDF from Memory Stream", - "filename": "add-multi-line-watermark-to-pdf.cs", - "description": "Shows how to create a PDF in memory and apply a multi‑line, colored, custom‑size watermark using PdfFileStamp and related facade classes.", + "add-multi-line-watermark-custom-font": { + "title": "Add Multi‑Line Watermark with Custom Font to PDF", + "filename": "add-multi-line-watermark-custom-font.cs", + "description": "Demonstrates loading a PDF from a memory stream and applying a multi‑line, custom‑styled watermark using Aspose.Pdf.Facades stamp classes.", "tags": [ "watermark", "pdf", - "memory-stream", - "Aspose.Pdf", - "facade" + "stamp", + "formatted-text", + "custom-font" ], "apis_used": [ - "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.Document", "Aspose.Pdf.Facades.FormattedText", - "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", "Aspose.Pdf.Facades.Stamp.BindLogo", - "Aspose.Pdf.Facades.Stamp.SetOrigin" + "Aspose.Pdf.Facades.Stamp.SetOrigin", + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", + "Aspose.Pdf.Facades.PdfFileStamp.Save" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "add-footer-stamp-10-points-above-bottom": { "title": "Add Footer Stamp 10 Points Above Bottom Edge", "filename": "add-footer-stamp-10-points-above-bottom.cs", - "description": "Demonstrates how to place a footer stamp exactly 10 points above the page bottom using Aspose.Pdf.Facades. The example creates formatted text, binds a PDF, adds the footer, and saves the result.", + "description": "Demonstrates how to use PdfFileStamp to add a footer stamp positioned exactly 10 points above the bottom edge of each PDF page.", "tags": [ "footer", "stamp", "margin", - "Aspose.Pdf", - "C#" + "pdf", + "Aspose.Pdf" ], "apis_used": [ "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.FormattedText", - "Aspose.Pdf.Facades.EncodingType", - "PdfFileStamp.BindPdf", - "PdfFileStamp.AddFooter", - "PdfFileStamp.Save", - "PdfFileStamp.Close" + "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", + "Aspose.Pdf.Facades.PdfFileStamp.AddFooter", + "Aspose.Pdf.Facades.PdfFileStamp.Save", + "Aspose.Pdf.FormattedText" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "apply-text-stamp-to-even-pages": { - "title": "Apply Text Stamp to Even Pages of a PDF", - "filename": "apply-text-stamp-to-even-pages.cs", - "description": "Shows how to add a formatted text stamp only to even‑numbered pages of a PDF using Aspose.Pdf.Facades.", + "apply-stamp-to-even-pdf-pages": { + "title": "Apply Stamp to Even PDF Pages", + "filename": "apply-stamp-to-even-pdf-pages.cs", + "description": "Shows how to add a text stamp only to even-numbered pages of a PDF using Aspose.Pdf facades.", "tags": [ + "pdf", "stamp", "even-pages", - "text", "Aspose.Pdf", - "facades" + "facade" ], "apis_used": [ "Aspose.Pdf.Document", - "Aspose.Pdf.Text.FormattedText", - "Aspose.Pdf.Facades.Stamp", "Aspose.Pdf.Facades.PdfFileStamp", - "Stamp.BindLogo", - "PdfFileStamp.BindPdf", - "PdfFileStamp.AddStamp", - "PdfFileStamp.Save" + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", + "Aspose.Pdf.Facades.Stamp", + "Aspose.Pdf.Facades.FormattedText" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-qr-code-verification-stamp": { - "title": "Add QR Code and Description Stamp to PDF", - "filename": "add-qr-code-verification-stamp.cs", - "description": "Demonstrates how to load a PDF, create an image stamp for a QR code and a text stamp with verification instructions, place them on each page, and save the stamped document.", + "qr-code-and-text-stamp-for-pdf": { + "title": "Create QR Code and Text Stamp for PDF Verification", + "filename": "qr-code-and-text-stamp-for-pdf.cs", + "description": "Demonstrates how to add a QR‑code image stamp together with a descriptive text stamp to a PDF using Aspose.Pdf Facades.", "tags": [ - "qr-code", - "stamp", "pdf", - "image-stamp", - "text-stamp" + "stamp", + "qrcode", + "facade", + "verification" ], "apis_used": [ - "Aspose.Pdf.Document", - "Aspose.Pdf.ImageStamp", - "Aspose.Pdf.TextStamp", - "Aspose.Pdf.Text.FontRepository.FindFont", - "Aspose.Pdf.Page.AddStamp", - "Aspose.Pdf.Document.Save" + "Aspose.Pdf.Facades.Stamp", + "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.Facades.FormattedText", + "Aspose.Pdf.Facades.Stamp.BindImage", + "Aspose.Pdf.Facades.Stamp.BindLogo", + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", + "Aspose.Pdf.Facades.PdfFileStamp.Save" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "apply-text-stamp-to-specific-pdf-pages": { "title": "Apply Text Stamp to Specific PDF Pages", "filename": "apply-text-stamp-to-specific-pdf-pages.cs", - "description": "Shows how to add a semi‑transparent text stamp only on pages 1, 5, and 10 of an existing PDF using Aspose.Pdf.Facades.", + "description": "Shows how to add a text watermark (stamp) to only pages 1, 5, and 10 of a PDF using Aspose.Pdf.Facades.", "tags": [ - "stamp", "pdf", - "specific-pages", - "text-watermark", - "Aspose" + "stamp", + "watermark", + "Aspose.Pdf", + "specific-pages" ], "apis_used": [ - "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Text.FormattedText", - "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", - "Aspose.Pdf.Facades.Stamp.BindLogo", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", - "Aspose.Pdf.Facades.PdfFileStamp.Save" + "Aspose.Pdf.Facades.PdfFileMend", + "Aspose.Pdf.Facades.FormattedText", + "Aspose.Pdf.Facades.EncodingType", + "Aspose.Pdf.Facades.PdfFileMend.BindPdf", + "Aspose.Pdf.Facades.PdfFileMend.AddText", + "Aspose.Pdf.Facades.PdfFileMend.Save", + "Aspose.Pdf.Facades.PdfFileMend.Close" ], - "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "difficulty": "beginner", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-text-stamp-overlay-to-pdf-pages": { - "title": "Add Text Stamp Overlay to PDF Pages", - "filename": "add-text-stamp-overlay-to-pdf-pages.cs", - "description": "Demonstrates how to use the PdfFileStamp facade to place a formatted text stamp on top of existing PDF content by setting IsBackground to false.", + "overlay-image-stamp-on-pdf-pages": { + "title": "Overlay Image Stamp on PDF Pages", + "filename": "overlay-image-stamp-on-pdf-pages.cs", + "description": "Demonstrates how to add an image stamp that overlays existing PDF content by setting the stamp's IsBackground property to false using Aspose.Pdf.Facades.", "tags": [ "pdf", "stamp", - "text", + "image", "overlay", - "Aspose.Pdf" + "aspose" ], "apis_used": [ - "PdfFileStamp", - "PdfFileStamp.BindPdf", + "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.Facades.Stamp", + "Stamp.BindImage", + "Stamp.IsBackground", "PdfFileStamp.AddStamp", - "PdfFileStamp.Save", - "FormattedText", - "Stamp", - "Stamp.BindLogo", - "Stamp.IsBackground" + "PdfFileStamp.Close" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-barcode-header-to-pdf-pages": { - "title": "Add Barcode Header to PDF Pages", - "filename": "add-barcode-header-to-pdf-pages.cs", - "description": "Shows how to use Aspose.Pdf.Facades.PdfFileStamp to place a pre‑generated barcode image as a header on every page of a PDF document.", + "add-transparent-confidential-text-stamp": { + "title": "Add Transparent Confidential Text Stamp to Selected PDF Pages", + "filename": "add-transparent-confidential-text-stamp.cs", + "description": "Demonstrates applying a 70% opaque red \"CONFIDENTIAL\" text stamp to specific pages of a PDF using Aspose.Pdf Facades.", "tags": [ - "barcode", - "header", + "stamp", + "watermark", "pdf", - "aspose", - "facade" + "opacity", + "selected-pages" ], "apis_used": [ + "Aspose.Pdf.Document", "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.PdfFileStamp.AddHeader", - "Aspose.Pdf.Facades.PdfFileStamp.Close", - "Aspose.Pdf.Facades.PdfFileStamp.InputFile", - "Aspose.Pdf.Facades.PdfFileStamp.OutputFile" + "Aspose.Pdf.Facades.FormattedText", + "Aspose.Pdf.Facades.Stamp", + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp" ], - "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", - "status": "verified" - }, - "add-transparent-text-stamp-to-selected-pdf-pages": { - "title": "Add Transparent Text Stamp to Selected PDF Pages", - "filename": "add-transparent-text-stamp-to-selected-pdf-pages.cs", - "description": "Demonstrates how to apply a semi‑transparent red text stamp labeled 'CONFIDENTIAL' to specific pages of a PDF using Aspose.Pdf.Facades.", - "tags": [ - "text-stamp", - "opacity", - "selected-pages", - "Aspose.Pdf", - "PDF watermark" - ], - "apis_used": [ - "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.FormattedText", - "PdfFileStamp.BindPdf", - "Stamp.BindLogo", - "Stamp.Opacity", - "PdfFileStamp.AddStamp", - "PdfFileStamp.Save" - ], - "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "difficulty": "intermediate", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "custom-font-stamp-branding": { - "title": "Create a Custom Font Stamp for PDF Branding", + "title": "Add Custom Font Stamp to PDF for Branding", "filename": "custom-font-stamp-branding.cs", - "description": "Demonstrates how to load a TrueType font and use it to create a branded stamp that is applied to a PDF page with custom positioning, opacity, and background settings.", + "description": "Shows how to load a TrueType font from a file, create a formatted text stamp using that font, and apply the stamp to a PDF with Aspose.Pdf facades.", "tags": [ "stamp", "custom-font", "branding", - "Aspose.Pdf", - "watermark" + "pdf", + "facade" ], "apis_used": [ - "Aspose.Pdf.Document", - "Aspose.Pdf.Text.FontRepository.FindFont", - "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.FontRepository.OpenFont", "Aspose.Pdf.Facades.FormattedText", - "Aspose.Pdf.Facades.Stamp" + "Aspose.Pdf.Facades.Stamp", + "Aspose.Pdf.Facades.Stamp.BindLogo", + "Aspose.Pdf.Facades.Stamp.SetOrigin", + "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", + "Aspose.Pdf.Facades.PdfFileStamp.Save" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-page-number-stamp-with-leading-zeros": { + "add-page-number-stamp-leading-zeros": { "title": "Add Page Number Stamp with Leading Zeros to PDF", - "filename": "add-page-number-stamp-with-leading-zeros.cs", - "description": "Shows how to add a page‑number stamp formatted with leading zeros to every page of a PDF using Aspose.Pdf.", + "filename": "add-page-number-stamp-leading-zeros.cs", + "description": "Shows how to use Aspose.Pdf to stamp Arabic numeral page numbers with leading zeros on every page of a PDF document.", "tags": [ "page-number", "stamp", - "pdf", "leading-zeros", - "csharp" + "Aspose.Pdf", + "facades" ], "apis_used": [ "Aspose.Pdf.Document", - "Aspose.Pdf.Page", - "Aspose.Pdf.Text.TextStamp", - "Aspose.Pdf.FontRepository.FindFont", - "Aspose.Pdf.Text.TextState", - "Aspose.Pdf.Page.AddStamp", - "Aspose.Pdf.Document.Save" + "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.Facades.PdfFileStamp.NumberingStyle", + "Aspose.Pdf.Facades.PdfFileStamp.AddPageNumber", + "Aspose.Pdf.Facades.PdfFileStamp.Save", + "Aspose.Pdf.Facades.PdfFileStamp.Close" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "batch-apply-rotated-pdf-stamp": { - "title": "Batch Apply Rotated PDF Stamp to Multiple PDFs", + "title": "Batch Apply Rotated PDF Stamp to PDFs", "filename": "batch-apply-rotated-pdf-stamp.cs", - "description": "Shows how to enumerate PDF files on a network share and apply a rotated background stamp from another PDF to each page, saving the stamped files to an output folder.", + "description": "Demonstrates how to iterate over PDFs in a network share and apply a rotated stamp taken from another PDF to every page, saving the results to an output folder.", "tags": [ "pdf", "stamp", - "batch", "rotation", + "batch", "network-share" ], "apis_used": [ - "PdfFileStamp", - "Stamp", + "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.Facades.Stamp", + "PdfFileStamp.BindPdf", "Stamp.BindPdf", "Stamp.Rotation", "PdfFileStamp.AddStamp", - "PdfFileStamp.Close" + "PdfFileStamp.Save" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-right-aligned-image-stamp-to-pdf": { - "title": "Add Right-Aligned Image Stamp to PDF", - "filename": "add-right-aligned-image-stamp-to-pdf.cs", - "description": "Shows how to load a PDF, create an ImageStamp, set its HorizontalAlignment to Right, and apply the stamp to each page.", + "multi-line-watermark-addnewlinetext": { + "title": "Create Multi‑Line Watermark Using AddNewLineText", + "filename": "multi-line-watermark-addnewlinetext.cs", + "description": "Demonstrates how to build a three‑line watermark with Aspose.Pdf.Facades.FormattedText using AddNewLineText, bind it to a Stamp, and apply it to a PDF document.", + "tags": [ + "watermark", + "formattedtext", + "stamp", + "pdf", + "addnewlinetext" + ], + "apis_used": [ + "Aspose.Pdf.Facades.FormattedText", + "Aspose.Pdf.Facades.Stamp.BindLogo", + "Aspose.Pdf.Facades.Stamp.SetOrigin", + "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.Document", + "Aspose.Pdf.Page" + ], + "difficulty": "intermediate", + "generated_at": "2026-08-20T08:03:52Z", + "status": "verified" + }, + "add-right-aligned-logo-stamp-to-pdf": { + "title": "Add Right-Aligned Logo Stamp to PDF", + "filename": "add-right-aligned-logo-stamp-to-pdf.cs", + "description": "Shows how to place an image stamp (logo) at the right margin of each page in a PDF using Aspose.Pdf.", "tags": [ "image-stamp", "horizontal-alignment", @@ -655,18 +648,19 @@ "apis_used": [ "Aspose.Pdf.Document", "Aspose.Pdf.ImageStamp", - "Aspose.Pdf.HorizontalAlignment", "Aspose.Pdf.Page.AddStamp", + "Aspose.Pdf.HorizontalAlignment", + "Aspose.Pdf.VerticalAlignment", "Aspose.Pdf.Document.Save" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-semi-transparent-png-background-stamp": { - "title": "Add Semi-Transparent PNG Background Stamp to PDF", - "filename": "add-semi-transparent-png-background-stamp.cs", - "description": "Demonstrates how to apply a semi‑transparent PNG image as a background stamp that covers the entire page of a PDF using Aspose.Pdf.Facades.", + "apply-semi-transparent-png-background-stamp": { + "title": "Apply Semi-Transparent PNG Background Stamp to PDF", + "filename": "apply-semi-transparent-png-background-stamp.cs", + "description": "Demonstrates how to add a semi‑transparent PNG image as a background stamp that covers the entire page of a PDF using Aspose.Pdf.Facades.", "tags": [ "background", "stamp", @@ -675,172 +669,148 @@ "pdf" ], "apis_used": [ - "Aspose.Pdf.Document", "Aspose.Pdf.Facades.PdfFileStamp", "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.Stamp.BindImage", - "Aspose.Pdf.Facades.Stamp.SetImageSize", - "Aspose.Pdf.Facades.Stamp.Opacity", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", - "Aspose.Pdf.Facades.PdfFileStamp.Save" - ], - "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", - "status": "verified" - }, - "apply-multi-line-text-stamp-1-5-line-spacing": { - "title": "Apply Multi-Line Text Stamp with 1.5 Line Spacing", - "filename": "apply-multi-line-text-stamp-1-5-line-spacing.cs", - "description": "Demonstrates creating a multi-line text watermark with 1.5 line spacing using FormattedText, binding it to a Stamp, and applying the stamp to all pages of a PDF with Aspose.Pdf.", - "tags": [ - "watermark", - "text-stamp", - "line-spacing", - "Aspose.Pdf", - "C#" - ], - "apis_used": [ - "Aspose.Pdf.Text.FormattedText", - "Aspose.Pdf.Text.FormattedText.AddNewLineText", - "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.Stamp.BindLogo", - "Aspose.Pdf.Facades.Stamp.SetOrigin", - "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp" + "PdfFileStamp.BindPdf", + "Stamp.BindImage", + "Stamp.SetImageSize", + "PdfFileStamp.AddStamp", + "PdfFileStamp.Save" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-creation-date-stamp-to-pdf": { - "title": "Add Creation Date Stamp to PDF Pages", - "filename": "add-creation-date-stamp-to-pdf.cs", - "description": "Demonstrates how to add a text stamp that displays the document's creation date (formatted as yyyy-MM-dd) to the top‑left corner of each page in a PDF using Aspose.Pdf.", + "add-creation-date-stamp": { + "title": "Add Creation Date Stamp to PDF", + "filename": "add-creation-date-stamp.cs", + "description": "Shows how to read a PDF's creation date and place it as a text stamp in the top‑left corner of every page using Aspose.Pdf.", "tags": [ - "stamp", "creation-date", + "stamp", "textstamp", "pdf", - "aspose" + "aspose-pdf" ], "apis_used": [ "Aspose.Pdf.Document", + "Aspose.Pdf.DocumentInfo", "Aspose.Pdf.Text.TextStamp", - "Aspose.Pdf.FontRepository.FindFont", - "Aspose.Pdf.Page.AddStamp", - "Aspose.Pdf.Document.Save", - "Aspose.Pdf.Text.TextState" + "Aspose.Pdf.Text.FontRepository", + "Aspose.Pdf.Page", + "Aspose.Pdf.Color", + "Aspose.Pdf.HorizontalAlignment", + "Aspose.Pdf.VerticalAlignment" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "merge-cover-page-background-pdf": { + "merge-cover-page-background": { "title": "Merge Cover Page as Background Using PdfFileStamp", - "filename": "merge-cover-page-background-pdf.cs", - "description": "Demonstrates how to use Aspose.Pdf.Facades.PdfFileStamp and Stamp to apply the first page of a cover PDF as a background on every page of another PDF, producing a merged document.", + "filename": "merge-cover-page-background.cs", + "description": "Shows how to use Aspose.Pdf.Facades.PdfFileStamp and Stamp to apply the first page of a cover PDF as a background on all pages of another PDF, creating a merged document.", "tags": [ "pdf", "cover-page", - "stamp", "background", - "merge" + "stamp", + "Aspose.Pdf" ], "apis_used": [ - "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", - "Aspose.Pdf.Facades.PdfFileStamp.Close", - "Aspose.Pdf.Facades.Stamp.BindPdf", - "Aspose.Pdf.Facades.Stamp.IsBackground" + "PdfFileStamp", + "Stamp", + "Stamp.BindPdf", + "Stamp.IsBackground", + "PdfFileStamp.AddStamp", + "PdfFileStamp.Close" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-image-and-text-stamp-to-pdf": { - "title": "Add Image and Text Stamp to PDF", - "filename": "add-image-and-text-stamp-to-pdf.cs", - "description": "Demonstrates how to use Aspose.Pdf.Facades to place a company logo image and a bold \"Confidential\" text stamp on a PDF document.", + "add-confidential-text-and-logo-stamp": { + "title": "Add Confidential Text and Logo Stamp to PDF", + "filename": "add-confidential-text-and-logo-stamp.cs", + "description": "Demonstrates using Aspose.Pdf.Facades to place a combined formatted text stamp and a logo image onto a PDF document.", "tags": [ "stamp", - "image", - "text", + "logo", + "confidential", "pdf", - "confidential" + "facade" ], "apis_used": [ - "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.FormattedText", - "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", - "Aspose.Pdf.Facades.Stamp.SetOrigin", - "Aspose.Pdf.Facades.Stamp.SetImageSize", - "Aspose.Pdf.Facades.Stamp.BindImage", - "Aspose.Pdf.Facades.Stamp.BindLogo", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", - "Aspose.Pdf.Facades.PdfFileStamp.Save" + "PdfFileStamp", + "Stamp", + "FormattedText", + "EncodingType", + "PdfFileStamp.BindPdf", + "Stamp.BindLogo", + "Stamp.BindImage", + "PdfFileStamp.AddStamp" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-multi-line-watermark-pdf": { - "title": "Add Multi-Line Watermark with Line Spacing to PDF", - "filename": "add-multi-line-watermark-pdf.cs", - "description": "Demonstrates using Aspose.Pdf.Facades to apply a multi‑line text watermark with opacity and background settings, positioning it via PdfFileStamp and FormattedText. Highlights that precise line height control requires separate stamps per line.", + "apply-custom-line-height-stamp": { + "title": "Apply Custom Line-Height Stamp to PDF", + "filename": "apply-custom-line-height-stamp.cs", + "description": "Demonstrates how to create a multi‑line watermark with custom line spacing using a formatted text stamp and apply it to all pages of a PDF.", "tags": [ + "stamp", "watermark", + "line-spacing", "pdf", - "aspose", - "multiline", - "stamp" + "Aspose" ], "apis_used": [ - "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", - "Aspose.Pdf.Facades.PdfFileStamp.Save", "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.Stamp.BindLogo", - "Aspose.Pdf.Facades.Stamp.SetOrigin", - "Aspose.Pdf.Facades.FormattedText" + "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.FormattedText", + "FormattedText.AddNewLineText", + "Stamp.BindLogo", + "Stamp.SetOrigin", + "PdfFileStamp.AddStamp" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "rotate-text-stamp-90-degrees": { - "title": "Rotate Text Stamp 90 Degrees and Verify Readability", - "filename": "rotate-text-stamp-90-degrees.cs", - "description": "Demonstrates how to rotate a text stamp by 90 degrees using Aspose.Pdf.Facades and then verifies that the stamped text remains readable by extracting it from the resulting PDF.", + "rotate-text-stamp-on-pdf-pages": { + "title": "Rotate Text Stamp on PDF Pages", + "filename": "rotate-text-stamp-on-pdf-pages.cs", + "description": "Demonstrates creating a formatted text stamp, setting its rotation to 90 degrees, and applying it to all pages of a PDF using Aspose.Pdf.Facades.", "tags": [ "stamp", "rotation", - "text", - "verification", - "pdf" + "pdf", + "watermark", + "Aspose.Pdf" ], "apis_used": [ - "Aspose.Pdf.Document", "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Text.FormattedText", + "Aspose.Pdf.Facades.FormattedText", "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Text.TextAbsorber" + "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", + "Aspose.Pdf.Facades.PdfFileStamp.Save", + "Aspose.Pdf.Facades.Stamp.Rotation", + "Aspose.Pdf.Facades.Stamp.SetOrigin" ], - "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "difficulty": "beginner", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-footer-page-count-stamp": { - "title": "Add Footer Page Count Stamp to PDF", - "filename": "add-footer-page-count-stamp.cs", - "description": "Shows how to use Aspose.Pdf.Facades.PdfFileStamp to add a footer that automatically displays the total page count on each page of a PDF document.", + "add-footer-with-page-count": { + "title": "Add Footer with Page Count to PDF", + "filename": "add-footer-with-page-count.cs", + "description": "Shows how to use Aspose.Pdf.Facades.PdfFileStamp to add a footer that displays the current page number and total page count on each page of a PDF document.", "tags": [ "pdf", "footer", - "page-count", + "page-number", "stamp", "aspose-pdf" ], @@ -849,256 +819,255 @@ "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", "Aspose.Pdf.Facades.PdfFileStamp.AddPageNumber", "Aspose.Pdf.Facades.PdfFileStamp.Save", - "Aspose.Pdf.Facades.PpdfFileStamp.Close" + "Aspose.Pdf.Facades.PdfFileStamp.Close" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "create-multi-page-pdf-stamp": { - "title": "Create Multi‑Page PDF Stamp from Multiple PDFs", - "filename": "create-multi-page-pdf-stamp.cs", - "description": "Demonstrates how to combine several PDF files as stamps and apply them to each page of a target PDF using Aspose.Pdf.Facades.", + "combine-multiple-pdfs-into-multi-page-stamp": { + "title": "Combine Multiple PDFs into a Multi‑Page Stamp", + "filename": "combine-multiple-pdfs-into-multi-page-stamp.cs", + "description": "Shows how to concatenate several PDF files into a single multi‑page PDF and apply it as a stamp to all pages of another PDF using Aspose.Pdf.Facades.", "tags": [ - "pdf", - "stamp", - "multipage", + "pdf-stamp", + "concatenate", + "aspose-pdf", "facade", - "aspnet" + "multi-page" ], "apis_used": [ + "Aspose.Pdf.Document", + "Aspose.Pdf.Page", + "Aspose.Pdf.Text.TextFragment", + "Aspose.Pdf.Facades.PdfFileEditor.Concatenate", "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.Stamp", - "PdfFileStamp.BindPdf", - "Stamp.BindPdf", - "PdfFileStamp.AddStamp", - "PdfFileStamp.Save" + "Aspose.Pdf.Facades.Stamp" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "apply-custom-colored-stamp-with-border": { - "title": "Apply Custom Colored Stamp with Border to PDF Pages", - "filename": "apply-custom-colored-stamp-with-border.cs", - "description": "Demonstrates how to add a rubber‑stamp annotation with custom text, color, and border thickness to every page of a PDF using Aspose.Pdf.", + "add-custom-border-stamp-to-pdf": { + "title": "Add Custom Border Stamp Annotation to PDF", + "filename": "add-custom-border-stamp-to-pdf.cs", + "description": "Demonstrates how to load a PDF, create a rubber‑stamp annotation with a custom red border and thickness, place it on a page, and save the modified document.", "tags": [ "stamp", "annotation", "border", - "color", - "pdf" + "pdf", + "Aspose.Pdf" ], "apis_used": [ "Aspose.Pdf.Document", - "Aspose.Pdf.Page", "Aspose.Pdf.Annotations.StampAnnotation", "Aspose.Pdf.Annotations.Border", + "Aspose.Pdf.Rectangle", "Aspose.Pdf.Color", - "Aspose.Pdf.Rectangle" + "Aspose.Pdf.Page.Annotations.Add", + "Aspose.Pdf.Document.Save" ], - "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "difficulty": "beginner", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "batch-add-rotated-image-stamp": { + "batch-add-rotated-image-stamp-to-first-page": { "title": "Batch Add Rotated Image Stamp to First Page of PDFs", - "filename": "batch-add-rotated-image-stamp.cs", - "description": "Shows how to process all PDF files in a directory and apply a 45‑degree rotated image stamp to the first page of each document using Aspose.Pdf.Facades.", + "filename": "batch-add-rotated-image-stamp-to-first-page.cs", + "description": "Shows how to loop through a directory of PDF files and apply a rotated image stamp to the first page of each document using Aspose.Pdf.Facades.", "tags": [ "pdf", "stamp", "image", - "batch", - "rotation" + "rotation", + "batch" ], "apis_used": [ "PdfFileStamp", "Stamp", - "PdfFileStamp.AddStamp", - "PdfFileStamp.Close", + "PdfFileStamp.BindPdf", "Stamp.BindImage", - "Stamp.SetOrigin", - "Stamp.SetImageSize", - "Stamp.Rotation" + "Stamp.Rotation", + "Stamp.Pages", + "PdfFileStamp.AddStamp", + "PdfFileStamp.Save" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "apply-text-watermark-all-pdf-pages": { - "title": "Apply Text Watermark to All PDF Pages Using Facades", - "filename": "apply-text-watermark-all-pdf-pages.cs", - "description": "Demonstrates how to create a semi‑transparent text stamp and apply it to every page of a PDF document in a single operation using the Aspose.Pdf.Facades API.", + "apply-image-stamp-to-all-pdf-pages": { + "title": "Apply Image Stamp to All PDF Pages", + "filename": "apply-image-stamp-to-all-pdf-pages.cs", + "description": "Demonstrates using PdfFileStamp and Stamp to add a semi‑transparent image stamp to every page of a PDF in a single operation.", "tags": [ - "watermark", "stamp", + "watermark", "pdf", - "facades", - "Aspose.Pdf" + "Aspose.Pdf", + "facade" ], "apis_used": [ - "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.FormattedText", "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.Stamp.BindLogo", + "Aspose.Pdf.Facades.Stamp", + "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", + "Aspose.Pdf.Facades.Stamp.BindImage", + "Aspose.Pdf.Facades.Stamp.SetOrigin", + "Aspose.Pdf.Facades.Stamp.SetImageSize", "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", "Aspose.Pdf.Facades.PdfFileStamp.Save" ], - "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "difficulty": "intermediate", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "add-file-name-header-stamp-to-pdf": { "title": "Add File Name Header Stamp to PDF", "filename": "add-file-name-header-stamp-to-pdf.cs", - "description": "Demonstrates how to use Aspose.Pdf's PdfFileStamp facade to add a header containing the source PDF's file name to each page of a PDF document.", + "description": "Demonstrates creating a TextStamp that shows the PDF's file name in the header of each page and applying it to all pages of the document.", "tags": [ - "pdf", "stamp", "header", - "facade", - "aspose" + "filename", + "textstamp", + "aspose-pdf" ], "apis_used": [ - "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.PdfFileStamp.AddHeader", - "Aspose.Pdf.Facades.PdfFileStamp.Close", - "Aspose.Pdf.Text.FormattedText", - "Aspose.Pdf.Text.EncodingType" + "Aspose.Pdf.Document", + "Aspose.Pdf.Text.TextStamp", + "Aspose.Pdf.FontRepository.FindFont", + "Aspose.Pdf.Page.AddStamp", + "Aspose.Pdf.Color" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "add-semi-transparent-background-stamp": { "title": "Add Semi-Transparent Background Stamp to PDF", "filename": "add-semi-transparent-background-stamp.cs", - "description": "Demonstrates creating a formatted text stamp, setting it as a background with 30% opacity, and applying it to all pages of a PDF using the PdfFileStamp facade.", + "description": "Demonstrates how to apply an image as a background stamp on all pages of a PDF with 30% opacity using Aspose.Pdf.Facades, preserving document readability.", "tags": [ "stamp", "background", "opacity", - "watermark", - "Aspose.Pdf" + "pdf", + "Aspose" ], "apis_used": [ - "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Text.FormattedText", - "Stamp.BindLogo", - "Stamp.IsBackground", + "PdfFileStamp", + "Stamp", + "PdfFileStamp.BindPdf", + "Stamp.BindImage", "Stamp.Opacity", + "Stamp.IsBackground", "PdfFileStamp.AddStamp", "PdfFileStamp.Save" ], - "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "difficulty": "beginner", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-multi-line-watermark-varying-font-sizes": { - "title": "Add Multi-Line Watermark with Varying Font Sizes", - "filename": "add-multi-line-watermark-varying-font-sizes.cs", - "description": "Creates a PDF and uses PdfFileMend to add three watermark lines at the top of each page, each with a different font size to provide visual hierarchy.", + "add-multi-line-text-watermark": { + "title": "Add Multi‑Line Text Watermark with Varying Font Sizes", + "filename": "add-multi-line-text-watermark.cs", + "description": "Demonstrates how to apply a multi‑line watermark to each page of a PDF, using different font sizes for visual hierarchy and semi‑transparent rendering.", "tags": [ "watermark", - "font-size", "pdf", - "Aspose.Pdf", - "PdfFileMend" + "textstamp", + "fontsize", + "aspose-pdf" ], "apis_used": [ "Aspose.Pdf.Document", - "Aspose.Pdf.Facades.PdfFileMend", - "Aspose.Pdf.Facades.PdfFileMend.BindPdf", - "Aspose.Pdf.Facades.PdfFileMend.AddText", - "Aspose.Pdf.Facades.PdfFileMend.Save", - "Aspose.Pdf.Facades.FormattedText" + "Aspose.Pdf.Page", + "Aspose.Pdf.FontRepository.FindFont", + "Aspose.Pdf.Text.TextState", + "Aspose.Pdf.Text.TextStamp", + "Aspose.Pdf.Page.AddStamp", + "Aspose.Pdf.Document.Save" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "stamp-pdf-with-dynamic-barcode": { "title": "Stamp PDF with Dynamic Barcode Using Document ID", "filename": "stamp-pdf-with-dynamic-barcode.cs", - "description": "Demonstrates how to generate a barcode from a PDF's unique identifier and stamp it onto each page using Aspose.Pdf facades.", + "description": "Demonstrates how to generate a barcode from a PDF's unique identifier and stamp it onto the original document using Aspose.Pdf facades.", "tags": [ "barcode", "stamp", "pdf", - "Aspose.Pdf", - "facade" + "facades", + "document-id" ], "apis_used": [ "Aspose.Pdf.Document", - "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", - "Aspose.Pdf.Facades.Stamp.BindPdf", + "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.Facades.Stamp", "Aspose.Pdf.Forms.BarcodeField", - "Aspose.Pdf.Facades.Stamp.SetOrigin", - "Aspose.Pdf.Facades.Stamp.SetImageSize" + "Aspose.Pdf.Page", + "Aspose.Pdf.Rectangle" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "apply-rotated-text-stamp-to-odd-pages": { + "apply-rotated-text-stamp-odd-pages": { "title": "Apply Rotated Text Stamp to Odd Pages", - "filename": "apply-rotated-text-stamp-to-odd-pages.cs", - "description": "Demonstrates adding a 30‑degree rotated red text stamp to the left margin of every odd‑numbered page in a PDF using Aspose.Pdf.", + "filename": "apply-rotated-text-stamp-odd-pages.cs", + "description": "Demonstrates adding a 30‑degree rotated text stamp to the left margin of every odd‑numbered page in a PDF using Aspose.Pdf.", "tags": [ "text-stamp", "rotation", "odd-pages", "pdf", - "aspose-pdf" + "Aspose.Pdf" ], "apis_used": [ "Aspose.Pdf.Document", - "Aspose.Pdf.Page", - "Aspose.Pdf.Text.TextStamp", + "Aspose.Pdf.TextStamp", "Aspose.Pdf.Text.FontRepository.FindFont", - "Aspose.Pdf.Text.TextStamp.RotateAngle", "Aspose.Pdf.Page.AddStamp", "Aspose.Pdf.Document.Save" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "add-dynamic-text-stamp-to-pdf": { "title": "Add Dynamic Text Stamp to PDF", "filename": "add-dynamic-text-stamp-to-pdf.cs", - "description": "Demonstrates creating a formatted text stamp with dynamic author and date values using string interpolation and applying it to every page of a PDF via Aspose.Pdf.Facades.", + "description": "Demonstrates creating a TextStamp with interpolated author and date values, applying it to each page of a PDF, and saving the stamped document.", "tags": [ - "stamp", "pdf", - "text", - "interpolation", - "facade" + "textstamp", + "watermark", + "aspose-pdf", + "string-interpolation" ], "apis_used": [ - "Aspose.Pdf.Facades.FormattedText", - "Aspose.Pdf.Facades.Stamp", - "Aspose.Pdf.Facades.Stamp.BindLogo", - "Aspose.Pdf.Facades.Stamp.SetOrigin", - "Aspose.Pdf.Facades.PdfFileStamp", - "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", - "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", - "Aspose.Pdf.Facades.PdfFileStamp.Save" + "Aspose.Pdf.Document", + "Aspose.Pdf.Page", + "Aspose.Pdf.Text.TextStamp", + "Aspose.Pdf.Page.AddStamp", + "Aspose.Pdf.Document.Save" ], - "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "difficulty": "beginner", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, - "add-repeating-background-image-stamp": { - "title": "Add Repeating Background Image Stamp to PDF", - "filename": "add-repeating-background-image-stamp.cs", - "description": "Demonstrates how to use Aspose.Pdf.Facades to apply a single image stamp as a background watermark on every page of a PDF document.", + "add-repeating-background-watermark-image": { + "title": "Add Repeating Background Watermark Image to PDF Pages", + "filename": "add-repeating-background-watermark-image.cs", + "description": "Shows how to use PdfFileStamp with a single Stamp instance to place a semi‑transparent background image watermark on every page of a PDF.", "tags": [ "watermark", - "stamp", "background", + "stamp", "pdf", "Aspose.Pdf" ], @@ -1107,36 +1076,60 @@ "Aspose.Pdf.Facades.Stamp", "Aspose.Pdf.Facades.Stamp.BindImage", "Aspose.Pdf.Facades.Stamp.IsBackground", - "Aspose.Pdf.Facades.Stamp.Opacity", + "Aspose.Pdf.Facades.Stamp.SetImageSize", "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", "Aspose.Pdf.Facades.PdfFileStamp.Close" ], "difficulty": "beginner", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", + "status": "verified" + }, + "add-qr-code-stamp-from-pdf-metadata": { + "title": "Add QR Code Stamp from PDF Metadata", + "filename": "add-qr-code-stamp-from-pdf-metadata.cs", + "description": "Demonstrates how to generate a QR code from a PDF's metadata and apply it as a stamp on the document using Aspose.Pdf.", + "tags": [ + "qr-code", + "stamp", + "metadata", + "pdf", + "facades" + ], + "apis_used": [ + "Aspose.Pdf.Document", + "Aspose.Pdf.Facades.Stamp", + "Aspose.Pdf.Facades.PdfFileStamp", + "Aspose.Pdf.Facades.Stamp.BindImage", + "Aspose.Pdf.Facades.Stamp.SetOrigin", + "Aspose.Pdf.Facades.Stamp.SetImageSize", + "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", + "Aspose.Pdf.Facades.PdfFileStamp.Save" + ], + "difficulty": "intermediate", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" }, "add-multi-line-colored-header-stamp": { - "title": "Add Multi‑Line Colored Header Stamp to PDF Pages", + "title": "Add Multi-Line Colored Header Stamp to PDF", "filename": "add-multi-line-colored-header-stamp.cs", - "description": "Demonstrates how to add a multi‑line header to each page of a PDF using Aspose.Pdf, with each line rendered in a different font color.", + "description": "Demonstrates how to apply a multi‑line header stamp with different font colors to each line using Aspose.Pdf Facades.", "tags": [ - "header", + "pdf", "stamp", - "color", - "textstamp", - "aspose-pdf" + "header", + "colored-text", + "facades" ], "apis_used": [ - "Aspose.Pdf.Document", - "Aspose.Pdf.Page", - "Aspose.Pdf.Text.TextStamp", - "Aspose.Pdf.Text.FontRepository.FindFont", - "Aspose.Pdf.Color", - "Aspose.Pdf.Page.AddStamp", - "Aspose.Pdf.Document.Save" + "Aspose.Pdf.Facades.PdfFileStamp.BindPdf", + "Aspose.Pdf.Facades.PdfFileStamp.AddStamp", + "Aspose.Pdf.Facades.PdfFileStamp.Save", + "Aspose.Pdf.Facades.Stamp.BindLogo", + "Aspose.Pdf.Facades.Stamp.SetOrigin", + "Aspose.Pdf.Text.FormattedText" ], "difficulty": "intermediate", - "generated_at": "2026-07-18T01:12:46Z", + "generated_at": "2026-08-20T08:03:52Z", "status": "verified" } } diff --git a/facades-stamps/merge-cover-page-background-pdf.cs b/facades-stamps/merge-cover-page-background-pdf.cs deleted file mode 100644 index 2b5e8332c..000000000 --- a/facades-stamps/merge-cover-page-background-pdf.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf.Facades; // PdfFileStamp and Stamp are in this namespace - -class Program -{ - static void Main() - { - // Paths to the cover page PDF, the main document PDF, and the output PDF - const string coverPath = "cover.pdf"; - const string mainPath = "main.pdf"; - const string outputPath = "merged.pdf"; - - // Verify that input files exist - if (!File.Exists(coverPath)) - { - Console.Error.WriteLine($"Cover file not found: {coverPath}"); - return; - } - if (!File.Exists(mainPath)) - { - Console.Error.WriteLine($"Main document not found: {mainPath}"); - return; - } - - // Initialize PdfFileStamp and specify input and output files - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.InputFile = mainPath; // document to which the stamp will be applied - fileStamp.OutputFile = outputPath; // result file - - // Create a stamp that uses the first page of the cover PDF - Stamp stamp = new Stamp(); - stamp.BindPdf(coverPath, 1); // bind page 1 of cover.pdf as stamp content - stamp.IsBackground = true; // place the cover as background on each page - - // Add the stamp to the file and finalize - fileStamp.AddStamp(stamp); - fileStamp.Close(); // saves the output and releases resources - - Console.WriteLine($"Merged PDF saved to '{outputPath}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/merge-cover-page-background.cs b/facades-stamps/merge-cover-page-background.cs new file mode 100644 index 000000000..7fe0d4c3e --- /dev/null +++ b/facades-stamps/merge-cover-page-background.cs @@ -0,0 +1,44 @@ +using System; +using System.IO; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string coverPath = "cover.pdf"; // PDF to be used as background (cover page) + const string mainPath = "main.pdf"; // Main document + const string outputPath = "merged.pdf"; // Resulting PDF + + // Verify that source files exist + if (!File.Exists(coverPath)) + { + Console.Error.WriteLine($"Cover file not found: {coverPath}"); + return; + } + if (!File.Exists(mainPath)) + { + Console.Error.WriteLine($"Main file not found: {mainPath}"); + return; + } + + // Initialize the facade with the main document as the target + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.InputFile = mainPath; // document to receive the stamp + fileStamp.OutputFile = outputPath; // where the merged PDF will be saved + + // Create a stamp that uses the first page of the cover PDF + Stamp stamp = new Stamp(); + stamp.BindPdf(coverPath, 1); // bind page 1 of cover.pdf as stamp content + stamp.IsBackground = true; // place the cover page behind existing content + // By default stamp.Pages is null, meaning the stamp applies to all pages + + // Add the stamp to the document + fileStamp.AddStamp(stamp); + + // Persist changes and release resources + fileStamp.Close(); + + Console.WriteLine($"Merged PDF saved to '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/multi-line-watermark-addnewlinetext.cs b/facades-stamps/multi-line-watermark-addnewlinetext.cs new file mode 100644 index 000000000..99c738294 --- /dev/null +++ b/facades-stamps/multi-line-watermark-addnewlinetext.cs @@ -0,0 +1,76 @@ +using System; +using System.Drawing; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + const string inputPdf = "input.pdf"; + const string outputPdf = "watermarked.pdf"; + + if (!System.IO.File.Exists(inputPdf)) + { + Console.Error.WriteLine($"File not found: {inputPdf}"); + return; + } + + // Load the document (only needed to obtain page size for centering) + Document doc = new Document(inputPdf); + Page firstPage = doc.Pages[1]; + // PageInfo.Width/Height are double – cast to float for later calculations + float pageWidth = (float)firstPage.PageInfo.Width; + float pageHeight = (float)firstPage.PageInfo.Height; + doc.Dispose(); // we only needed the size information + + // --------------------------------------------------------------------- + // 1. Build a FormattedText that contains three lines. + // The AddNewLineText method is used to append the extra lines. + // NOTE: All lines share the same font settings in a single FormattedText + // instance. To have truly different font styles per line you would need + // separate FormattedText objects and separate stamps. The example below + // demonstrates the required API usage while keeping the code simple. + // --------------------------------------------------------------------- + Aspose.Pdf.Facades.FormattedText formatted = new Aspose.Pdf.Facades.FormattedText( + "First line – Bold 24pt", + System.Drawing.Color.Blue, // text colour (System.Drawing.Color) + "Helvetica-Bold", // bold variant of Helvetica + Aspose.Pdf.Facades.EncodingType.Winansi, + false, + 24f); + + // Append the remaining two lines. They inherit the same font settings. + formatted.AddNewLineText("Second line – Italic 18pt"); + formatted.AddNewLineText("Third line – Regular 12pt"); + + // --------------------------------------------------------------------- + // 2. Create a Stamp, bind the FormattedText and position it. + // Stamp does NOT expose HorizontalAlignment/VerticalAlignment – we set + // the origin manually so that the text appears centred. + // --------------------------------------------------------------------- + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + stamp.BindLogo(formatted); + + // Calculate centre position (approximate – the stamp origin is the lower‑left corner) + // The stamp’s width/height are not directly exposed, so we use a rough offset. + // Adjust these values as needed for precise centring. + float offsetX = pageWidth / 2f - 100f; // 100 pt left of centre (approx.) + float offsetY = pageHeight / 2f - 50f; // 50 pt below centre (approx.) + stamp.SetOrigin(offsetX, offsetY); + + stamp.IsBackground = true; // draw behind page content (watermark effect) + stamp.Opacity = 0.5f; // 50 % transparent + + // --------------------------------------------------------------------- + // 3. Apply the stamp to the whole document using PdfFileStamp. + // --------------------------------------------------------------------- + PdfFileStamp pdfStamp = new PdfFileStamp(); + pdfStamp.BindPdf(inputPdf); + pdfStamp.AddStamp(stamp); + pdfStamp.Save(outputPdf); + pdfStamp.Close(); + + Console.WriteLine($"Watermarked PDF saved to '{outputPdf}'."); + } +} diff --git a/facades-stamps/overlay-disclaimer-pdf-first-page.cs b/facades-stamps/overlay-disclaimer-pdf-first-page.cs deleted file mode 100644 index 58e7c705a..000000000 --- a/facades-stamps/overlay-disclaimer-pdf-first-page.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; - -class Program -{ - static void Main() - { - // Paths – adjust as needed - const string inputPdfPath = "target.pdf"; // PDF to be stamped - const string disclaimerPdfPath = "disclaimer.pdf"; // PDF containing the legal disclaimer (first page will be used) - const string outputPdfPath = "target_stamped.pdf"; - - // Verify files exist - if (!File.Exists(inputPdfPath)) - { - Console.Error.WriteLine($"Input PDF not found: {inputPdfPath}"); - return; - } - if (!File.Exists(disclaimerPdfPath)) - { - Console.Error.WriteLine($"Disclaimer PDF not found: {disclaimerPdfPath}"); - return; - } - - // Initialize PdfFileStamp facade - PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.InputFile = inputPdfPath; // source document - fileStamp.OutputFile = outputPdfPath; // result document - - // Create a stamp that uses the first page of the disclaimer PDF - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindPdf(disclaimerPdfPath, 1); // use page 1 of disclaimer.pdf as stamp content - stamp.IsBackground = true; // place stamp behind existing content - stamp.Pages = new int[] { 1 }; // apply only to the first page of the target PDF - - // Add the stamp to the document - fileStamp.AddStamp(stamp); - - // Finalize and save - fileStamp.Close(); - - Console.WriteLine($"Stamped PDF saved to '{outputPdfPath}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/overlay-image-stamp-on-pdf-pages.cs b/facades-stamps/overlay-image-stamp-on-pdf-pages.cs new file mode 100644 index 000000000..b9a159b7c --- /dev/null +++ b/facades-stamps/overlay-image-stamp-on-pdf-pages.cs @@ -0,0 +1,50 @@ +using System; +using System.IO; +using Aspose.Pdf.Facades; // Facade API for stamping + +class Program +{ + static void Main() + { + const string inputPath = "input.pdf"; // source PDF + const string outputPath = "output.pdf"; // stamped PDF + const string imagePath = "stamp.png"; // image to use as stamp + + // Verify required files exist + if (!File.Exists(inputPath)) + { + Console.Error.WriteLine($"Input file not found: {inputPath}"); + return; + } + if (!File.Exists(imagePath)) + { + Console.Error.WriteLine($"Stamp image not found: {imagePath}"); + return; + } + + // Initialize PdfFileStamp with input and output file paths + PdfFileStamp fileStamp = new PdfFileStamp(inputPath, outputPath); + + // Create a Stamp object from the Facades namespace + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + + // Bind an image to the stamp (you could also use BindLogo for text) + stamp.BindImage(imagePath); + + // Explicitly set IsBackground to false so the stamp overlays existing content + stamp.IsBackground = false; + + // Optional: configure position, size, and opacity of the stamp + stamp.SetOrigin(100, 200); // X and Y coordinates + stamp.SetImageSize(150, 100); // Width and height + stamp.Opacity = 0.8f; // 80% opacity + + // Add the stamp to the document (Pages = null means all pages) + fileStamp.AddStamp(stamp); + + // Finalize and write the output PDF + fileStamp.Close(); + + Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/overlay-legal-disclaimer-with-pdffilestamp.cs b/facades-stamps/overlay-legal-disclaimer-with-pdffilestamp.cs new file mode 100644 index 000000000..c51bd3982 --- /dev/null +++ b/facades-stamps/overlay-legal-disclaimer-with-pdffilestamp.cs @@ -0,0 +1,60 @@ +using System; +using System.IO; +using Aspose.Pdf; +using Aspose.Pdf.Facades; + +class Program +{ + static void Main() + { + // Path to the PDF that contains the legal disclaimer (first page will be used as stamp) + const string disclaimerPath = "disclaimer.pdf"; + + if (!File.Exists(disclaimerPath)) + { + Console.Error.WriteLine($"Disclaimer file not found: {disclaimerPath}"); + return; + } + + // List of target PDF files to which the disclaimer will be applied + string[] targetFiles = { "doc1.pdf", "doc2.pdf", "doc3.pdf" }; + + foreach (string targetPath in targetFiles) + { + if (!File.Exists(targetPath)) + { + Console.Error.WriteLine($"Target file not found: {targetPath}"); + continue; + } + + // Define output file name (original name with suffix) + string outputPath = Path.Combine( + Path.GetDirectoryName(targetPath) ?? string.Empty, + Path.GetFileNameWithoutExtension(targetPath) + "_disclaimed.pdf"); + + // Initialize PdfFileStamp facade + PdfFileStamp fileStamp = new PdfFileStamp(); + try + { + // Specify input and output files + fileStamp.InputFile = targetPath; + fileStamp.OutputFile = outputPath; + + // Create a stamp that uses the first page of the disclaimer PDF + Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); + stamp.BindPdf(disclaimerPath, 1); // bind page 1 of disclaimer.pdf + stamp.IsBackground = true; // place stamp behind existing content + stamp.Pages = new int[] { 1 }; // apply only to the first page of the target PDF + + // Add the stamp to the document and save + fileStamp.AddStamp(stamp); + fileStamp.Close(); // saves the result to outputPath + Console.WriteLine($"Created: {outputPath}"); + } + finally + { + // PdfFileStamp does not implement IDisposable; no further cleanup required + } + } + } +} \ No newline at end of file diff --git a/facades-stamps/qr-code-and-text-stamp-for-pdf.cs b/facades-stamps/qr-code-and-text-stamp-for-pdf.cs new file mode 100644 index 000000000..e2f00d70e --- /dev/null +++ b/facades-stamps/qr-code-and-text-stamp-for-pdf.cs @@ -0,0 +1,59 @@ +using System; +using System.IO; +using System.Drawing; // for System.Drawing.Color +using Aspose.Pdf; +using Aspose.Pdf.Facades; +using Aspose.Pdf.Text; // for FontRepository + +class Program +{ + static void Main() + { + const string inputPdf = "product.pdf"; + const string outputPdf = "product_verified.pdf"; + const string qrImage = "qr.png"; + const string description = "Product Verification"; + + // Verify required files exist + if (!File.Exists(inputPdf) || !File.Exists(qrImage)) + { + Console.Error.WriteLine("Input PDF or QR image not found."); + return; + } + + // ---------- QR CODE IMAGE STAMP ---------- + // Use the Facades Stamp class (fully qualified) to avoid ambiguity. + Aspose.Pdf.Facades.Stamp imageStamp = new Aspose.Pdf.Facades.Stamp(); + imageStamp.BindImage(qrImage); + imageStamp.SetOrigin(100, 500); // position (x, y) from bottom‑left + imageStamp.SetImageSize(100, 100); // size of the image stamp + imageStamp.Opacity = 0.9f; // semi‑transparent + imageStamp.IsBackground = false; // draw on top of page content + + // ---------- TEXT STAMP ---------- + // FormattedText lives in the Facades namespace; use font name string, not FontStyle enum. + Aspose.Pdf.Facades.FormattedText txt = new Aspose.Pdf.Facades.FormattedText( + description, + System.Drawing.Color.Black, // System.Drawing.Color is accepted + "Helvetica", // font name + Aspose.Pdf.Facades.EncodingType.Winansi, + false, + 12); + + Aspose.Pdf.Facades.Stamp textStamp = new Aspose.Pdf.Facades.Stamp(); + textStamp.BindLogo(txt); + textStamp.SetOrigin(210, 540); // place to the right of the QR code + textStamp.IsBackground = false; + textStamp.Opacity = 0.9f; + + // ---------- APPLY STAMPS ---------- + Aspose.Pdf.Facades.PdfFileStamp fileStamp = new Aspose.Pdf.Facades.PdfFileStamp(); + fileStamp.BindPdf(inputPdf); + fileStamp.AddStamp(imageStamp); + fileStamp.AddStamp(textStamp); + fileStamp.Save(outputPdf); + fileStamp.Close(); + + Console.WriteLine($"Stamped PDF saved to '{outputPdf}'."); + } +} diff --git a/facades-stamps/rotate-text-stamp-45-degrees.cs b/facades-stamps/rotate-text-stamp-45-degrees.cs index 57b9d372a..436aeb3ef 100644 --- a/facades-stamps/rotate-text-stamp-45-degrees.cs +++ b/facades-stamps/rotate-text-stamp-45-degrees.cs @@ -1,52 +1,45 @@ using System; using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Text; +using Aspose.Pdf; // Core PDF API +using Aspose.Pdf.Text; // TextStamp class class Program { static void Main() { - const string inputPath = "input.pdf"; - const string outputPath = "output.pdf"; - - // --------------------------------------------------------------------- - // Create a minimal source PDF if it does not already exist. - // This satisfies the sandbox where no external files are present. - // --------------------------------------------------------------------- - if (!File.Exists(inputPath)) + const string inputPdf = "input.pdf"; + const string outputPdf = "rotated_stamp.pdf"; + + if (!File.Exists(inputPdf)) { - using (Document seed = new Document()) - { - seed.Pages.Add(); // add a blank page - seed.Save(inputPath); - } + Console.Error.WriteLine($"Input file not found: {inputPdf}"); + return; } - // Load the PDF document - Document pdfDoc = new Document(inputPath); - - // Create a text stamp - TextStamp stamp = new TextStamp("CONFIDENTIAL"); - stamp.TextState.Font = FontRepository.FindFont("Helvetica"); - stamp.TextState.FontSize = 36; - stamp.TextState.ForegroundColor = Aspose.Pdf.Color.Red; // fully‑qualified Aspose color - stamp.RotateAngle = 45f; // rotate 45 degrees around its centre (correct property) - stamp.HorizontalAlignment = HorizontalAlignment.Center; - stamp.VerticalAlignment = VerticalAlignment.Center; - // Optional: adjust position if needed - // stamp.XIndent = 200; // not required when using centre alignment - // stamp.YIndent = 400; - - // Apply the stamp to every page (or select specific pages as needed) - foreach (Page page in pdfDoc.Pages) + // Open the source PDF inside a using block for deterministic disposal + using (Document doc = new Document(inputPdf)) { - page.AddStamp(stamp); - } + // Get the first page (Aspose.Pdf uses 1‑based indexing) + Page page = doc.Pages[1]; + + // Create a textual stamp with the desired text + TextStamp textStamp = new TextStamp("CONFIDENTIAL"); + + // Rotate the stamp 45 degrees around its centre + // RotateAngle allows arbitrary angles (in degrees) + textStamp.RotateAngle = 45; - // Save the stamped PDF - pdfDoc.Save(outputPath); + // Optional: position the stamp on the page + textStamp.XIndent = 100; // distance from the left edge + textStamp.YIndent = 500; // distance from the bottom edge + + // Add the stamp to the page + page.AddStamp(textStamp); + + // Save the modified PDF + doc.Save(outputPdf); + } - Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); + Console.WriteLine($"PDF saved with rotated text stamp: {outputPdf}"); } -} +} \ No newline at end of file diff --git a/facades-stamps/rotate-text-stamp-90-degrees.cs b/facades-stamps/rotate-text-stamp-90-degrees.cs deleted file mode 100644 index 58dc73a8b..000000000 --- a/facades-stamps/rotate-text-stamp-90-degrees.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.IO; -using Aspose.Pdf; -using Aspose.Pdf.Facades; -using Aspose.Pdf.Text; - -class Program -{ - static void Main() - { - const string inputPdf = "input.pdf"; - const string outputPdf = "rotated_stamp.pdf"; - - if (!File.Exists(inputPdf)) - { - Console.Error.WriteLine($"Input file not found: {inputPdf}"); - return; - } - - // Load the source PDF document. - using (Document srcDoc = new Document(inputPdf)) - { - // Initialize the PdfFileStamp facade and bind it to the loaded document. - using (PdfFileStamp fileStamp = new PdfFileStamp()) - { - fileStamp.BindPdf(srcDoc); - - // Create a text stamp. - // FormattedText constructor requires System.Drawing.Color for the text color. - FormattedText ft = new FormattedText( - "Rotated Text", // text - System.Drawing.Color.Black, // text color - "Helvetica", // font name - EncodingType.Winansi, // encoding - false, // embed font - 24); // font size - - Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindLogo(ft); - - // Set rotation to 90 degrees. - stamp.Rotation = 90f; - - // Add the stamp to all pages of the document. - fileStamp.AddStamp(stamp); - - // Save the stamped PDF. - fileStamp.Save(outputPdf); - fileStamp.Close(); - } - } - - // Verify that the text is still readable by extracting it from the output PDF. - using (Document outDoc = new Document(outputPdf)) - { - TextAbsorber absorber = new TextAbsorber(); - outDoc.Pages.Accept(absorber); - string extractedText = absorber.Text; - - Console.WriteLine("Extracted text after stamping:"); - Console.WriteLine(extractedText); - } - - Console.WriteLine($"Aspose.Pdf.Facades.Stamp with 90° rotation applied and saved to '{outputPdf}'."); - } -} \ No newline at end of file diff --git a/facades-stamps/rotate-text-stamp-on-pdf-pages.cs b/facades-stamps/rotate-text-stamp-on-pdf-pages.cs new file mode 100644 index 000000000..6e6705163 --- /dev/null +++ b/facades-stamps/rotate-text-stamp-on-pdf-pages.cs @@ -0,0 +1,54 @@ +using System; +using System.IO; +using Aspose.Pdf.Facades; // PdfFileStamp, Stamp, FormattedText, EncodingType + +class Program +{ + static void Main() + { + const string inputPdf = "input.pdf"; + const string outputPdf = "output_rotated_stamp.pdf"; + + // Verify input file exists + if (!File.Exists(inputPdf)) + { + Console.Error.WriteLine($"Input file not found: {inputPdf}"); + return; + } + + // Initialize the PdfFileStamp facade and bind the source PDF + PdfFileStamp fileStamp = new PdfFileStamp(); + fileStamp.BindPdf(inputPdf); + + // Create a text stamp with formatted text + // FormattedText constructor requires System.Drawing.Color for the text color + FormattedText formatted = new FormattedText( + "Rotated Stamp", // text + System.Drawing.Color.Black, // text color + "Helvetica", // font name + EncodingType.Winansi, // encoding + false, // embed font flag + 36); // font size + + // Create the stamp and bind the formatted text + Stamp stamp = new Stamp(); + stamp.BindLogo(formatted); + + // Set rotation to 90 degrees (clockwise) + stamp.Rotation = 90f; + + // Position the stamp on the page (optional) + stamp.SetOrigin(100f, 500f); + + // Add the stamp to all pages of the document + fileStamp.AddStamp(stamp); + + // Save the stamped PDF + fileStamp.Save(outputPdf); + fileStamp.Close(); + + // Verification: output the rotation value that was set + Console.WriteLine($"Stamp rotation set to: {stamp.Rotation} degrees"); + Console.WriteLine($"Stamped PDF saved to '{outputPdf}'."); + } +} \ No newline at end of file diff --git a/facades-stamps/stamp-pdf-with-dynamic-barcode.cs b/facades-stamps/stamp-pdf-with-dynamic-barcode.cs index e56a885b9..811f3d313 100644 --- a/facades-stamps/stamp-pdf-with-dynamic-barcode.cs +++ b/facades-stamps/stamp-pdf-with-dynamic-barcode.cs @@ -8,73 +8,72 @@ class Program { static void Main() { - const string inputPath = "input.pdf"; - const string outputPath = "output_stamped.pdf"; + const string inputPdfPath = "input.pdf"; + const string outputPdfPath = "output.pdf"; - if (!File.Exists(inputPath)) + if (!File.Exists(inputPdfPath)) { - Console.Error.WriteLine($"Input file not found: {inputPath}"); + Console.Error.WriteLine($"Input file not found: {inputPdfPath}"); return; } - // Load the source PDF - using (Document srcDoc = new Document(inputPath)) + // Load the source PDF to obtain its unique identifier (using the document title as an example) + using (Document srcDoc = new Document(inputPdfPath)) { - // Use the document title as a unique identifier; fallback to a GUID - string docId = !string.IsNullOrEmpty(srcDoc.Info.Title) - ? srcDoc.Info.Title - : Guid.NewGuid().ToString(); + // Use the document title; fallback to a GUID if title is empty + string uniqueId = !string.IsNullOrEmpty(srcDoc.Info.Title) + ? srcDoc.Info.Title + : Guid.NewGuid().ToString(); - // Create a temporary PDF that contains the barcode + // ------------------------------------------------------------ + // Create a temporary PDF that contains only the barcode field + // ------------------------------------------------------------ using (MemoryStream barcodePdfStream = new MemoryStream()) { using (Document barcodeDoc = new Document()) { - // Add a single page to host the barcode + // Add a single blank page Page barcodePage = barcodeDoc.Pages.Add(); - // Define the rectangle where the barcode will be placed - Aspose.Pdf.Rectangle barcodeRect = new Aspose.Pdf.Rectangle(100, 500, 300, 550); + // Define the barcode rectangle (position and size) + // Rectangle(left, bottom, width, height) + Aspose.Pdf.Rectangle barcodeRect = new Aspose.Pdf.Rectangle(100, 500, 200, 100); - // Create a barcode field and set its value to the document identifier - BarcodeField barcodeField = new BarcodeField(barcodeDoc, barcodeRect) - { - Value = docId // Assign the barcode data - // The default barcode type is Code128; explicit setting is unnecessary for older SDK versions - }; + // Create the barcode field on the page + BarcodeField barcodeField = new BarcodeField(barcodePage, barcodeRect); + // Set the barcode value to the unique identifier + barcodeField.Value = uniqueId; + // Optionally set the barcode type (Code128 is default) + // barcodeField.BarcodeType = BarcodeType.Code128; - // Add the barcode field to the form of the temporary document - barcodeDoc.Form.Add(barcodeField); + // Add the barcode field to the page's annotations collection + barcodePage.Annotations.Add(barcodeField); - // Save the temporary PDF containing the barcode into the memory stream + // Save the temporary PDF containing the barcode to a memory stream barcodeDoc.Save(barcodePdfStream); } - // Reset stream position before reading + // Reset stream position for reading barcodePdfStream.Position = 0; - // Prepare the PdfFileStamp facade for stamping the original PDF + // ------------------------------------------------------------ + // Aspose.Pdf.Facades.Stamp the original PDF with the barcode page + // ------------------------------------------------------------ PdfFileStamp fileStamp = new PdfFileStamp(); - fileStamp.BindPdf(inputPath); // Bind the source PDF + fileStamp.InputFile = inputPdfPath; + fileStamp.OutputFile = outputPdfPath; - // Create a stamp and bind the barcode PDF page as its content + // Create a stamp that uses the first page of the barcode PDF Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp(); - stamp.BindPdf(barcodePdfStream, 1); // Use the first (and only) page as stamp - stamp.IsBackground = false; // Place stamp on top of page content + stamp.BindPdf(barcodePdfStream, 1); // use page 1 as stamp content + stamp.IsBackground = false; // place stamp on top of page content - // Position and size of the stamp on each page - stamp.SetOrigin(150, 400); // X, Y coordinates (bottom‑left origin) - stamp.SetImageSize(200, 100); // Width, Height of the stamp - - // Add the stamp to the document + // Add the stamp to the document and finalize fileStamp.AddStamp(stamp); - - // Save the stamped PDF - fileStamp.Save(outputPath); - fileStamp.Close(); + fileStamp.Close(); // writes the output file } } - Console.WriteLine($"Stamped PDF saved to '{outputPath}'."); + Console.WriteLine($"Stamped PDF saved to '{outputPdfPath}'."); } -} +} \ No newline at end of file From 44251ad6780da4d29dc767128f463cc00b950879 Mon Sep 17 00:00:00 2001 From: agent-aspose-pdf-examples Date: Tue, 8 Sep 2026 06:20:39 -0500 Subject: [PATCH 2/2] Add URL-stability stubs for 34 regenerated paths Regeneration renamed these examples, which would delete live URLs on main. Each old path now holds a stub pointing at its current location (21 direct matches, 13 to the category folder). AI-assisted development --- ...ckground-image-watermark-to-specific-pdf-pages.cs | 12 ++++++++++++ facades-stamps/add-barcode-header-to-pdf-pages.cs | 12 ++++++++++++ facades-stamps/add-creation-date-stamp-to-pdf.cs | 12 ++++++++++++ facades-stamps/add-footer-page-count-stamp.cs | 12 ++++++++++++ facades-stamps/add-header-stamp-to-all-pdf-pages.cs | 12 ++++++++++++ facades-stamps/add-image-and-text-stamp-to-pdf.cs | 12 ++++++++++++ .../add-lowercase-roman-page-numbers-to-odd-pages.cs | 12 ++++++++++++ facades-stamps/add-multi-line-text-watermark-pdf.cs | 12 ++++++++++++ facades-stamps/add-multi-line-watermark-pdf.cs | 12 ++++++++++++ facades-stamps/add-multi-line-watermark-to-pdf.cs | 12 ++++++++++++ .../add-multi-line-watermark-varying-font-sizes.cs | 12 ++++++++++++ .../add-page-number-stamp-with-leading-zeros.cs | 12 ++++++++++++ facades-stamps/add-page-numbers-to-pdf.cs | 12 ++++++++++++ facades-stamps/add-qr-code-verification-stamp.cs | 12 ++++++++++++ .../add-repeating-background-image-stamp.cs | 12 ++++++++++++ .../add-right-aligned-image-stamp-to-pdf.cs | 12 ++++++++++++ .../add-semi-transparent-png-background-stamp.cs | 12 ++++++++++++ .../add-text-stamp-overlay-to-pdf-pages.cs | 12 ++++++++++++ ...d-transparent-text-stamp-to-selected-pdf-pages.cs | 12 ++++++++++++ .../apply-custom-colored-stamp-with-border.cs | 12 ++++++++++++ .../apply-multi-line-text-stamp-1-5-line-spacing.cs | 12 ++++++++++++ facades-stamps/apply-pdf-stamp-preserve-filenames.cs | 12 ++++++++++++ facades-stamps/apply-pdf-template-stamp-to-page.cs | 12 ++++++++++++ .../apply-rotated-image-stamp-bottom-right.cs | 12 ++++++++++++ .../apply-rotated-text-stamp-to-odd-pages.cs | 12 ++++++++++++ facades-stamps/apply-rotating-text-stamps.cs | 12 ++++++++++++ facades-stamps/apply-text-stamp-to-even-pages.cs | 12 ++++++++++++ facades-stamps/apply-text-watermark-all-pdf-pages.cs | 12 ++++++++++++ facades-stamps/apply-translucent-watermark-to-pdf.cs | 12 ++++++++++++ facades-stamps/batch-add-rotated-image-stamp.cs | 12 ++++++++++++ facades-stamps/create-multi-page-pdf-stamp.cs | 12 ++++++++++++ facades-stamps/merge-cover-page-background-pdf.cs | 12 ++++++++++++ facades-stamps/overlay-disclaimer-pdf-first-page.cs | 12 ++++++++++++ facades-stamps/rotate-text-stamp-90-degrees.cs | 12 ++++++++++++ 34 files changed, 408 insertions(+) create mode 100644 facades-stamps/add-background-image-watermark-to-specific-pdf-pages.cs create mode 100644 facades-stamps/add-barcode-header-to-pdf-pages.cs create mode 100644 facades-stamps/add-creation-date-stamp-to-pdf.cs create mode 100644 facades-stamps/add-footer-page-count-stamp.cs create mode 100644 facades-stamps/add-header-stamp-to-all-pdf-pages.cs create mode 100644 facades-stamps/add-image-and-text-stamp-to-pdf.cs create mode 100644 facades-stamps/add-lowercase-roman-page-numbers-to-odd-pages.cs create mode 100644 facades-stamps/add-multi-line-text-watermark-pdf.cs create mode 100644 facades-stamps/add-multi-line-watermark-pdf.cs create mode 100644 facades-stamps/add-multi-line-watermark-to-pdf.cs create mode 100644 facades-stamps/add-multi-line-watermark-varying-font-sizes.cs create mode 100644 facades-stamps/add-page-number-stamp-with-leading-zeros.cs create mode 100644 facades-stamps/add-page-numbers-to-pdf.cs create mode 100644 facades-stamps/add-qr-code-verification-stamp.cs create mode 100644 facades-stamps/add-repeating-background-image-stamp.cs create mode 100644 facades-stamps/add-right-aligned-image-stamp-to-pdf.cs create mode 100644 facades-stamps/add-semi-transparent-png-background-stamp.cs create mode 100644 facades-stamps/add-text-stamp-overlay-to-pdf-pages.cs create mode 100644 facades-stamps/add-transparent-text-stamp-to-selected-pdf-pages.cs create mode 100644 facades-stamps/apply-custom-colored-stamp-with-border.cs create mode 100644 facades-stamps/apply-multi-line-text-stamp-1-5-line-spacing.cs create mode 100644 facades-stamps/apply-pdf-stamp-preserve-filenames.cs create mode 100644 facades-stamps/apply-pdf-template-stamp-to-page.cs create mode 100644 facades-stamps/apply-rotated-image-stamp-bottom-right.cs create mode 100644 facades-stamps/apply-rotated-text-stamp-to-odd-pages.cs create mode 100644 facades-stamps/apply-rotating-text-stamps.cs create mode 100644 facades-stamps/apply-text-stamp-to-even-pages.cs create mode 100644 facades-stamps/apply-text-watermark-all-pdf-pages.cs create mode 100644 facades-stamps/apply-translucent-watermark-to-pdf.cs create mode 100644 facades-stamps/batch-add-rotated-image-stamp.cs create mode 100644 facades-stamps/create-multi-page-pdf-stamp.cs create mode 100644 facades-stamps/merge-cover-page-background-pdf.cs create mode 100644 facades-stamps/overlay-disclaimer-pdf-first-page.cs create mode 100644 facades-stamps/rotate-text-stamp-90-degrees.cs diff --git a/facades-stamps/add-background-image-watermark-to-specific-pdf-pages.cs b/facades-stamps/add-background-image-watermark-to-specific-pdf-pages.cs new file mode 100644 index 000000000..54f8aa4f9 --- /dev/null +++ b/facades-stamps/add-background-image-watermark-to-specific-pdf-pages.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add background image watermark to specific pdf pages +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-background-watermark-to-specific-pdf-pages.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-barcode-header-to-pdf-pages.cs b/facades-stamps/add-barcode-header-to-pdf-pages.cs new file mode 100644 index 000000000..4d2061186 --- /dev/null +++ b/facades-stamps/add-barcode-header-to-pdf-pages.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add barcode header to pdf pages +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-creation-date-stamp-to-pdf.cs b/facades-stamps/add-creation-date-stamp-to-pdf.cs new file mode 100644 index 000000000..faf410217 --- /dev/null +++ b/facades-stamps/add-creation-date-stamp-to-pdf.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add creation date stamp to pdf +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-creation-date-stamp.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-footer-page-count-stamp.cs b/facades-stamps/add-footer-page-count-stamp.cs new file mode 100644 index 000000000..25f2aef3f --- /dev/null +++ b/facades-stamps/add-footer-page-count-stamp.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add footer page count stamp +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-footer-with-page-count.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-header-stamp-to-all-pdf-pages.cs b/facades-stamps/add-header-stamp-to-all-pdf-pages.cs new file mode 100644 index 000000000..d34794f7d --- /dev/null +++ b/facades-stamps/add-header-stamp-to-all-pdf-pages.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add header stamp to all pdf pages +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-header-stamp-to-pdf-pages.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-image-and-text-stamp-to-pdf.cs b/facades-stamps/add-image-and-text-stamp-to-pdf.cs new file mode 100644 index 000000000..b234edafc --- /dev/null +++ b/facades-stamps/add-image-and-text-stamp-to-pdf.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add image and text stamp to pdf +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-page-number-stamp-to-pdf.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-lowercase-roman-page-numbers-to-odd-pages.cs b/facades-stamps/add-lowercase-roman-page-numbers-to-odd-pages.cs new file mode 100644 index 000000000..b884be193 --- /dev/null +++ b/facades-stamps/add-lowercase-roman-page-numbers-to-odd-pages.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add lowercase roman page numbers to odd pages +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-lower-roman-page-numbers-odd-pages.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-multi-line-text-watermark-pdf.cs b/facades-stamps/add-multi-line-text-watermark-pdf.cs new file mode 100644 index 000000000..6e850398f --- /dev/null +++ b/facades-stamps/add-multi-line-text-watermark-pdf.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add multi line text watermark pdf +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-multi-line-text-watermark.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-multi-line-watermark-pdf.cs b/facades-stamps/add-multi-line-watermark-pdf.cs new file mode 100644 index 000000000..b66317948 --- /dev/null +++ b/facades-stamps/add-multi-line-watermark-pdf.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add multi line watermark pdf +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-multi-line-text-watermark.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-multi-line-watermark-to-pdf.cs b/facades-stamps/add-multi-line-watermark-to-pdf.cs new file mode 100644 index 000000000..10fb6e830 --- /dev/null +++ b/facades-stamps/add-multi-line-watermark-to-pdf.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add multi line watermark to pdf +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-multi-line-watermark-custom-font.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-multi-line-watermark-varying-font-sizes.cs b/facades-stamps/add-multi-line-watermark-varying-font-sizes.cs new file mode 100644 index 000000000..f1b304493 --- /dev/null +++ b/facades-stamps/add-multi-line-watermark-varying-font-sizes.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add multi line watermark varying font sizes +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-page-number-stamp-with-leading-zeros.cs b/facades-stamps/add-page-number-stamp-with-leading-zeros.cs new file mode 100644 index 000000000..c3d1578f5 --- /dev/null +++ b/facades-stamps/add-page-number-stamp-with-leading-zeros.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add page number stamp with leading zeros +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-page-number-stamp-leading-zeros.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-page-numbers-to-pdf.cs b/facades-stamps/add-page-numbers-to-pdf.cs new file mode 100644 index 000000000..b2e35fbbc --- /dev/null +++ b/facades-stamps/add-page-numbers-to-pdf.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add page numbers to pdf +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-page-number-stamp-to-pdf.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-qr-code-verification-stamp.cs b/facades-stamps/add-qr-code-verification-stamp.cs new file mode 100644 index 000000000..ded746872 --- /dev/null +++ b/facades-stamps/add-qr-code-verification-stamp.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add qr code verification stamp +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-repeating-background-image-stamp.cs b/facades-stamps/add-repeating-background-image-stamp.cs new file mode 100644 index 000000000..3715b8626 --- /dev/null +++ b/facades-stamps/add-repeating-background-image-stamp.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add repeating background image stamp +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-repeating-background-watermark-image.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-right-aligned-image-stamp-to-pdf.cs b/facades-stamps/add-right-aligned-image-stamp-to-pdf.cs new file mode 100644 index 000000000..60f46cb59 --- /dev/null +++ b/facades-stamps/add-right-aligned-image-stamp-to-pdf.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add right aligned image stamp to pdf +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/add-right-aligned-logo-stamp-to-pdf.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-semi-transparent-png-background-stamp.cs b/facades-stamps/add-semi-transparent-png-background-stamp.cs new file mode 100644 index 000000000..34aba7098 --- /dev/null +++ b/facades-stamps/add-semi-transparent-png-background-stamp.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add semi transparent png background stamp +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/apply-semi-transparent-png-background-stamp.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-text-stamp-overlay-to-pdf-pages.cs b/facades-stamps/add-text-stamp-overlay-to-pdf-pages.cs new file mode 100644 index 000000000..9116d86f1 --- /dev/null +++ b/facades-stamps/add-text-stamp-overlay-to-pdf-pages.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add text stamp overlay to pdf pages +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/add-transparent-text-stamp-to-selected-pdf-pages.cs b/facades-stamps/add-transparent-text-stamp-to-selected-pdf-pages.cs new file mode 100644 index 000000000..694ba01c4 --- /dev/null +++ b/facades-stamps/add-transparent-text-stamp-to-selected-pdf-pages.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// add transparent text stamp to selected pdf pages +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/apply-custom-colored-stamp-with-border.cs b/facades-stamps/apply-custom-colored-stamp-with-border.cs new file mode 100644 index 000000000..577121fdf --- /dev/null +++ b/facades-stamps/apply-custom-colored-stamp-with-border.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// apply custom colored stamp with border +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/apply-multi-line-text-stamp-1-5-line-spacing.cs b/facades-stamps/apply-multi-line-text-stamp-1-5-line-spacing.cs new file mode 100644 index 000000000..017487da9 --- /dev/null +++ b/facades-stamps/apply-multi-line-text-stamp-1-5-line-spacing.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// apply multi line text stamp 1 5 line spacing +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/apply-pdf-stamp-preserve-filenames.cs b/facades-stamps/apply-pdf-stamp-preserve-filenames.cs new file mode 100644 index 000000000..593d40e73 --- /dev/null +++ b/facades-stamps/apply-pdf-stamp-preserve-filenames.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// apply pdf stamp preserve filenames +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/apply-pdf-template-stamp-to-page.cs b/facades-stamps/apply-pdf-template-stamp-to-page.cs new file mode 100644 index 000000000..0fd3646c1 --- /dev/null +++ b/facades-stamps/apply-pdf-template-stamp-to-page.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// apply pdf template stamp to page +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/apply-rotated-image-stamp-bottom-right.cs b/facades-stamps/apply-rotated-image-stamp-bottom-right.cs new file mode 100644 index 000000000..1277b877f --- /dev/null +++ b/facades-stamps/apply-rotated-image-stamp-bottom-right.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// apply rotated image stamp bottom right +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/apply-rotated-image-stamp-to-pdf-pages.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/apply-rotated-text-stamp-to-odd-pages.cs b/facades-stamps/apply-rotated-text-stamp-to-odd-pages.cs new file mode 100644 index 000000000..6b58e0601 --- /dev/null +++ b/facades-stamps/apply-rotated-text-stamp-to-odd-pages.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// apply rotated text stamp to odd pages +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/apply-rotated-text-stamp-odd-pages.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/apply-rotating-text-stamps.cs b/facades-stamps/apply-rotating-text-stamps.cs new file mode 100644 index 000000000..d5b2d2f09 --- /dev/null +++ b/facades-stamps/apply-rotating-text-stamps.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// apply rotating text stamps +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/apply-text-stamp-to-even-pages.cs b/facades-stamps/apply-text-stamp-to-even-pages.cs new file mode 100644 index 000000000..732bdfd1d --- /dev/null +++ b/facades-stamps/apply-text-stamp-to-even-pages.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// apply text stamp to even pages +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/apply-stamp-to-even-pdf-pages.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/apply-text-watermark-all-pdf-pages.cs b/facades-stamps/apply-text-watermark-all-pdf-pages.cs new file mode 100644 index 000000000..e97c45c24 --- /dev/null +++ b/facades-stamps/apply-text-watermark-all-pdf-pages.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// apply text watermark all pdf pages +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/apply-translucent-watermark-to-pdf.cs b/facades-stamps/apply-translucent-watermark-to-pdf.cs new file mode 100644 index 000000000..4be67c90a --- /dev/null +++ b/facades-stamps/apply-translucent-watermark-to-pdf.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// apply translucent watermark to pdf +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/apply-translucent-text-watermark.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/batch-add-rotated-image-stamp.cs b/facades-stamps/batch-add-rotated-image-stamp.cs new file mode 100644 index 000000000..f1953e389 --- /dev/null +++ b/facades-stamps/batch-add-rotated-image-stamp.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// batch add rotated image stamp +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/batch-add-rotated-image-stamp-to-first-page.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/create-multi-page-pdf-stamp.cs b/facades-stamps/create-multi-page-pdf-stamp.cs new file mode 100644 index 000000000..f45efe646 --- /dev/null +++ b/facades-stamps/create-multi-page-pdf-stamp.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// create multi page pdf stamp +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/merge-cover-page-background-pdf.cs b/facades-stamps/merge-cover-page-background-pdf.cs new file mode 100644 index 000000000..cfeed7eb2 --- /dev/null +++ b/facades-stamps/merge-cover-page-background-pdf.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// merge cover page background pdf +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/merge-cover-page-background.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/overlay-disclaimer-pdf-first-page.cs b/facades-stamps/overlay-disclaimer-pdf-first-page.cs new file mode 100644 index 000000000..93d166d00 --- /dev/null +++ b/facades-stamps/overlay-disclaimer-pdf-first-page.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// overlay disclaimer pdf first page +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/tree/main/facades-stamps +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } } diff --git a/facades-stamps/rotate-text-stamp-90-degrees.cs b/facades-stamps/rotate-text-stamp-90-degrees.cs new file mode 100644 index 000000000..9e67a4e68 --- /dev/null +++ b/facades-stamps/rotate-text-stamp-90-degrees.cs @@ -0,0 +1,12 @@ +// URL-STABILITY STUB +// +// rotate text stamp 90 degrees +// +// This example has been consolidated or moved. Current location: +// https://github.com/aspose-pdf/agentic-net-examples/blob/main/facades-stamps/rotate-text-stamp-on-pdf-pages.cs +// +// This stub keeps the original URL live for existing bookmarks, +// search-engine indexes, and blog-post links. See the canonical +// location above for the current, maintained implementation. + +class Program { static void Main() { } }