Hi Gloria,
I have a different output at my end even after appending the docs with a trial account. Please check the attached outputs. Page1.doc is converted from Page1.pdf to DOC and Proposal1.doc is the result of Page1.doc and Page2.doc. I have used the following code to merge the documents:
SaasposeApp.setAppKey("89*****************");
SaasposeApp.setAppSID("77************************");
// specify product URI
Product.setBaseProductUri("http://api.saaspose.com/v1.0");
try {
String mainDocument = "C:\\Page1.doc";
String appendDocument = "C:\\Page2.doc";
com.saaspose.storage.Folder folder = new Folder();
folder.UploadFile(mainDocument, "");
folder.UploadFile(appendDocument, "");
String[] appendDocs = {"Page2.doc"};
String[] importFormatModes = { "KeepSourceFormatting" };
com.saaspose.words.Document document =new com.saaspose.words.Document(new File(mainDocument).getName());
document.AppendDocument(appendDocs, importFormatModes, "");
InputStream responseStream = folder.GetFile(new File(mainDocument).getName());
Folder.SaveStreamToFile("C:\\Proposal1.doc", responseStream);
responseStream.close();
System.out.println("Done");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Can you please confirm if your Page1.doc is same as attached? I have used the following code to convert Page1.pdf to Page1.doc:
String inputFile = "C:\\Page1.pdf";
//build URI
String strURI = com.saaspose.common.Product.getBaseProductUri() + "/pdf/convert?format=" + com.saaspose.pdf.SaveFormat.DOC;
//sign URI
String signedURI = Utils.Sign(strURI);
InputStream fileStream = new FileInputStream(inputFile);
//get response stream
InputStream responseStream = Utils.ProcessCommand(signedURI, "PUT", fileStream);
Folder.SaveStreamToFile("C:\\Page1.doc", responseStream);
responseStream.close();
Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team
http://www.saaspose.com