Skip to content

Commit 86b18a4

Browse files
committed
polished kb
1 parent 98d4870 commit 86b18a4

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed
47.7 KB
Loading
29.6 KB
Loading

knowledge-base/pdf--image-border.md renamed to knowledge-base/pdf-image-border.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
---
22
title: Adding an Image Border in PdfProcessing
3-
description: Learn how to draw borders around images.
3+
description: Learn how to draw borders around images in the Telerik PdfProcessing library.
44
type: how-to
55
page_title: Drawing Borders for Images in Telerik PdfProcessing
66
meta_title: Drawing Borders for Images in Telerik PdfProcessing
7-
slug: pdf--image-border
7+
slug: pdf-image-border
88
tags: pdf,processing,telerik, document ,image,export,border
99
res_type: kb
1010
ticketid: 1698380
1111
---
12+
<style>
13+
img[alt$="><"] {
14+
border: 1px solid lightgrey;
15+
}
16+
</style>
1217

1318
## Environment
1419

@@ -18,14 +23,16 @@ ticketid: 1698380
1823

1924
## Description
2025

21-
Learn how to add borders around images in the generated PDF document.
26+
Learn how to add borders around [images]({%slug radpdfprocessing-model-image%}) in the generated PDF document.
2227

2328
## Solution
2429

25-
### Drawing Borders Around Images
26-
Follow one of the approaches below:
30+
To draw borders around images follow one of the approaches below:
31+
32+
### Approach 1: Using a Table with Borders
33+
34+
Insert a table with a single [TableCell]({%slug radpdfprocessing-editing-table-tablecell%}) and put the image in the cell:
2735

28-
#### Approach 1: Using a Table with Borders
2936
```csharp
3037
RadFixedDocument document = new RadFixedDocument();
3138
RadFixedPage page = document.Pages.AddPage();
@@ -52,9 +59,14 @@ using (Stream output = File.OpenWrite(@"..\..\exported.pdf"))
5259
{
5360
pdfProvider.Export(document, output);
5461
}
55-
```
62+
```
63+
64+
![Using a Table with Borders ><](images/image-table-cell-border.png)
65+
66+
### Approach 2: Using FixedContentEditor to Draw a Rectangle Border
67+
68+
An alternative approach is to draw a rectangular border around an image in a PDF using RadPdfProcessing, you can use the [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}) to draw both the image and the rectangle:
5669

57-
#### Approach 2: Using FixedContentEditor to Draw a Rectangle Border
5870
```csharp
5971
RadFixedDocument document = new RadFixedDocument();
6072
RadFixedPage page = document.Pages.AddPage();
@@ -89,7 +101,6 @@ editor.RestoreGraphicProperties();
89101
using (FileStream fs = new FileStream(imagePath, FileMode.Open, FileAccess.Read))
90102
{
91103
editor.Position.Translate(x, y);
92-
editor.DrawImage(fs);
93104
}
94105

95106
PdfFormatProvider pdfProvider = new PdfFormatProvider();
@@ -99,7 +110,9 @@ using (Stream output = File.OpenWrite(@"..\..\exported.pdf"))
99110
}
100111
```
101112

113+
![Using a FixedContentEditor to Draw the Image Border ><](images/image-fixedcontenteditor-border.png)
114+
102115
## See Also
103-
- [PdfProcessing ImageQuality Documentation](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/concepts/imagequality)
104-
- [How to Change File Size of PDF with Images](https://docs.telerik.com/devtools/document-processing/knowledge-base/pdfprocessing-change-file-size-through-image-quality-and-compression)
105-
- [Optimizing and Reducing PDF Size with RadPdfProcessing](https://docs.telerik.com/devtools/document-processing/knowledge-base/optimize-and-reduce-pdf-size-radpdfprocessing)
116+
- [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%})
117+
- [TableCell]({%slug radpdfprocessing-editing-table-tablecell%})
118+
- [Images]({%slug radpdfprocessing-model-image%})

libraries/radpdfprocessing/model/image.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,4 @@ The Image class exposes also the **GetBitmapSource()** method, enabling you to o
9595
* [Splitting a Large Image Across Multiple PDF Pages]({%slug split-export-large-image-multiple-pdf-pages-radpdfprocessing%})
9696
* [Change file size of a PDF with images through ImageCompression and ImageQuality]({%slug pdfprocessing-change-file-size-through-image-quality-and-compression%})
9797
* [Adding a Barcode to a PDF Document using PdfProcessing and the WinForms BarcodeView]({%slug add-barcode-to-pdf-telerik%})
98+
* [Adding an Image Border in PdfProcessing]({%slug pdf-image-border%})

0 commit comments

Comments
 (0)