Click here to Skip to main content
15,880,651 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i need java code (full) which takes document file as an input, generates its image in .jpeg format and then change it to password protected pdf(.pdf) file.

if possible give the full code taht to even gui based java code.
Posted
Comments
[no name] 13-Jul-15 13:32pm    
We are not a write-code-to-order service. You should go to a site like www.vworker.com where you can find someone to hire to write this code for you.
Sergey Alexandrovich Kryukov 13-Jul-15 13:39pm    
I would also ask: why doing so?
—SA

1 solution

No one is just going to give you all the code to do this. We would love to help you so if you get stuck on something specific, please come back and post the relevant code you have and show us where you are stuck.
 
Share this answer
 
Comments
Member 11834242 13-Jul-15 13:39pm    
i am having trouble in using aspose.words for it
Member 11834242 13-Jul-15 13:42pm    
i am stucked at first part that is document to .jpeg conversion using java
ZurdoDev 13-Jul-15 13:48pm    
OK, Please open a new question, show the relevant code only, and be clear about where you are stuck. That way someone can help you.
Member 11834242 15-Jul-15 5:20am    
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 15-Jul-15 5:21am    
if i have to make application or button where user would upload the path or file, how to put up this in my code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900