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

Free Support Forum - aspose.com

DOCX to PDF conversion issue with paragraph margins, drawing charts, Text in tables using .NET

Hi,
I have issues with converting docx files as byte stream to pdf. There are cases sometimes when paragraphs are moved down slightly causing extra page in an output file. I’m using Aspose.Words v20.7.0 and .NET Core 3.1. I was experimenting with document.CompatibilityOptions.OptimizeFor( Aspose.Words.Settings.MsWordVersion.Word2010 ); and other compability options but without success. Original docx files are created in Word 2010. Obviously I can’t provide you the incoming byte streams so I’ve saved them into file with Aspose.Words as an example.
package.zip (482.3 KB) (filenames are self-explanatory). This is just one example, we have cases where slightly misplaced chart makes few columns covered by text or where word doesn’t fit in the table image (1).png (43.9 KB)
Capture.PNG (61.0 KB)

My source code:
LoadOptions loadOptions = new LoadOptions( )
{
LoadFormat = LoadFormat.Docx,
MswVersion = Aspose.Words.Settings.MsWordVersion.Word2010,
};
var document = new Aspose.Words.Document( new MemoryStream( input.DocxBytes ), loadOptions );
document.WarningCallback = new HandleDocumentCallback( );
document.CompatibilityOptions.OptimizeFor( Aspose.Words.Settings.MsWordVersion.Word2010 );

            document.UpdatePageLayout( );
            document.UpdateTableLayout( );
            document.UpdateFields( );
            using( MemoryStream ms = new MemoryStream( ) )
            {
                PdfSaveOptions saveOptions = new PdfSaveOptions
                {
                    SaveFormat = SaveFormat.Pdf,
                    Compliance = PdfCompliance.Pdf17
                };
                document.Save( ms, saveOptions );
            }

I have tried literally everything, most of the issues I had were fixed with adding document.CompatibilityOptions.OptimizeFor( Aspose.Words.Settings.MsWordVersion.Word2010 ); , have no idea what could fix these pointed here. Looking for any help/tips :slight_smile:
Marcin

@mradziszewski

Could you please ZIP and attach the font ‘Univers LT 45 Light’ here for testing? We will investigate he issue and provide you more information on it.

univers.zip (59.0 KB)

@mradziszewski

We have tested the scenario and logged the following issues in our issue tracking system.

WORDSNET-20854 : Contents are pushed down to next page after conversion from DOCX to PDF
WORDSNET-20855 : Chart does not render correctly in output PDF

You will be notified via this forum thread once these issues are resolved. We apologize for your inconvenience.

Hi,
it’s been almost 1 month already. Do you know when these issues are going to be fixed?

@mradziszewski

We regret to share with you that your issue (WORDSNET-20854) has been postponed due to missing feature WORDSNET-18674 (Column balancing) which is related to your issue.

After the fix of WORDSNET-20854, we will look into your issue. We will be sure to inform you via this forum thread as soon as this feature is available.

Currently, WORDSNET-20855 is pending for analysis and is in the queue. Once we complete the analysis of this issue, we will then be able to provide you an estimate.

The issues you have found earlier (filed as WORDSNET-20855) have been fixed in this Aspose.Words for .NET 21.8 update and this Aspose.Words for Java 21.8 update.