Hello JORGEMAL,
Thanks for your inquiry. Spire.PDF supports adding a set of PNG files to a single PDF file.
And I provide you sample code here, check this:
- Code: Select all
PdfDocument doc = new PdfDocument();
PdfPageBase page;
PdfImage image;
//add png files here
String[] str = new String[] { "pic-1.png", "pic-2.png", "pic-3.png" };
for (int i = 0; i < str.Length; i++)
{
page = doc.Pages.Add();
image = PdfImage.FromFile(str[i]);
float width = image.Width * 1f;
float height = image.Height * 1f;
float x = (page.Canvas.ClientSize.Width - width) / 2;
page.Canvas.DrawImage(image, x, 60, width, height);
}
doc.SaveToFile("Image.pdf");
doc.Close();
If you have any questions, please get it back to us.
Best Regards,
Benjamin
E-iceblue support team