Hi,
I am facing the problem that when converting the pdf file to doc file, everything looks fine, however, when I converted the converted doc file back to pdf file, it’s not the original pdf file, the format is corrupted. (for example, there is no margin)
See the below code and the attached files for a simple example.
Thanks,
Iris
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section _sec1 = pdf1.Sections.Add();
Aspose.Pdf.Generator.Table tab = new Aspose.Pdf.Generator.Table();
tab.DefaultCellBorder = new Aspose.Pdf.Generator.BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, 0.0F);
tab.Margin.Left = 20;
tab.Margin.Right = 20;
tab.Margin.Top = 30;
tab.Margin.Bottom = 30;
tab.ColumnWidths = “555”;
_sec1.Paragraphs.Add(tab);
Aspose.Pdf.Generator.TextInfo tiFontCompanyName = new Aspose.Pdf.Generator.TextInfo()
{
FontName = “Arial”,
FontSize = 20,
IsTrueTypeFontBold = true,
Color = new Aspose.Pdf.Generator.Color(“Black”)
};
Aspose.Pdf.Generator.TextInfo tiFontCompanyAddress = new Aspose.Pdf.Generator.TextInfo()
{
FontName = “Arial”,
FontSize = 12,
IsTrueTypeFontBold = true,
Color = new Aspose.Pdf.Generator.Color(“Black”)
};
//Add company name
Aspose.Pdf.Generator.Row row = tab.Rows.Add();
Aspose.Pdf.Generator.Cell cell = row.Cells.Add();
cell.Paragraphs.Add(new Aspose.Pdf.Generator.Text(“Company Name”, tiFontCompanyName));
//Add Company address
row = tab.Rows.Add();
cell = row.Cells.Add();
cell.Paragraphs.Add(new Aspose.Pdf.Generator.Text(“Company address 1”, tiFontCompanyAddress));
row = tab.Rows.Add();
cell = row.Cells.Add();
cell.Paragraphs.Add(new Aspose.Pdf.Generator.Text(“Company address 2”, tiFontCompanyAddress));
row = tab.Rows.Add();
cell = row.Cells.Add();
cell.Paragraphs.Add(new Aspose.Pdf.Generator.Text(“Company address 3”, tiFontCompanyAddress));
pdf1.Save(@“C:\temp\CoverPage1.pdf”);
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(@“c:\Temp\CoverPage1.pdf”);
// Save the file into a Microsoft document format
pdfDocument.Save(@“c:\Temp\CoverPage1.doc”, Aspose.Pdf.SaveFormat.Doc);
//Convert the doc file to pdf
Aspose.Words.Document dd = new Aspose.Words.Document(@“c:\Temp\CoverPage1.doc”);
dd.Save(@“c:\Temp\CoverPage1.doc.pdf”, Aspose.Words.SaveFormat.Pdf);