11using Synercoding . FileFormats . Pdf . Internals ;
2- using Synercoding . FileFormats . Pdf . LowLevel ;
32using Synercoding . Primitives ;
43using System ;
54using System . IO ;
@@ -98,13 +97,16 @@ public static PdfPage AddImage(this PdfPage page, Stream imageStream, Rectangle
9897 /// <summary>
9998 /// Add an image to the pdf page
10099 /// </summary>
100+ /// <remarks>
101+ /// The <paramref name="jpgStream"/> is not checked, and is used as is. Make sure only streams that represent a JPG are used.
102+ /// </remarks>
101103 /// <param name="page">The page to add the image to</param>
102104 /// <param name="jpgStream">The image to add</param>
103105 /// <param name="originalWidth">The original width of the image</param>
104106 /// <param name="originalHeight">The original height of the image</param>
105107 /// <param name="matrix">The placement matrix</param>
106108 /// <returns>The same <see cref="PdfPage"/> to chain other calls.</returns>
107- public static PdfPage AddImage ( this PdfPage page , Stream jpgStream , int originalWidth , int originalHeight , Matrix matrix )
109+ public static PdfPage AddJpgImageUnsafe ( this PdfPage page , Stream jpgStream , int originalWidth , int originalHeight , Matrix matrix )
108110 {
109111 page . ContentStream
110112 . SaveState ( )
@@ -118,14 +120,17 @@ public static PdfPage AddImage(this PdfPage page, Stream jpgStream, int original
118120 /// <summary>
119121 /// Add an image to the pdf page
120122 /// </summary>
123+ /// <remarks>
124+ /// The <paramref name="jpgStream"/> is not checked, and is used as is. Make sure only streams that represent a JPG are used.
125+ /// </remarks>
121126 /// <param name="page">The page to add the image to</param>
122127 /// <param name="jpgStream">The image to add</param>
123128 /// <param name="originalWidth">The original width of the image</param>
124129 /// <param name="originalHeight">The original height of the image</param>
125130 /// <param name="rectangle">The placement rectangle</param>
126131 /// <returns>The same <see cref="PdfPage"/> to chain other calls.</returns>
127- public static PdfPage AddImage ( this PdfPage page , Stream jpgStream , int originalWidth , int originalHeight , Rectangle rectangle )
128- => page . AddImage ( jpgStream , originalWidth , originalHeight , rectangle . AsPlacementMatrix ( ) ) ;
132+ public static PdfPage AddJpgImageUnsafe ( this PdfPage page , Stream jpgStream , int originalWidth , int originalHeight , Rectangle rectangle )
133+ => page . AddJpgImageUnsafe ( jpgStream , originalWidth , originalHeight , rectangle . AsPlacementMatrix ( ) ) ;
129134
130135 /// <summary>
131136 /// Add shapes to the pdf page
0 commit comments