Click here to Skip to main content
15,900,906 members

Comments by Member 11834242 (Top 5 by date)

Member 11834242 25-Jul-15 5:16am View    
can u suggest me the changes i need to make in my code.

in my code i have specified the locatio by "new Program().generateImages("E:\\pro2\\Document.docx");"
but while making an application, i am not allowed to define the path earlier , so what changes are required?
Member 11834242 15-Jul-15 5:21am View    
if i have to make application or button where user would upload the path or file, how to put up this in my code
Member 11834242 15-Jul-15 5:20am View    
here is my code to convert .docx to .jpg

import com.aspose.words.Document;
import com.aspose.words.ImageSaveOptions;
import com.aspose.words.SaveFormat;

/**
* Created by me
*/
public class Program {


public static void main(String args[]) throws Exception {


new Program().generateImages("E:\\pro2\\Document.docx");
}

public void generateImages(final String sourcePath) {
try {
Document doc = new Document(sourcePath);
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
options.setJpegQuality(100);
options.setResolution(100);

for (int i = 0; i < doc.getPageCount(); i++) {
String imageFilePath = sourcePath + "_output_" + i + ".jpg";
options.setPageIndex(i);
doc.save(imageFilePath, options);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}




the only problem is i wish to make an application and take the file as an input from user instead of specifying the whole path and file name as i did on my code
Member 11834242 13-Jul-15 13:42pm View    
i am stucked at first part that is document to .jpeg conversion using java
Member 11834242 13-Jul-15 13:39pm View    
i am having trouble in using aspose.words for it