We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

File display error with Adobe Reader and MS Explorer

Hi,
We’ve uploaded the .PDF file to the application, we get the error when we want to view the file with the Adobe Reader, and Microsoft Explorer. Our client is using the application with Microsoft Explorer. The original file, converted file, and screenshot have attached.
ConvertErrorAspose.zip (174.2 KB)

@srmbimser

Thanks for contacting support.

Would you please share your sample code snippet which you have used to convert the original PDF document OR please share the information about file format in which resultant PDF was converted. We will test the scenario in our environment and address it accordingly.

I attached the simple web application
http://dm.bimser.com.tr/eba.net/Default.aspx?turl=Xv6Fm_dlOUqxsvqPMbccYA
We are using following code block in Test Project,
protected void btnConvert_Click(object sender, EventArgs e)
{
API.AsposeLicence.SetAsposeLicence();
sw.Start();
string fileName = hdnFileName.Value;
extension = fileName.Substring(fileName.LastIndexOf(’.’), fileName.Length - fileName.LastIndexOf(’.’));
if (extension == “.doc” || extension == “.docx”)
{
Aspose.Words.Document doc = new Aspose.Words.Document(this.UploadDirectory + fileName);
foreach (Aspose.Words.Tables.Table table in doc.GetChildNodes(Aspose.Words.NodeType.Table, true))
{
bool isHF = false;
foreach (Aspose.Words.HeaderFooter hf in doc.GetChildNodes(Aspose.Words.NodeType.HeaderFooter, true))
{
foreach (Aspose.Words.Tables.Table table1 in hf.GetChildNodes(Aspose.Words.NodeType.Table, true))
{
if (table1 == table)
{
isHF = true;
break;
}
}
if (isHF) break;
}
if (!isHF)
table.TextWrapping = Aspose.Words.Tables.TextWrapping.None;
}
#region Writing Log
API.Global.WriteLog("-----------------------------------");
API.Global.WriteLog(string.Format(“Converting Started - {0}”, sw.ElapsedMilliseconds));
#endregion
doc.AcceptAllRevisions();
doc.GetChildNodes(NodeType.Comment, true).Clear();
doc.UpdateTableLayout();
doc.UpdatePageLayout();
doc.Save(this.UploadDirectory + fileName.Substring(0, fileName.LastIndexOf(’.’)) + “.pdf”, Aspose.Words.SaveFormat.Pdf);

        }

        #region Writing Log
        API.Global.WriteLog(string.Format("Converting Finished - {0}", sw.ElapsedMilliseconds));
        #endregion
        API.Global.FileShow(this.UploadDirectory + fileName.Substring(0, fileName.LastIndexOf('.')) + ".pdf", this.Response);
    }

@srmbimser

Thanks for sharing more details.

You had shared both PDF documents in your first post in the thread and now it seems you are converting a DOCX file into PDF using Aspose.Words. We have further checked the web project that you have shared and were able to find problematic PDF document i.e. K8H472.pdf but, we were unable to locate respective source DOCX document for it.

Would you please share the input Word document with us or if it is already present in UploadedFiles folder, please share its file name. It would help us testing the scenario in our environment and address it accordingly.

I attached the simple web application
http://dm.bimser.com.tr/eba.net/Default.aspx?turl=Zu1ZXx6vyUSvrLrRL8nnMA

We are using following code block in Test Project,
if (uplFile.HasFile)
{
try
{
API.AsposeLicence.SetAsposeLicence();
#region Writing Log
sw.Start();
API.Global.WriteLog("-------------------------------------");
API.Global.WriteLog(string.Format(“Uploading Started - {0}”, sw.ElapsedMilliseconds));
#endregion

                string fileName = System.IO.Path.Combine(this.UploadDirectory, uplFile.FileName);
                extension = uplFile.FileName.Substring(uplFile.FileName.LastIndexOf('.'), uplFile.FileName.Length - uplFile.FileName.LastIndexOf('.'));
                if (extension == ".doc" || extension == ".docx")
                {
                    Aspose.Words.Document doc = new Aspose.Words.Document(uplFile.FileContent);

                    doc.Save(fileName);
                }
                else if (extension == ".pdf")
                {
                    #region pdf
                    Aspose.Pdf.Document pdfdoc = new Aspose.Pdf.Document(uplFile.FileContent);
                    pdfdoc.Save(fileName);
                    #endregion
                }
                hdnFileName.Value = uplFile.FileName;
                #region Writing Log
                API.Global.WriteLog(string.Format("Uploading Finished - {0}", sw.ElapsedMilliseconds));
                #endregion
            }
            catch (Exception) { }

@srmbimser

Thanks for sharing the detail. We have tested the scenario using the shared web application. We have uploaded the PDF file (original_document.pdf) and then converted it to PDF. We have not found any issue with output PDF file.

Could you please share the complete steps to reproduce the shared issue at our end? We will investigate the issue and provide you more information on it.

After the document is loaded, it is downloaded to be displayed, when the downloaded document is opened with Explorer and Adobe Reader, the error screenshot is received. Capture.PNG (23.9 KB)
This error is not encountered in Chrome. Our customer uses MS Explorer.

@srmbimser

Thanks for your inquiry. We have performed the three steps mentioned in the following screenshot and have not found the shared issue. Perhaps, you are using different input PDF file or different code.