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. Image for the cookie policy date
close icon

Converting docx to Pdf in a docker container

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

3 Replies

KC Karthikeyan Chandrasekar Syncfusion Team 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  



OS Ootam Seewoogoolam 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


KC Karthikeyan Chandrasekar Syncfusion Team 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  


Loader.
Live Chat Icon For mobile
Up arrow icon