Skip to content

Commit 296bb83

Browse files
authored
Merge branch 'hotfix/hotfix-v31.2.2' into 983389-Autofit
2 parents 11482b8 + de28776 commit 296bb83

File tree

12 files changed

+374
-196
lines changed

12 files changed

+374
-196
lines changed

Document-Processing-toc.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,7 +2612,7 @@
26122612
<a href="/document-processing/pdf/conversions/html-to-pdf/net/Convert-HTML-to-PDF-in-GCP">Google Cloud Platform (GCP)</a>
26132613
<ul>
26142614
<li>
2615-
<a href="/document-processing/pdf/pdf-library/net/Convert-HTML-to-PDF-in-Google-App-Engine">Google App Engine</a>
2615+
<a href="/document-processing/pdf/conversions/html-to-pdf/net/Convert-HTML-to-PDF-in-Google-App-Engine">Google App Engine</a>
26162616
</li>
26172617
</ul>
26182618
</li>
@@ -4326,6 +4326,9 @@
43264326
</li>
43274327
</ul>
43284328
</li>
4329+
<li>
4330+
<a href="/document-processing/word/word-library/net/Performance-metrics">Performance Metrics</a>
4331+
</li>
43294332
<li>
43304333
<a href="/document-processing/word/word-library/net/Supported-and-Unsupported-Features">Supported and Unsupported Features</a>
43314334
</li>
@@ -4475,6 +4478,9 @@
44754478
<li>
44764479
<a href="/document-processing/word/conversions/word-to-pdf/net/Fallback-fonts-word-to-pdf">Fallback Fonts</a>
44774480
</li>
4481+
<li>
4482+
<a href="/document-processing/word/conversions/word-to-pdf/net/Performance-metrics">Performance Metrics</a>
4483+
</li>
44784484
<li>
44794485
<a href="/document-processing/word/conversions/word-to-pdf/net/Unsupported-elements-word-to-pdf">Unsupported Features</a>
44804486
</li>
@@ -4593,6 +4599,9 @@
45934599
<li>
45944600
<a href="/document-processing/word/conversions/word-to-image/net/Fallback-fonts-word-to-image">Fallback Fonts</a>
45954601
</li>
4602+
<li>
4603+
<a href="/document-processing/word/conversions/word-to-image/net/Performance-metrics">Performance Metrics</a>
4604+
</li>
45964605
<li>
45974606
<a href="/document-processing/word/conversions/word-to-image/net/Unsupported-elements-word-to-image">Unsupported Features</a>
45984607
</li>
@@ -7026,7 +7035,9 @@
70267035
<ul>
70277036
<li>
70287037
Weekly Nuget Release
7029-
<ul><li><a href="/document-processing/release-notes/v31.2.4">v31.2.4</a></li>
7038+
<ul>
7039+
<li><a href="/document-processing/release-notes/v31.2.5">v31.2.5</a></li>
7040+
<li><a href="/document-processing/release-notes/v31.2.4">v31.2.4</a></li>
70307041
<li><a href="/document-processing/release-notes/v31.2.3">v31.2.3</a></li>
70317042
<li><a href="/document-processing/release-notes/v31.1.22">v31.1.22</a></li>
70327043
<li><a href="/document-processing/release-notes/v31.1.21">v31.1.21</a></li>

Document-Processing/PDF/PDF-Library/NET/Working-with-HyperLinks.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ documentation: UG
99

1010
In PDF, hyperlinks can be added to allow the users to navigate to another part of PDF file, web page or any other external content. Essential<sup>&reg;</sup> PDF provides support for all these types of hyperlink.
1111

12+
To quickly get started with working with hyperlinks in PDF documents using the Syncfusion<sup>&reg;</sup> PDF library for .NET, refer to this video tutorial:
13+
{% youtube "https://youtu.be/g6HhVg2Fbd8?si=1WFL_6RCfRQvZhKb" %}
14+
1215
## Working with Web navigation
1316
1417
You can navigate to specified URL from a PDF document by using the [PdfTextWebLink](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Interactive.PdfTextWebLink.html) class.

Document-Processing/PDF/PDF-Library/NET/Working-with-Images.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,136 @@ doc.Close(True)
618618

619619
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Images/Paginate-an-image-in-PDF-document).
620620

