Images were misplaced when converted from word document

O’Keeffe’s Tube Bridge Crane Procedure.pdf (7.2 MB)
Hi Team,

We are converting a Word document which consists of Images to PDF using aspose API. But in the generated PDF, images were misplaced like coming on top of text content, which is not readable.

I have added optimization but that is causing the generated file to get damaged and unable to open it when using optimization.

Below are the optimization options used, once PDF generated unable to open it.

OptimizationOptions optimizationOptions = new OptimizationOptions();

optimizationOptions.setRemoveUnusedObjects(true);
optimizationOptions.setRemoveUnusedStreams(true);
optimizationOptions.setAllowReusePageContent(true);
optimizationOptions.setLinkDuplcateStreams(true);
optimizationOptions.setUnembedFonts(true);
optimizationOptions.getImageCompressionOptions().setCompressImages(true);
optimizationOptions.getImageCompressionOptions().setImageQuality(50);
optimizationOptions.getImageCompressionOptions().setResizeImages(true);
docPdf.optimizeResources(optimizationOptions);*/
docPdf.optimize();
O’Keeffe’s Tube Bridge Crane Procedure.docx (7.6 MB)

This issue is very critical as it is halting us from Go Live.

Do suggest if I am missing anything in optimization.

Thanks,
Santhosh Utla

@santhosh.utla,

Thank you for attaching the documents. Can you please also write the whole code snippet you are using?

I need to replicate the wrong conversion and then do another with the optimization for breaking the document.

This way, if we scale this to the dev team, they will have all the information needed.

public static SaveOutputParameters convertWordDocumentUsingAspose(String Source, String Destination) throws Exception {
//Load the Word document from Source

	try
	{
		if("Y".equalsIgnoreCase(props.getString("ASPOSE_LICENSE"))){
			com.aspose.words.License license= new com.aspose.words.License();
			FileInputStream fis=new FileInputStream(props.getString("ASPOSE_LICENSE_PATH"));
			license.setLicense(fis);
		}
		
	}
	catch(Exception e) {
		throw e;
	}

	/*
	 * orevious version code without password protected
	Document doc = new Document(Source);
	// Save as PDF at Destination
	doc.save(Destination);
	*/
	Document doc = null;
	try
	{
		doc = new Document(Source);
	}

	catch (Exception ex)

	{

		com.aspose.words.LoadOptions loadOps = new com.aspose.words.LoadOptions("");

		doc = new Document(Source,loadOps);

	}
	
	// Save as PDF at Destination
	doc.save(Destination);
	
	
	// Save as PDF at Destination
	SaveOutputParameters output = doc.save(Destination);         
	//return Document
	return output;
}

@santhosh.utla,

I am working on your post, but I want to be precise.

You are using Aspose.Words API to convert to Pdf, and not Aspose.Pdf API.

I am asking because the forum is separated by API, and your question is not clear enough, even your code, since it is not using fully qualified names, I am not sure what type of document are you using.

So my first question is:

  1. What Aspose API are you using for conversion from word to pdf?

  2. What version of the API are you using?

com.aspose.words.Document using for reading it

aspose using 21.3 version. Attached image for your reference.

image.png (4.9 KB)

Can we connect and discuss the issue? if this doesn’t clarify what is being mentioned.

Thanks,
Santhosh Utla

@santhosh.utla,

We cannot connect by any other mean than this forum.

I need you to clarify this even more now. You are using Aspose.Words for reading the document?

What Api are you using for converting the document?

Can you remake your code using fully qualified names so I can understand what are you trying to do, please?

Hi Here is the code with fully qualified names as requested.

public class TestConversion {
public static void main(String[] args) throws Exception {
String src = “C:\GG\Test\O’Keeffe’s Tube Bridge Crane Procedure.docx”;
String dest = “C:\GG\Test\O’Keeffe’s Tube Bridge Crane Procedure.pdf”;
com.aspose.words.Document doc = new com.aspose.words.Document(src);
Boolean acceptRedlines = true;
if(acceptRedlines){
doc.getRevisions().acceptAll();
}else{
doc.getRevisions().rejectAll();
}
// Save as PDF at Destination
doc.save(dest);
}
}

@santhosh.utla,

When trying to open this file this file using Aspose Pdf I found a bug.

So I will ask you a favor. I am going to create a bug for this post which means I cannot move this post to Aspose.Words forum.

Can you create another post in Aspose.Words forum? because that is the support you need. Not in Aspose.Pdf forum.

When creating the topic select the API “Aspose.Words Product Family”.

@santhosh.utla
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-54268

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thank you for creating the ticket.

We have created an issue with words family only but it was mentioned to create the ticket here. here is the ticket details

Please note that we are using JAVA for aspose api.

Thanks,
Santhosh Utla

@santhosh.utla,

No problem. I will explain. The Java version of Aspose.Pdf API is generated automatically from the C# and then added some customs changes. Since this issue is presented in the C# version, too, it must be corrected there so it can propagate the fix to the Java version.

We create Java tickets only when the issue is not presented in the C# version and only happens in the Java version.

I hope this clarifies any questions.