mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-11-24 16:53:20 +08:00
Merge pull request #596 from GiovanniNova/master
Support for full-size images without specifing size
This commit is contained in:
@@ -520,11 +520,14 @@
|
||||
/// <summary>
|
||||
/// Adds the JPEG image represented by the input stream at the specified location.
|
||||
/// </summary>
|
||||
public AddedImage AddJpeg(Stream fileStream, PdfRectangle placementRectangle)
|
||||
public AddedImage AddJpeg(Stream fileStream, PdfRectangle placementRectangle = default)
|
||||
{
|
||||
var startFrom = fileStream.Position;
|
||||
var info = JpegHandler.GetInformation(fileStream);
|
||||
|
||||
if (placementRectangle.Equals(default(PdfRectangle)))
|
||||
placementRectangle = new PdfRectangle(0, 0, info.Width, info.Height);
|
||||
|
||||
byte[] data;
|
||||
using (var memory = new MemoryStream())
|
||||
{
|
||||
@@ -612,10 +615,13 @@
|
||||
/// <summary>
|
||||
/// Adds the PNG image represented by the input stream at the specified location.
|
||||
/// </summary>
|
||||
public AddedImage AddPng(Stream pngStream, PdfRectangle placementRectangle)
|
||||
public AddedImage AddPng(Stream pngStream, PdfRectangle placementRectangle = default)
|
||||
{
|
||||
var png = Png.Open(pngStream);
|
||||
|
||||
if (placementRectangle.Equals(default(PdfRectangle)))
|
||||
placementRectangle = new PdfRectangle(0, 0, png.Width, png.Height);
|
||||
|
||||
byte[] data;
|
||||
var pixelBuffer = new byte[3];
|
||||
using (var memoryStream = new MemoryStream())
|
||||
|
||||
Reference in New Issue
Block a user