You can see such behavior for attached document "original.docx" page 12.
- Code: Select all
Document document = new Document(Settings.FileToProcess);
document.SaveToFile(Settings.FileToProcess.Replace(".docx", "_images.pdf"), Spire.Doc.FileFormat.PDF);
Document documentResult = new Document();
var section = documentResult.AddSection();
section.PageSetup.Margins.Top = 0f;
section.PageSetup.Margins.Bottom = 0f;
section.PageSetup.Margins.Left = 0f;
section.PageSetup.Margins.Right = 0f;
Image[] images = document.SaveToImages(Spire.Doc.Documents.ImageType.Bitmap);
document.Close();
foreach (var item in images)
{
Paragraph paragraph = section.AddParagraph();
paragraph.AppendPicture(item);
}