We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Converting docx to Pdf in a docker container

Thread ID:

Created:

Updated:

Platform:

Replies:

141856 Jan 8,2019 11:08 AM UTC Jan 10,2019 05:00 PM UTC ASP.NET Core - EJ 2 3
loading
Tags: DocIO
Ootam Seewoogoolam
Asked On January 8, 2019 11:08 AM UTC

Hi guys,

I am trying to convert a docx file to pdf in a docker container. The font height is messed up in the generated pdf.
Below is the original docx file 


Once generated via docker container, the pdf font height spacing is incorrect



I have attached a sample solution to demonstrate the issue. once you have downloaded the zip folder, execute the build.cmd to publish the console app and then execute the run.cmd to run the app. you will get the generated pdf in the publishOutput folder



Please treat this as urgent. Waiting for your reply.
Thanks
Ootam


Attachment: DockerDocumentGeneration_7081f09f.zip

Karthikeyan Chandrasekar [Syncfusion]
Replied On January 9, 2019 12:25 PM UTC

Hi Ootam, 
From the given details and the code snippet, we have found that you used SubstituteFontEventHandler to set alternate font if the font not installed in the environment. 

We suggest you to use the below modified code snippet in your application to set alternate font when a specified font is not installed in the production environment.  
wordDocument.FontSettings.SubstituteFont += (sender, eventArgs) =>  
{  
    // Sets the alternate font when a specified font is not installed in the production environment.   
    if (eventArgs.OriginalFontName == "Arial")  
    {  
        FileStream template = new FileStream(@"Arial.ttf", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);  
        eventArgs.AlternateFontStream = template;  
    }  
    else if (eventArgs.OriginalFontName == "Calibri")  
    {  
        FileStream template = new FileStream(@"Calibri.ttf", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);  
        eventArgs.AlternateFontStream = template;  
    }  
    else if(eventArgs.OriginalFontName == "Arial Unicode MS")  
    {  
        FileStream template = new FileStream(@"ARIALUNI.TTF", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);  
        eventArgs.AlternateFontStream = template;  
    }  
};  

If you are still facing the preservation problem, could you please provide us the generated PDF document and the fonts (font files *.ttf) used at your end. This will be more be more helpful to analyze on the reported problem and will provide you the solution at the earliest. 

Regards, 
Karthikeyan  


Ootam Seewoogoolam
Replied On January 9, 2019 02:46 PM UTC

Hi Karthikeyan,

In my previous post, I have attached the full test solution which you can run on your side and get the output i have attached 'PublishOutput_f937e896.rar'

I have tested the proposed solution and does not resolve the issue. Please try running the solution in linux docker.

Thanks again
Ootam


Attachment: PublishOutput_f937e896.rar

Karthikeyan Chandrasekar [Syncfusion]
Replied On January 10, 2019 05:00 PM UTC

Hi Ootam, 
With this details we can reproduce the reported preservation problem and it will be fixed in our 2018 Volume 4 SP1 release which is expected to be available on February, 2019 
Regards, 
Karthikeyan  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;