Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Mar 17, 2017 6:23 pm

Hi,
The code below results in a very inaccurate pdf file compared to the docx when using the latest version of the Spire.Office for WPF. It may be related to having nested tables.

Code: Select all
using System.IO;
using Spire.Doc;
using Spire.Doc.Documents;

namespace PdfProblem
{
   class Program
   {
      static void Main(string[] args)
      {
         using (Document doc = new Document())
         {
            doc.CreateMinialDocument();
            Section section = doc.Sections[0];
            Table table = section.AddTable(false);
            table.ResetCells(1, 2);
            table.PreferredWidth = new PreferredWidth(WidthType.Percentage, 100);
            table.TableFormat.LayoutType = LayoutType.Fixed;
            TableRow row = table.Rows[0];
            row.Cells[0].SetCellWidth(60, CellWidthType.Percentage);
            Table table1 = row.Cells[0].AddTable(false);
            table1.ResetCells(1, 1);
            table1.PreferredWidth = new PreferredWidth(WidthType.Percentage, 100);
            table1.TableFormat.LayoutType = LayoutType.Fixed;
            TableRow row1 = table1.Rows[0];
            row1.Cells[0].SetCellWidth(100, CellWidthType.Percentage);
            Paragraph paragraph = row1.Cells[0].AddParagraph();
            paragraph.AppendText("1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0");
            table1 = row.Cells[1].AddTable(false);
            table1.ResetCells(1, 1);
            table1.PreferredWidth = new PreferredWidth(WidthType.Percentage, 100);
            table1.TableFormat.LayoutType = LayoutType.Fixed;
            row1 = table1.Rows[0];
            row1.Cells[0].SetCellWidth(100, CellWidthType.Percentage);
            paragraph = row1.Cells[0].AddParagraph();
            paragraph.AppendText("A_B_C_D_E_F_G_H_I_J_K_L_M_N_O_P_Q_R_S_T_U_V_W_X_Y_Z");
            if (File.Exists(Path.Combine(Path.GetTempPath(), "PdfProblem.docx")))
               File.Delete(Path.Combine(Path.GetTempPath(), "PdfProblem.docx"));
            doc.SaveToFile(Path.Combine(Path.GetTempPath(), "PdfProblem.docx"), FileFormat.Docx2013);
            if (File.Exists(Path.Combine(Path.GetTempPath(), "PdfProblem.pdf")))
               File.Delete(Path.Combine(Path.GetTempPath(), "PdfProblem.pdf"));
            ToPdfParameterList toPdf = new ToPdfParameterList() { CreateWordBookmarks = true };
            doc.SaveToFile(Path.Combine(Path.GetTempPath(), "PdfProblem.pdf"), toPdf);
         }
      }
   }
}


Thanks,
Mark

markeye3
 
Posts: 27
Joined: Wed Jul 29, 2015 5:59 pm

Mon Mar 20, 2017 3:40 am

Dear Mark,

Thanks for your inquiry and sorry for the late reply as weekend.
I have noticed the bad format in the result pdf and forwarded it to our Dev team for a solution. When there's any good news on it, I will notify you at once.
Sorry for the inconvenience caused.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri Apr 21, 2017 6:46 am

Hello Mark,

Glad to inform that your issue has been resolved and the hotfix(Spire.Office Platinum (Hot Fix) Version:2.15.8) is available now, please download and have a test.
Do not hesitate to contact us if you have any question.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri Apr 21, 2017 3:25 pm

Hi Jane,
Seems to be working now.
Thanks,
Mark

markeye3
 
Posts: 27
Joined: Wed Jul 29, 2015 5:59 pm

Mon Apr 24, 2017 1:59 am

Hello,

Thanks for your feedback.
Welcome to post if you have any doubt or issue.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.Doc