Gettting the error
SEVERE: Parameter name: pageCount
when converting attached docx to tiff
Does not return the stream for second page.
Hello Anil,
The issues you have found earlier (filed as CONVERSIONJAVA-96) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by GroupDocs Notifier.
(1)
Version 1.2.
I am just using what was given in the sample to convert a test document. Below is the code
package com.test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import com.groupdocs.conversion.config.IConfig;
import com.groupdocs.conversion.converter.options.ImageSaveOptions;
import com.groupdocs.conversion.handler.ConversionHandler;
public class TestConversion {
public static void main(String[] args) throws Exception {
File file = new File(“c:/temp/test.docx”);
InputStream in = new FileInputStream(file);
byte[] b = new byte[(int) file.length()];
in.read(b);
in.close();
List list = convertToTiff(“test.docx”, b);
for (int i = 0; i < list.size(); i++) {
FileOutputStream out = new FileOutputStream(“c:/temp/test” + i + “.tiff”);
out.write(list.get(i).toByteArray());
out.close();
}
}
public static List convertToTiff(String fileName,
byte[] fileContents) {
ConversionHandler conversionHandler = new ConversionHandler(
new IConfig() {
@Override
public String getStoragePath() {
return null;
}
@Override
public String getLicensePath() {
return “c:/temp/GroupDocs.Conversion.lic”;
}
@Override
public String getFileSavePath() {
return null;
}
});
ImageSaveOptions imageSaveOptions = new ImageSaveOptions();
imageSaveOptions.setSaveFileType(ImageSaveOptions.TIFF);
InputStream inStream = new ByteArrayInputStream(fileContents);
try {
ArrayList tiffStreamList = conversionHandler
.convertToImage(inStream, fileName, imageSaveOptions);
return tiffStreamList;
} catch (Exception ex) {
throw new RuntimeException(
“Error converting input document to tiff”, ex);
} finally {
try {
inStream.close();
} catch (IOException e) {
// so;
}
}
}
}
Hello,
Best regards,
Evgen Efimov
http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+
Best regards,
Evgen Efimov
http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+