PDF to Doc conversion only in Textbox mode?

Hi,


I try to convert my PDF to Doc, but the conversion is only in Textbox mode, i am not sure if there is something missing, but this is my code, can you take a look and let me know how to convert with Flow mode?

package com.pdfconverter;
import java.io.File;
import com.aspose.pdf.Document;
import com.aspose.pdf.SaveFormat;

public class FileConverter {

public String PDFtoDOC(String uploadPath, String fileName) throws Exception {

String convertedFile = "";
String pathConvetedFile = uploadPath + fileName;
Document pdfDocument = new Document(pathConvetedFile);

// remove filename extension
String fileNameWithoutExten = fileName;
final int lastPeriodPos = fileNameWithoutExten.lastIndexOf('.');


if (lastPeriodPos > 0) {
com.aspose.pdf.DocSaveOptions saveOptions = new com.aspose.pdf.DocSaveOptions();


saveOptions.setMode(com.aspose.pdf.DocSaveOptions.RecognitionMode.Flow);


pdfDocument.save(uploadPath + File.separator + fileNameWithoutExten.substring(0, lastPeriodPos) + ".doc", SaveFormat.Doc);


convertedFile = fileNameWithoutExten.substring(0, lastPeriodPos) + ".doc";


}

return convertedFile;

}

Hi Bilal,


Thanks for contacting support.

Can you please share some details regarding the issue you are facing i.e. is the conversion through Flow mode is not being completed or you are getting incorrect contents in resultant file or you are getting some exception/error during conversion. Also please share the resource file, so that we can test the scenario in our environment. We are sorry for this inconvenience.

Hi,


I mean that the conversion with this parameter: RecognitionMode.Flow is exactly as this parameter: RecognitionMode.Textbox;

The text in the converted doc file result are in many textbox, and what i want is to convert the PDF to Doc with Full text without textbox mode.

I don’t know if there is something missing with my code?


Hi Bilal,


Thanks for sharing the details.

I have tested the scenario and I am able to
notice the same problem. For the sake of correction, I have logged this problem
as PDFNEWJAVA-35179 in our issue tracking system. We will
further look into the details of this problem and will keep you updated on the
status of correction. Please be patient and spare us little time. We are sorry
for this inconvenience.


PS, we also request you to please share your sample PDF files, so that we consider those scenarios during the resolution of this problem.

Hi Bilal,


Thanks for your patience. We have further looked into the issue and found that you have created SaveOptions but did not use. Please check following code snippet, it will help you to accomplish the task.

String convertedFile = “”;<o:p></o:p>

String pathConvetedFile = testdata + "PDFNEWJAVA_35179/TERRA+Easy+Dock+Rahmen.pdf";

Document pdfDocument = new Document(pathConvetedFile);

// remove filename extension

String fileNameWithoutExten = "TERRA+Easy+Dock+Rahmen.pdf";

final int lastPeriodPos = fileNameWithoutExten.lastIndexOf('.');

if (lastPeriodPos > 0) {

com.aspose.pdf.DocSaveOptions saveOptions = new com.aspose.pdf.DocSaveOptions();

saveOptions.setMode(com.aspose.pdf.DocSaveOptions.RecognitionMode.Flow);

saveOptions.setFormat(DocSaveOptions.DocFormat.Doc);

pdfDocument.save(c:/pdftest/TERRA+Easy+Dock+Rahmen-FLOW.doc", saveOptions);

convertedFile = fileNameWithoutExten.substring(0, lastPeriodPos) + ".doc";

}


Please feel free to contact us for any further assistance.

Best Regards,