Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
365
Can I import TIF and Word Docs into a PDF?
posted

And I have a very urgent need to write TIF files and word DOC files to PDFs. 
Our products already use Infragistics... so I was hoping to elliminate the 3rd party tools we are having problems with and use Infragistics PDF creation.

I see that the Reporting Image component only supports .jpg and .png. 

need to create PDFs from two types of files of either one or both types of external network sourced files (each in a 'section' I guess (I am very new at this)):
.DOC Word documents, and/or
.TIF files - and the TIFs are possibly multi-paged (all were incoming faxs so would be full page - each on their own PDF page).

I am familiar with System.Drawing.Imaging - paging through a TIF and reading each frame into a MemoryStream object.
Is there a simple way to convert a TIF MemoryStream object to a JPG and save it? or can it be directly written to the PDF file?

My guesswork code ideas so far (not even close to debugging) has this for the TIF to PDF -

System.Drawing.Image imageIn = System.Drawing.Image.FromFile(imagePath);
Guid objGuid = imageIn.FrameDimensionsList[0];
FrameDimension objDimension = new FrameDimension(objGuid);
MemoryStream ms = new MemoryStream();
Infragistics.Documents.Reports.Graphics.Image img;
int pageCount = imageIn.GetFrameCount(FrameDimension.Page);
for (int i = 0; i < pageCount; i++)
{

                imageIn.SelectActiveFrame(objDimension, i);
                img = new Infragistics.Documents.Reports.Graphics.Image(imageIn);
// what type will img be??? do we need to hard-define it considering imageIn is a MS System.Drawing.Image component?
                image = section.AddImage(img);
                image.Width = new Infragistics.Documents.Reports.Report.FixedWidth(imageIn.Width);
                image.Margins.Top = 25;
}

 

I'm sure I'm missing a lot of stuff - if this is even remotely close???
Am I close - is there a better way?

Thanks,

Todd