mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-04-05 20:55:01 +08:00
Support for full-size images without specifing size
This commit is contained in:
parent
2e0622b652
commit
cdc91eeef7
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user