Hello.
I am trying to convert docx-files to pdf-files using DocxFormatProvider to import the files, and using PdfFormatProvider to export the files. This works fine in most cases, but it seems that images that are not inline are missing from the generated pdf-file.
Example:
If I have a word-file with 2 images and some text. One image is inline, another is not (lets say it has the text-wrap setting to "square"). I import the docx-file to a RadFlowDocument. The inline image gets detected in the RadFlowDocument as ImageInLine, while the image with text-wrap gets detected as FloatingImage. In the end I export as PDF and save it locally. When I open the PDF, only text and the inline image is showing, the floating (text-wrapped) image is gone.
Is there a way to keep all images when converting from docx to pdf?
Here is a snippet of my code:
I am trying to convert docx-files to pdf-files using DocxFormatProvider to import the files, and using PdfFormatProvider to export the files. This works fine in most cases, but it seems that images that are not inline are missing from the generated pdf-file.
Example:
If I have a word-file with 2 images and some text. One image is inline, another is not (lets say it has the text-wrap setting to "square"). I import the docx-file to a RadFlowDocument. The inline image gets detected in the RadFlowDocument as ImageInLine, while the image with text-wrap gets detected as FloatingImage. In the end I export as PDF and save it locally. When I open the PDF, only text and the inline image is showing, the floating (text-wrapped) image is gone.
Is there a way to keep all images when converting from docx to pdf?
Here is a snippet of my code:
var providerDocx =
new
DocxFormatProvider();
var document = providerDocx.Import(inStream);
//inStream is read from a docx file earlier
var providerPdf =
new
PdfFormatProvider();
Stream outStream =
new
MemoryStream();
providerPdf.Export(document, outStream);
//Test the conversion:
var fileStream = File.Create(
"PdfTest.pdf"
);
outStream.Seek(0, SeekOrigin.Begin);
outStream.CopyTo(fileStream);
fileStream.Close();