Insert PDF into Word as Image in C#

This short guide contains information on how to insert PDF into Word as image in C#. You will learn to set up the environment for using Aspose.Total for .NET, get a list of steps, and sample code for inserting PDF into Word as image in C#. Code enhancement will also be part of the article to get the desired output.

Steps to Insert PDF as Image in Word using C#

  1. Set the environment to use Aspose.Total for .NET to insert PDF as image in a DOCX
  2. Set the input PDF file and output DOCX file
  3. Apply a license for all the relevant products
  4. Load the PDF file into memory using the Document class
  5. Create a new empty Word file to insert images in it
  6. Set the image quality level and a converter for converting the PDF pages to PNG picture
  7. Iterate through each page in the PDF
  8. Change each page to PNG and save it into the Word document
  9. Add a page break after each image and save the resultant Word file

These steps describe insert PDF image into Word in C#. Load the source PDF file into the Document class, create a new empty Word file for saving images, set the quality of the images, and create a converter for converting the PDF pages into picture. Parse through each page in the PDF, transform it to an image, save it in the Word file, and save the resultant Word file.

Code to Insert PDF as Image into Word using C#

This code shows how to insert a PDF as an image into Word using C#. If you do not require photographic fidelity, consider using JpegDevice instead of PngDevice. Match the size/orientation of the Word file to the source PDF page via Page.Rect so images are not stretched.

This article describes the process of adding PDF as images in the Word file. To convert a scanned PDF to Word, refer to the article Convert scanned PDF to Word using C#.

 English