Hi,
We have requirement that, convert text file to PDF while dowloading Text file.
So, can you please help me how to fulfil the requirement and provide the source code?
Regards,
RSY
Hi,
We have requirement that, convert text file to PDF while dowloading Text file.
So, can you please help me how to fulfil the requirement and provide the source code?
Regards,
RSY
Hi Subramanum,
Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word do. If you convert your text file to Docx format by using MS Word, you will get the same output. Please use the following code snippet to convert text file into Pdf file format.
LoadOptions opt = new LoadOptions();
opt.setLoadFormat(LoadFormat.TEXT);
Document doc = new Document(MyDir + "text.txt", opt);
doc.save(MyDir + "out.pdf", SaveFormat.PDF);
Moreover, please read supported features of plain text (txt) import/export from here:
https://docs.aspose.com/words/java/save-a-document/
https://docs.aspose.com/words/java/create-or-load-a-document/
It would be great if you please share some more detail about your query what do you mean by ‘convert text file to PDF while dowloading Text file’. We will then provide you more information on this along with code.
Hi,
Thanks for your quick replying, I will check your reply.
I am explaining our requirement:-
Currently, we are uploading TXT file from application and store in database. example for storing format http://3.61.124.175:29081/icmrm/ICMResourceManager?order=retrieve&item-id=A1001001A08D22A73828E35681&version=1&collection=CBR.CLLCT001&libname=icmnlsdb&update-date=2008-04-22+11%3A38%3A29.554928&token=A4E6.G.49HE6_CSN4ABNj8OA;&content-length=0&org-filename=1111111111.MR.20080328000000.txt
Displaying the same file in applet viewer as TXT format on front end screen. On the same screen We have provided button named as “Download” for downloading the same document on text format.
Requirement:- When the user click on “Download” button, the document will be displayed in “PDF format” file.
This is the scenario. Please ask me freely if you have any queries
Regards,
RSY Narayan
Hi RSY Narayan,
Thanks for sharing the detail. Unfortunately, Aspose.Words does not load document from URI. We had already logged this feature request as WORDSNET-333 in our issue tracking system. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.
In your case, you need to download file and pass java.io.InputStreamstream to Document’s constructor. Please read about Aspose.Words.Document’s Constructor from here:
https://reference.aspose.com/words/java/com.aspose.words/Document
The issues you have found earlier (filed as WORDSNET-333) have been fixed in this .NET update and this Java update.
Hi,
Thanks for your reply.
I will check and inform to you once implemented on development.
Now you can close the issue and I will raise new thread if got any issue.
Regards,
RSY Narayan
Hi RSY Narayan,
Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.