621+
## Clipping and graphics state
622+
623+
This example demonstrates how to draw an image in a PDF document and apply a clipping region using the [SetClip](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfGraphics.html#methods) method. Clipping restricts drawing to a defined area, allowing partial rendering of content. The code also uses [Save](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfGraphics.html#methods) and [Restore](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfGraphics.html#methods) methods of [PdfGraphics](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfGraphics.html) to manage the graphics state, enabling temporary clipping and restoring the full drawing area afterward.
624+
625+
{% tabs %}
626+
627+
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Images/Clipping-and-graphics-state/.NET/Clipping-and-graphics-state/Program.cs" %}
628+
629+
using Syncfusion.Drawing;
630+
using Syncfusion.Pdf;
631+
using Syncfusion.Pdf.Graphics;
632+
633+
// Create a new PDF document
634+
using (PdfDocument document = new PdfDocument())
635+
{
636+
// Add a page to the document
637+
PdfPage page = document.Pages.Add();
638+
// Get the graphics object for the page
639+
PdfGraphics graphics = page.Graphics;
640+
// Open the image file as a stream
641+
using FileStream imageStream = new FileStream(Path.GetFullPath("Input.png"), FileMode.Open, FileAccess.Read);
642+
// Load the image from the stream
643+
PdfBitmap image = new PdfBitmap(imageStream);
644+
645+
// Save the current graphics state (to restore later)
646+
PdfGraphicsState state = graphics.Save();
647+
648+
// Define a rectangular clipping region
649+
RectangleF clipRect = new RectangleF(50, 50, 200, 100);
650+
graphics.SetClip(clipRect);
651+
652+
// Draw the image — only the part within the clipping region will be visible
653+
graphics.DrawImage(image, new RectangleF(40, 60, 150, 80));
654+
655+
// Restore the graphics state to remove the clipping region
656+
graphics.Restore(state);
657+
// Draw the image again — this time the full image will be visible
658+
graphics.DrawImage(image, new RectangleF(60, 160, 150, 80));
659+
660+
// Save the PDF document
661+
document.Save("Output.pdf");
662+
}
663+
664+
{% endhighlight %}
665+
666+
{% highlight c# tabtitle="C# [Windows-specific]" %}
667+
668+
using System.Drawing;
669+
using Syncfusion.Pdf;
670+
using Syncfusion.Pdf.Graphics;
671+
672+
// Create a new PDF document
673+
using (PdfDocument document = new PdfDocument())
674+
{
675+
// Add a page to the document
676+
PdfPage page = document.Pages.Add();
677+
// Get the graphics object for the page
678+
PdfGraphics graphics = page.Graphics;
679+
// Open the image file as a stream
680+
using FileStream imageStream = new FileStream(Path.GetFullPath("Input.png"), FileMode.Open, FileAccess.Read);
681+
// Load the image from the stream
682+
PdfBitmap image = new PdfBitmap(imageStream);
683+
684+
// Save the current graphics state (to restore later)
685+
PdfGraphicsState state = graphics.Save();
686+
687+
// Define a rectangular clipping region
688+
RectangleF clipRect = new RectangleF(50, 50, 200, 100);
689+
graphics.SetClip(clipRect);
690+
691+
// Draw the image — only the part within the clipping region will be visible
692+
graphics.DrawImage(image, new RectangleF(40, 60, 150, 80));
693+
694+
// Restore the graphics state to remove the clipping region
695+
graphics.Restore(state);
696+
// Draw the image again — this time the full image will be visible
697+
graphics.DrawImage(image, new RectangleF(60, 160, 150, 80));
698+
699+
// Save the PDF document
700+
document.Save("Output.pdf");
701+
}
702+
703+
{% endhighlight %}
704+
705+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
706+
707+
Imports System.Drawing
708+
Imports Syncfusion.Pdf
709+
Imports Syncfusion.Pdf.Graphics
710+
711+
' Create a new PDF document
712+
Using document As New PdfDocument()
713+
' Add a page to the document
714+
Dim page As PdfPage = document.Pages.Add()
715+
716+
' Get the graphics object for the page
717+
Dim graphics As PdfGraphics = page.Graphics
718+
719+
' Open the image file as a stream
720+
Using imageStream As New FileStream(Path.GetFullPath("Input.png"), FileMode.Open, FileAccess.Read)
721+
' Load the image from the stream
722+
Dim image As New PdfBitmap(imageStream)
723+
724+
' Save the current graphics state (to restore later)
725+
Dim state As PdfGraphicsState = graphics.Save()
726+
727+
' Define a rectangular clipping region
728+
Dim clipRect As New RectangleF(50, 50, 200, 100)
729+
graphics.SetClip(clipRect)
730+
731+
' Draw the image — only the part within the clipping region will be visible
732+
graphics.DrawImage(image, New RectangleF(40, 60, 150, 80))
733+
734+
' Restore the graphics state to remove the clipping region
735+
graphics.Restore(state)
736+
737+
' Draw the image again — this time the full image will be visible
738+
graphics.DrawImage(image, New RectangleF(60, 160, 150, 80))
739+
End Using
740+
741+
' Save the PDF document
742+
document.Save("Output.pdf")
743+
End Using
744+
745+
{% endhighlight %}
746+
747+
{% endtabs %}
748+
749+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Images/Clipping-and-graphics-state/.NET).
750+
621751
## Applying transparency and rotation to the image
622752

623753
You can add transparency and rotation to the image using [SetTransparency](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfGraphics.html#Syncfusion_Pdf_Graphics_PdfGraphics_SetTransparency_System_Single_) and [RotateTransform](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfGraphics.html#Syncfusion_Pdf_Graphics_PdfGraphics_RotateTransform_System_Single_) methods of [PdfGraphics](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfGraphics.html) respectively. This is explained in the below code snippet.

0 commit comments

Comments
 (0)