We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create or convert a Report to TIF Format

Is ASPOSE.Words the right component to use when I want to save or convert a data report as a TIF document? Our objective is to create a report by pulling the data from a database and through manipulation or conversion by some ASPOSE component get a finished report in TIF format. If ASPOSE.Words is not the right component, then what component can do what we want to do?

Hi

Thanks for your inquiry. You can convert Word document to collection of images using Aspose.Words.Viewer namespace. The Aspose.Words.Viewer namespace provides classes to render and print Word documents without utilizing Microsoft Word. See the following link for more information.

https://docs.aspose.com/words/net/convert-a-document-to-an-image/

But note this feature is currently in beta and limited technical support is provided for it. Hopefully this feature will be fully supported in Q4 2008 – Q1 2009. But I can’t promise anything.

Best regards.

Thank you for your reply. Is there code example of saving a Word document as a TIF somewhere?

Thank you!

Hi

Thanks for your inquiry. You can try using the following code:

Document doc = new Document(@"Test132\SpecimenTmplt7-1.docx");
DocumentRenderer renderer = new DocumentRenderer(doc);
PageNavigator navigator = new PageNavigator(renderer);
for (int i = 0; i < navigator.PageCount; i++)
{
    navigator.CurrentPage.Save(string.Format(@"Test132\page\_{0}.tiff", i), ImageFormat.Tiff);
    navigator.MoveToNextPage();
}

Hope this helps.

Best regards.

Thank you very much for your prompt response. I just have one more question. Is there a way to save the Word document as one multi-page TIF instead of a bunch of individual TIF files? Thank you again!

Ivan

Hi

Thanks for your inquiry.

I simplified this code. Please see the following code snippet.

public void Test132()
{
    Document doc = new Document(@"Test132\in.doc");
    DocumentRenderer renderer = new DocumentRenderer(doc);
    CombineTif(renderer.GetPages(), @"Test132\out.tiff");
}

///
/// Combine some file into 1 tif multipage file
///
/// the files to be combined, canbe (bmp, jpg, gif, png, tif)
/// the output filename
///
public static void CombineTif(Image[] InputImages, string OutputFilename)
{
    //get ImageCodecInfo, generate tif format
    ImageCodecInfo info = null;
    foreach (ImageCodecInfo ice in ImageCodecInfo.GetImageEncoders())
    {
        if (ice.MimeType == "image/tiff")
        {
            info = ice;
            break;
        }
    }

    //define the encoderparameter,
    //when the 1st page, will be EncoderValue.MultiFrame.
    //when the other pages, will be EncoderValue.FrameDimensionPage.
    //when all pages saved, will be the EncoderValue.Flush.
    EncoderParameters ep = new EncoderParameters(2);

    //when the 1st file, 1st frame, will be true.
    //from the 1st file, 2nd frame, will be false.
    bool isFirstPage = true;
    Image img = null;

    //create a image instance from the 1st image
    for (int imgIndex = 0; imgIndex < InputImages.Length; imgIndex++)
    {
        //get image from src file
        Image img_src = InputImages[imgIndex];
        ep.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Compression, Convert.ToInt32(EncoderValue.CompressionLZW));
        if (isFirstPage)
        {
            //1st file, 1st frame, create the master image
            img = img_src;
            ep.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.SaveFlag, Convert.ToInt32(EncoderValue.MultiFrame));
            img.Save(OutputFilename, info, ep);
            isFirstPage = false;
            continue;
        }
        ep.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.SaveFlag, Convert.ToInt32(EncoderValue.FrameDimensionPage));
        img.SaveAdd(img_src, ep);
    }
    ep.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.SaveFlag, Convert.ToInt32(EncoderValue.Flush));
    img.SaveAdd(ep);
}

I hope this could help you.

Best regards.

Thank you very much for your help. I appreciate your support very much.

We purchased ASPOSE.Total Enterprise in 2007 and the version is 2.1. Is the Aspose.Words.Viewer namespace that you are refering to in that version? Because you mentioned that the feature is in Beta, I am wondering if perhaps our version does not include the feature you are referring to. Thanks in advance for your response.

Hi

Thanks for your inquiry. This feature is available in .NET version of Aspose.Words only.

Best regards.

Thanks for all your support. I have made a lot of progress on this project and my question now is licensing. Let me summarize what I have done and you can tell me how to get the licensing to work.

I wrote a .NET wrapper assembly with VS 2005. The project is a VB class library that contains a COM class. I compiled this project with VS 2005 and then in Visual Basic 6 I reference this .NET wrapper assembly in my VB6 app. When this VB6 app calls my functions to convert a PDF file to TIF, everything works great.

The problem now is, the TIF file has the “Evaluation Only. Created with ASPOSE.PDF.PDFKit” watermark. We purchased the ASPOSE.Total license. Where am I supposed to place the ASPOSE.TOTAL.lic file in order to eliminate the “Evaluation” watermark?

Thank you for your help!

Ivan

Hi

Thanks for your inquiry. Please make sure that you set license as described here:

https://docs.aspose.com/words/net/licensing/#using-multiple-aspose-products

Note that you should set license for each Aspose product you are using.

Best regards.

We are happy to tell you that the new Rendering Engine has replaced the “old Viewer Beta”. The Rendering Engine can print, save as images or draw onto .NET Graphics object any document page.

Please see Aspose.Words documentation to learn more about new features.

Saving to image

In additional, new Rendering engine allows you to convert Word document to PDF directly (without using Aspose.Pdf).

Saving to Pdf

The latest version of Aspose.Words is available for download from downloads section or from NuGet