public async Task SharePDFAsync(MemoryStream stream, string name, float width, float heigth)
{
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
doc.PageSettings.Width = width;
doc.PageSettings.Height = heigth;
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Load the image from the stream
PdfBitmap image = new PdfBitmap(stream);
//Draw the image
graphics.DrawImage(image, 0, 0);
MemoryStream ms = new MemoryStream();
doc.Save(ms);
//Close the document.
doc.Close(true);
string filePath = await SaveAsync(ms, "pdf", name);
await Show("test", "test", filePath);
}
My question:
A jpeg file arrives as stream, with set size. I want to scale the PDF file to A4 and A3. The problem is that when I scale the PdfDocument the jpeg image saved in pdf comes out cut, does not reduce.
Is it possible to do what I want?
thankful