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>
|
/// <summary>
|
||||||
/// Adds the JPEG image represented by the input stream at the specified location.
|
/// Adds the JPEG image represented by the input stream at the specified location.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public AddedImage AddJpeg(Stream fileStream, PdfRectangle placementRectangle)
|
public AddedImage AddJpeg(Stream fileStream, PdfRectangle placementRectangle = default)
|
||||||
{
|
{
|
||||||
var startFrom = fileStream.Position;
|
var startFrom = fileStream.Position;
|
||||||
var info = JpegHandler.GetInformation(fileStream);
|
var info = JpegHandler.GetInformation(fileStream);
|
||||||
|
|
||||||
|
if (placementRectangle.Equals(default(PdfRectangle)))
|
||||||
|
placementRectangle = new PdfRectangle(0, 0, info.Width, info.Height);
|
||||||
|
|
||||||
byte[] data;
|
byte[] data;
|
||||||
using (var memory = new MemoryStream())
|
using (var memory = new MemoryStream())
|
||||||
{
|
{
|
||||||
@ -612,10 +615,13 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds the PNG image represented by the input stream at the specified location.
|
/// Adds the PNG image represented by the input stream at the specified location.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public AddedImage AddPng(Stream pngStream, PdfRectangle placementRectangle)
|
public AddedImage AddPng(Stream pngStream, PdfRectangle placementRectangle = default)
|
||||||
{
|
{
|
||||||
var png = Png.Open(pngStream);
|
var png = Png.Open(pngStream);
|
||||||
|
|
||||||
|
if (placementRectangle.Equals(default(PdfRectangle)))
|
||||||
|
placementRectangle = new PdfRectangle(0, 0, png.Width, png.Height);
|
||||||
|
|
||||||
byte[] data;
|
byte[] data;
|
||||||
var pixelBuffer = new byte[3];
|
var pixelBuffer = new byte[3];
|
||||||
using (var memoryStream = new MemoryStream())
|
using (var memoryStream = new MemoryStream())
|
||||||
|
Loading…
Reference in New Issue
Block a user