Problems with Converting .doc to .pdf

When I convert a Word document to a PDF, I am getting some words overlapping each other. I’ve attached the one such document that results in this error. The overlapping words occurs on the first page under section 6b (the words and & the are printed on top of one another).

The code I am using to do the conversion is as follows:

Aspose.Words.Document sourceDoc = new Aspose.Words.Document(@"C:\Aspose Testing\testing.doc");
MemoryStream ms = new MemoryStream();
XmlDocument xml = new XmlDocument();
sourceDoc.Save(ms, Aspose.Words.SaveFormat.AsposePdf);
ms.Position = 0;
xml.Load(ms);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(xml, null);
ms.Close();
System.IO.MemoryStream pdfMS = new MemoryStream();
pdf.Save(@"C:\Aspose Testing\testing.pdf");

Hi,

Sorry for such delay, I seem have missed your post. The overlapping issue is most likely has to do with Aspose.Pdf, I will consult the Aspose.Pdf team and let you know immediately.

Please download hotfix 3.3.2.0.

hylant:

When I convert a Word document to a PDF, I am getting some words overlapping each other. I’ve attached the one such document that results in this error. The overlapping words occurs on the first page under section 6b (the words and & the are printed on top of one another).

The code I am using to do the conversion is as follows:

Aspose.Words.Document sourceDoc = new Aspose.Words.Document(@“C:\Aspose Testing\testing.doc”);

MemoryStream ms = new MemoryStream();

XmlDocument xml = new XmlDocument();

sourceDoc.Save(ms, Aspose.Words.SaveFormat.AsposePdf);

ms.Position = 0;

xml.Load(ms);

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

pdf.BindXML(xml, null);

ms.Close();

System.IO.MemoryStream pdfMS = new MemoryStream();

pdf.Save(@“C:\Aspose Testing\testing.pdf”);

i also want to do DOC to Pdf file conversion.
If you have got the solution plz send me complete program for doc to pdf conversion.
with source code.

Thanks in advance
AVP

Please download the evaluation version of Aspose.Words from
https://downloads.aspose.com/words/net

It includes source code demo projects which show how to do Word to PDF conversion using Aspose components.

Best regards,

I have used the above code to do Word forms to PDF conversion, and the PDF looks good EXCEPT that the form check boxes (which were checked programmatically) come across in the PDF looking like vertical lines with a horizontal loop to the right, or otherwise described as a lower case b with the vertical line extended below the loop. Is there a reason for that and how can it be corrected? Thank you.

Dear Aaron,

Thanks for reporting this problem to us. Please attach the sample document to your post. I will check what the issue is and how it can be fixed or avoided.

Best regards,

Ok, I’ve attached the resultant .PDF. Thanks for the help.

Aaron Buhr

Fidelity Information Services

Somehow the document failed to be attached. Please reattach it.

Best regards,

Trying again to attach the bad PDF.

Seemed to work that time. Here’s the .DOC file that produced it.

Here’s the code used:

Aspose.Words.Document doc = new Aspose.Words.Document(tb_InputFileName.Text);
foreach (Aspose.Words.FormField field in doc.Sections[0].Range.FormFields)
{
    if (field.Type.ToString() == "FieldFormCheckBox")
    {
        field.Result = "1";
    }
    else
    {
        if (_fieldVals.ContainsKey(field.Name.ToUpper()))
            field.Result = _fieldVals[field.Name.ToUpper()];
        else
            field.Result = field.Name.ToUpper();
    }
}
MemoryStream ms = new MemoryStream();
XmlDocument xml = new XmlDocument();
doc.Save(ms, Aspose.Words.SaveFormat.AsposePdf);
ms.Position = 0;
xml.Load(ms);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(xml, null);
ms.Close();
System.IO.MemoryStream pdfMS = new MemoryStream();
pdf.Save(tb_OutputFileName.Text);

Thanks for additional info. However, I have checked it and form checkboxes look good on my computer. See the attached screenshot.

I see. Apparently there is a rendering difference between Foxit PDF Reader and Adobe Reader in this case. Foxit does show other documents with checkboxes ok, but obviously Adobe is the reference renderer and since it works ok there I’ll accept that Foxit is doing something wrong. Thanks for the help.

Oh, Foxit PDF Reader. I have heard of it but have not tried it yet. I will inform Aspose.Pdf team of this issue. Maybe they will be able to fix it somehow.

We will check this problem. That might need several days.