How to create single pdf file from multi image (BITMAP) with c#

Hi all,
I donโ€™t know the best way for create a single pdf file from multi file image, in file pdf each image is each page :slight_smile:
Who can tell me solution, if have code demo is good :slight_smile:
Thanks

Hi there,


Thanks for your inquiry. Please visit documentation link to add image in a PDF file, you may create new page for each page. Please check following code snippet for the purpose. Hopefully it will help you to accomplish the task.

// Instantiate Document Object<o:p></o:p>

Document doc = new Document();

// Add a page to pages collection of document

Page page = doc.Pages.Add();

// Create an image object

Aspose.Pdf.Image image = new Aspose.Pdf.Image();

// Add the image into paragraphs collection of the section

page.Paragraphs.Add(image);

// Set the image file stream

image.File=myDir+"test.bmp";

// Add another page to pages collection of document for second image

Page page1 = doc.Pages.Add();

// Create an image object

Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();

// Add the image into paragraphs collection of the section

page1.Paragraphs.Add(image1);

// Set the image file stream

image1.File = myDir + "test_out.bmp";

// Save resultant PDF file

doc.Save(myDir+"Image2PDF_DOM.pdf");


Please feel free to contact us for any further assistance.


Best Regards,