TiffExpectedFormat is not a member of Enums

Tried to use a code block from your site for converting Image files to TIFF. Receive message TiffExpectedFormat is not a member of Enums on following statement:
imagein.Save(“c:\output.tiff”, New Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default))

Complete code block from TiffOptions Configuration:

'Load an image through file path location or stream
Using image As Aspose.Imaging.Image = Aspose.Imaging.Image.Load(sourceFilePath)
'Create an instance of TiffOptions while specifying desired format
'Passsing TiffExpectedFormat.TiffJpegRGB will set the compression to Jpeg
'and BitsPerPixel according to the RGB color space
Dim options As New TiffOptions(TiffExpectedFormat.TiffJpegRGB)
'Save the result in Tiff format RGB with Jpeg compression
image.Save(destinationFilePath, options)
End Using

One more question, what statement would I use to set the resolution in above block of code?

Hi wayne,

Thank you for your inquiry.

Please note that we need the sample image that you are using at your end. This will help us to investigate the issue.

Why do you need the image, the program won’t compile with the block of code copied from your site.

Hi Wayne,

Please note that you can use following lines of code to set the resolution:

Dim options As Aspose.Imaging.ImageOptions.TiffOptions =
New Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.TiffJpegRGB)
options.ResolutionSettings = New Aspose.Imaging.ResolutionSetting(double horizontalResolution, double verticalResolution)

Furthermore the code snippet on the website is working fine. A Sample image has been attached with this reply for your reference. Please use the latest version of Aspose.Imaging for .Net and sample image in your code. In case the issue persists, feel free to contact us along with details. We will be glad to assist you.

I don’t know if you have a different version of Aspose or what because the code does not compile for me. I get the error listed above saying TiffExpectedFormat is not a member of enums. I checked properties on my version of Aspose.Imaging.dll an file version is 2.6.0.0 and Product Version is 2014.09.16.

Thanks for your help, I found an alternate way to accomplish what I wanted. I am currently making code changes to convert different file types to TIFF and PDF images. I am currently trying to convert text files to TIFF and PDF. I found a code snippet from your site that allows me to do this but I cannot figure out how to change the compression and resolution of the output tiff files. Is there a way to do this? Below is the code:
Dim tiffConvertPath = Path.ChangeExtension(ImageFileInputPath, “.tif”)
Dim pdfConvertPath = Path.ChangeExtension(ImageFileInputPath, “.pdf”)
Dim txt As String = File.ReadAllText(ImageFileInputPath)
Dim builder As New DocumentBuilder()
builder.Write(txt)
builder.Document.Save(tiffConvertPath)
builder.Document.Save(pdfConvertPath)

I am converting a multi-sheet excel spread sheet to TIFF. I found a code snippet on your site to convert the first sheet to a tiff. Is there a way to convert all sheets of a spreadsheet to a multipage tiff? Below is the code I found:
'convert XLSX to TIFF
Dim tiffConvertPath = Path.ChangeExtension(ImageFileInputPath, “.tif”)
'Dim document As Document = New Document(ImageFileInputPath)
Dim book As New Workbook(ImageFileInputPath)
'Get the first worksheet
Dim sheet As Worksheet = book.Worksheets(0)
'Apply different Image and Print options
Dim options As New Aspose.Cells.Rendering.ImageOrPrintOptions()
'Set Horizontal Resolution
options.HorizontalResolution = 300
'Set Vertical Resolution
options.VerticalResolution = 300
'Set TiffCompression
options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionLZW
'Set Autofit options
options.IsCellAutoFit = False
'Set Image Format
options.ImageFormat = System.Drawing.Imaging.ImageFormat.Tiff
'Set printing page type
options.PrintingPage = PrintingPageType.Default
'Render the sheet with respect to specified image/print options
Dim sr As New SheetRender(sheet, options)
'Render/save the image for the sheet
sr.ToImage(0, tiffConvertPath)

Hi Wayne,

Please note that your query is related to more then one APIs. I am forwarding your inquiry to the Aspose.Total forum where my colleagues from support team will answer according to their relevant areas.

Hi Wayne,

Thanks for your posting and using Aspose APIs.

You can use WorkbookRender.ToImage() method to convert your entire workbook into Tiff format.

Please see the following sample code for your reference. I have also attached the source excel file used in this code and the output Tiff image generated by it for your reference.

Note: Please remove .txt extension from the attached tiff image.

VB.NET

Dim workbook As New Workbook(“source.xlsx”)

Dim opts As New ImageOrPrintOptions()
opts.SaveFormat = SaveFormat.TIFF

’Save entire workbook to single Tiff image
Dim wr As New WorkbookRender(workbook, opts)
wr.ToImage(“output.tiff”)

Hi Wayne,

wbarber:
I don't know if you have a different version of Aspose or what because the code does not compile for me. I get the error listed above saying TiffExpectedFormat is not a member of enums. I checked properties on my version of Aspose.Imaging.dll an file version is 2.6.0.0 and Product Version is 2014.09.16.


Please note that you are getting this error because you are using an older version. It is always recommended to use the latest version as Aspose APIs update with time to time.


Thanks for everyone’s help, I have been able to work through all my issues.

My company purchased ASPOSE total, are we able to upgrade without additional cost?

Hi Wayne,

Thanks for the acknowledgement. We are glad to hear that your problem is resolved. Please continue using our API's and in the event of any further query, please feel free to contact us.

Furthermore you can upgrade/download the latest version without any additional cost only if you have a valid license.