We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Shifted margins after conversion from PDF to DOC

Hello,

I am having trouble with margins on doc file after conversion from pdf using Aspose.PDF for Java. The problem are shifted margins in doc file compared to one in pdf. For test, I created docx file with default margins (test_init.docx) and saved it as pdf (test.pdf). Using code snippet below, I converted test.pdf to doc file (test_result.doc). After conversion you can see margins aren’t set to default as the one in initial docx file.

    	Document doc = new Document("c:\\temp\\test.pdf");
		DocSaveOptions saveOptions = new DocSaveOptions();
		saveOptions.setMode(DocSaveOptions.RecognitionMode.Flow); 
		doc.save("c:\\temp\\test.doc", saveOptions);

I am using Aspose.PDF version 20.6-jdk 1.7. All mentioned files you can find in zip attachment.test.zip (46.6 KB)

Thank you in advance,
BR

@anacosic91

We have tested the scenario with Aspose.PDF for Java 20.9 and did not observe margins related issue. The margins were same in both input output files. However, we observed that some line breaks were removed and lines were merged in the paragraph in output DOCX as shown in attached image.

Would you please confirm if same is the issue you are facing? Otherwise, please share some screenshot of the margin differences which you are noticing so that we can further proceed accordingly.

linebreakremove.png (15.8 KB)

I haven’t noticed problem with line breaks until you mentioned. My problem is with text boundaries. You can see different ruler positions in test_init.docx and test_result.doc. Also, when enabled advanced option in Word “Show text boundaries” you can see difference between files. I hope screenshot in attachment will be more helpful. textboundaries.png (69.3 KB)

@anacosic91

Thanks for further elaborating the issue.

We have logged it as PDFJAVA-39800 in our issue tracking system and will further investigate it. We will inform you as soon as we have additional updates regarding its resolution. Please be patient and spare us some time.

We apologize for the inconvenience.