Document Conversion Issues For Various Document Types

We have purchased Aspose.Total for .Net and getting conversion issue while converting documents from different types to PDF.
The same code is working fine for some documents and not for otheres(See from the log attached)
Attaching Error Log and Code.

Code_Error.zip (4.7 KB)

@Silambarasan.Selvaraju

Can you please share the source file that is failing on your end and that we may try to reproduce on our end.

It is already attached in Code_Error.zip file

@mudassir.fayyaz
It is already attached in Code_Error.zip file Code_Error.zip (4.7 KB)

@Silambarasan.Selvaraju

I have requested for the source file that is failing to get exported to PDF.

@mudassir.fayyaz

It is all of below type of document. I have below type of documents(each type 1 document) and it converts fine for the first time but failing for the second time (for same documents) See my error log in Code_Error.zip file.

Types

  1. Pdf
  2. Doc
  3. Docx
  4. Txt
  5. Tif
  6. Jpg
  7. Jpeg
  8. Jpe
  9. Emf
  10. Xps

@mudassir.fayyaz
see attached files that i used for sample
Prod_Files_New.zip (671.9 KB)

@Silambarasan.Selvaraju

There is nothing evident in log file exception stack trace on saving the files to PDF. But you have shared that first time the conversion is done fine and on second iteration things failed. I have also checked your .CS file as well and it seems perfectly fine. I request you to please share the working sample project where you have actually called the instance of Document convertor to load the files and save to PDF. There may be some thing to investigate in calling or using of Document Convertor class.

@mudassir.fayyaz, is it possible have a call and troubleshoot this issue? we have urgent product delivery based on this?

@Silambarasan.Selvaraju

I can understand your concern. I have done my analysis and have shared the information based on provided information. Unfortunately, there is no call support option. You may please share a workable sample project reproducing the issue as in your convertor class, I have observed no issue apparently.

@mudassir.fayyaz,

I use below code to convert XPS document to PDF. After converting i tried to open the PDF file using PDFSharp dll and getting “Unexpected token ‘e’ in PDF stream. The file may be corrupted.” error. Do i need to specify any other option while converting XPS file?

    public void XPSToPDF(string inFile, string outFile)
    {
        try
        {
            using (System.IO.Stream pdfStream = System.IO.File.Open(outFile, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write))
            using (System.IO.Stream xpsStream = System.IO.File.Open(inFile, System.IO.FileMode.Open))
            {
                Aspose.Page.XPS.XpsDocument document = new Aspose.Page.XPS.XpsDocument(xpsStream, new Aspose.Page.XPS.XpsLoadOptions());
                Aspose.Page.XPS.Presentation.Pdf.PdfSaveOptions options = new Aspose.Page.XPS.Presentation.Pdf.PdfSaveOptions()
                {
                    JpegQualityLevel = 100,
                    ImageCompression = Aspose.Page.XPS.Presentation.Pdf.PdfImageCompression.Jpeg,
                    TextCompression = Aspose.Page.XPS.Presentation.Pdf.PdfTextCompression.Flate,
                };
                Aspose.Page.XPS.Presentation.Pdf.PdfDevice device = new Aspose.Page.XPS.Presentation.Pdf.PdfDevice(pdfStream);
                document.Save(device, options);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    #endregion

@Silambarasan.Selvaraju

Can you please confirm that you have narrow down issue only to XPS now only? We are checking this on our end.

@mudassir.fayyaz,

Yes. now issue is with XPS only.

@Silambarasan.Selvaraju

We are verifying this on our end and will share feedback with you as soon as possible.

@Silambarasan.Selvaraju

We tested the scenario using 21.7 version of Aspose.Page for .NET and did not notice any issue with exported PDF. XPStoPDF.pdf (8.3 MB)
It opened in Adobe Reader fine. Please try to use it for further operation as you want and if you face any issue, that may be at the end of PDFSharp. You can contact their support in order to have further insights into the issue.