Free Support Forum - aspose.com

Re: no exampls for aspose.pdf

That is disappointing. My company bout Aspose Total with the intent of being able to create pdf documents from scratch using the DOM model. When can I expect that will be made available? For now I am using the doc package. The probelm I am having is it is trying to find the document named with the date and time on my system. And it can’t find it because it is not there. I don’t want to write the file to the local disk, I just want to stream the data to the client. And they can save or print it as they see fit. I tried to follow the demo on creating a document on you website, but it is looking for a template document. I fails on this line Document doc = new Document(mDocumentsDir + “.doc”); because ti can’t find the file. Can it just create a file in memory and send it back to the client without saving it on the local system? If so how do I make that happen?


David
davidac321:
My company bout Aspose Total with the intent of being able to create pdf documents from scratch using the DOM model. When can I expect that will be made available?
Hi David,

Thanks for contacting support.

Please note that the current version of Aspose.Pdf for Java supports the feature to create PDF files from scratch and once the file is generated, you can save it into Stream object. Please note that DOM approach will be a new approach where you can use Document class to create as well as manipulate existing PDF files. Currently we have Aspose.Pdf.Kit for Java to manipulate existing PDF files but once the new AutoPorted version becomes available, you can use a single product to create as well as manipulate existing PDF files.

davidac321:
For now I am using the doc package.
As per my understanding, you are using Aspose.Words for Java to create PDF files. Please note that Aspose.Words for Java supports the feature to create as well as manipulate existing DOC files. However it also supports the feature to render the DOC file into PDF format. You cannot directly use this component to create PDF file.

davidac321:
The problem I am having is it is trying to find the document named with the date and time on my system. And it can't find it because it is not there. I don't want to write the file to the local disk, I just want to stream the data to the client. And they can save or print it as they see fit. I tried to follow the demo on creating a document on you website, but it is looking for a template document. I fails on this line Document doc = new Document(mDocumentsDir + ".doc"); because ti can't find the file. Can it just create a file in memory and send it back to the client without saving it on the local system? If so how do I make that happen?
As far as I can understand, you are using Document class present inside Aspose.Words for Java to load an existing DOC file but I am not entirely certain about the reasons of this issue. I am moving this thread to respective forum where my fellow workers from Aspose.Words team will further look into the details of this problem and will keep you posted with the status of correction.

Please be patient and spare us little time. We are sorry for this inconvenience.

Hi David,


Thanks for your inquiry and sorry for the delayed response. I am going to address your query about Aspose.Words.

I think, you need to implement an HTTPServlet before you can send the document to the client’s browser. You can find a demo example with full code in the demo folders that are included with the install file for Aspose.Words Java. This is located where you installed the Java version, inside “\Demos\Aspose.Words.Demos.Web</b>”.

Using the servlet you can send the document to a browser like in the example code below which sends a .doc file to the browser.
response.setContentType(“application/msword”);
doc.save(response.getOutputStream(), SaveFormat.FORMAT_DOCUMENT);
I hope, this helps.

Best regards,