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

Free Support Forum - aspose.com

Formatting Issue with aspose-pdf when converting pdf to doc format

Hi,

I am using aspose-pdf-16.11.0 to convert pdf to doc document.

Below is the sample code:

public void generateDocReport() {
try {
// Create license object
com.aspose.pdf.License license = new com.aspose.pdf.License();
// Load the license file into FileStream object
InputStream licence = new FileInputStream(new File(“E://Reports//Aspose.Pdf.lic”));
license.setLicense(licence);

// Load source PDF file
InputStream reportDoc = new FileInputStream(new File(“E://Reports//Assessment Summary.pdf”));
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(reportDoc);

com.aspose.pdf.DocSaveOptions saveOptions = new com.aspose.pdf.DocSaveOptions();
// Set output file format as DOCX
saveOptions.setFormat(com.aspose.pdf.DocSaveOptions.DocFormat.Doc);
// Save resultant DOCX file
pdfDocument.save(“E://Reports//Assessment Summary Doc.doc”, saveOptions);
reportDoc.close();
} catch (Exception e) {
throw new RuntimeException(“Error thrown while generating doc using Aspose.pdf.”
+ e.getLocalizedMessage(), e);
}
}


After running above program “Assessment Summary Doc.doc” file generates successfully. However there are formatting issues. Please open the attached generated doc file and go to page number 4. There look at the formatting of last row “Workload, Cost Optimized 3-yr”, text are cut from the top. Also spacing is missing between words on table header ComputeStorageNetwork".

Please resolve this ASAP and let me know.

I am attaching both Assessment Summary.pdf and generated
Assessment Summary Doc.doc file.

Thanks
Kamal Sethiya

Hi Kamal,


Thanks for your inquiry. I have tested the scenario and noticed your reported formatting issue in resultant DOC file, so logged following issues in our issue tracking system for further investigation and rectification. We will notify you as soon as these issues are resolved.

PDFJAVA-36443: Text spacing issue between header row
PDFJAVA-36444: Text cut off from top

We are sorry for the inconvenience.

Best Regards,

Hi,

I am facing one more issue related to style when converting pdf to doc. I am attaching Comparison Report.pdf for input to program and Comparison Report.doc file generated after conversion. Please go to page number 5 of Comparison Report.doc file. There if you see first and second table’s 2nd and 3rd row data; alignment is not correct (data for Total and Compute sub herder is not aligned with other data on same row). Also spacing is missing between sub header (<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><span style=“font-size:14.0pt;mso-bidi-font-size:11.0pt;
font-family:UDJIGA+Roboto-Regular;mso-fareast-font-family:Calibri;mso-hansi-font-family:
Calibri;mso-bidi-font-family:“Times New Roman”;color:#00A6FF;letter-spacing:
.15pt;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA”>ComputeStorageNetwork<!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

<![endif]–>).


Could you please let me know by when this issue and above both issues
will be resolved? Actually without above fixes we won’t be able to release
one of the major feature on our product. We are using aspose.pdf OEM
licence.

Thanks
Kamal

Hi Kamal,


Thanks for your inquiry. I have tested the scenario with your new source file and noticed the text spacing issue in header row and alignment issue in table rows. Text spacing issue is related to PDFJAVA-36443 and logged another issue PDFJAVA-36460 for data alignment issue.

Furthermore, I am afraid we can not share any timeline at the moment, as we have recently noticed the issues. We will be in good position to share an ETA as soon as issues’ investigation is completed.

We are sorry for the inconvenience.

Best Regards,

Hi Kamal,


Thanks for your patience. We have tested the scenario with 17.1.0 and noticed that alignment issue PDFJAVA-36460 is fixed in this version. Please download latest version of Aspose.Pdf for Java, it will help you to resolve the issue. We will keep you updated about resolution progress of other logged issues.

Best Regards,

@kamal-1,

Thanks for your patience.

We are pleased to share that the issue reported earlier as PDFJAVA-36444, is resolved in latest release of Aspose.Pdf for Java 17.7. Please try using the latest release version and in case you encounter any issue or you have any further query, please feel free to contact.