when I print the docx file as a pdf. the table margins do not match those in the docx file

I have a word file, containing tables.
why when I create a generate function to pdf, this table shifts?

please help me


in pdf


in word

this is my code to generate pdf

 public JObject GeneratePDF([FromBody] JObject json)
 {
     JObject jsonOut = new JObject();
     int statusCode = 200;

     try
     {
         string filename = json.GetValue("filename").ToString();
         ComponentInfo.SetLicense(lc.decrypt(dbconn.SettingConvert("license_gembox_doc")));

         string PathSave = dbconn.SettingConvert("pathSave");
         if (json.ContainsKey("path_save") && json.GetValue("path_save").ToString() != "")
         {
             PathSave = json.GetValue("path_save").ToString();
         }
         string startupPath = Directory.GetCurrentDirectory();
         string save = startupPath + PathSave + filename;

         DocumentModel document = DocumentModel.Load(startupPath + PathSave + filename + ".docx");
         FontSettings.FontsBaseDirectory = startupPath + PathSave + "HelveticaNeue.ttf";

         foreach (Section section in document.Sections)
         {
             section.PageSetup.PaperType = PaperType.Letter;
             section.PageSetup.Orientation = Orientation.Landscape;
             section.PageSetup.PageMargins.Left = 40;
             section.PageSetup.PageMargins.Right = 40;
             section.PageSetup.PageMargins.Top = 40;
             section.PageSetup.PageMargins.Bottom = 40;
         }

         foreach (Paragraph paragraph in document.GetChildElements(true, ElementType.Paragraph))
         {
             paragraph.ParagraphFormat.SpaceAfter = 1.15;

             foreach (Run run in paragraph.GetChildElements(true, ElementType.Run))
             {
                 string text = run.Text;

                 if (text.Contains("bold"))
                 {
                     run.CharacterFormat.Bold = true;
                 }

                 if (text.Contains("italic"))
                 {
                     run.CharacterFormat.Italic = true;
                 }

                 if (text.Contains("bolditalic"))
                 {
                     run.CharacterFormat.Bold = true;
                     run.CharacterFormat.Italic = true;
                 }

                 run.CharacterFormat.FontName = "Helvetica Neue";
                 run.CharacterFormat.Size = 11;

             }
         }

         document.Save(save + ".pdf");

         jsonOut.Add("status", "Success");
         jsonOut.Add("message", mc.GetMessage("api_output_ok"));
         jsonOut.Add("data", filename + ".pdf");
     }
     catch (Exception ex)
     {
         statusCode = 500;
         jsonOut = new JObject();
         jsonOut.Add("status", mc.GetMessage("api_output_not_ok"));
         jsonOut.Add("message", ex.Message);
         jsonOut.Add("isSuccess", false);
         jsonOut.Add("code", statusCode);
     }
     return jsonOut;
 }

Hi Ryn,

Please send us your input file (startupPath + PathSave + filename + ".docx") so that we can reproduce this issue and investigate it.

Regards,
Mario