Search code examples
c#asp.net.netasp.net-mvcironpdf

IronPdf - How to add a blank page with an image


I have a signature image that I want to insert into the end of a document. I have this signature available in base64 format or binary. I believe this can be achieved using somethink like this piece of code:

PdfDocument document = new PdfDocument();
PdfPage page = document.AddPage();
PdfImage image = PdfImage.FromFile("path/to/image.jpg");
PdfGraphics graphics = PdfGraphics.FromPdfPage(page);
graphics.DrawImage(image, new RectangleF(50, 50, 200, 200));
document.Save("path/to/document.pdf");

The problem is that the .AddPage method doesn't exist, I tried .AddBlankPage but it doesn't exist neither. What similar method or approach I can use?

Versioning:

<PackageReference Include="ironpdf.linux" Version="2022.10.9622" />
<PackageReference Include="IronPdf.Slim" Version="2022.10.9622" />

Solution

  • User09939's comment solved it. I used .merge to add a page with an img element