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?
Why do you need the image, the program won’t compile with the block of code copied from your site.
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,
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 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”)
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.
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?