Incorrect file format

Hello
I am using the trial version of aspose.pdf
I create a class using the code from this link
Convert PDF documents using C# API|Aspose.PDF for .NET

her is my class
Public Shared Function pdftoimage(inputfile As String, outputfile As String) As String
Dim ret As String
ret = “”
Dim pdfDocument As New Document(inputfile)

For pageCount As Integer = 1 To pdfDocument.Pages.Count
Using imageStream As New FileStream(outputfile & pageCount & “.jpg”,
FileMode.Create)
'create JPEG device with specified attributes
'Width, Height, Resolution, Quality
'Quality [0-100], 100 is Maximum
'create Resolution object
Dim resolution As New Resolution(300)
'JpegDevice jpegDevice = new JpegDevice(500, 700, resolution, 100);
Dim jpegDevice As New JpegDevice(resolution, 100)

'convert a particular page and save the image to stream
jpegDevice.Process(pdfDocument.Pages(1), imageStream)

'close stream
imageStream.Close()

End Using
Next pageCount
Return ret
End Function

I sent a PDF document as input to this class, but I’m getting “incorrect file format” error at this line
Dim pdfDocument As New Document(inputfile)

Please help

Hi,

Thanks for your interest in our products.

I tested the scenario using provided source code with Aspose.Pdf for .NET v6.8 and unable to notice any problem. Kindly use the latest version of Aspose.Pdf for .NET v6.8 and check if it fits your need. If you still face any problem kindly share the template document with us, this will help us to identify the issue and reply back to you soon.

Please visit Purchase Information for all details about licensing, even before purchasing the license, you may also request a 30 days temporary license for evaluating the product.

Please feel free to contact support in case you need any further assistance.

Thanks & Regards,

Hi
With aspose.Word I got the word document converted to PDF without problem but
I am using the evaluation copy of aspose.pdf 6.8
I tested with Windows 7, 64 bits, I got the error

Incorect file format

at this line

 Dim pdfDocument As New Document(inputfile)
The inputfile is a correct PDF file which I can open with acrobat reader
I also tested with PDF files generated by aspose.word and got the same error
I also tested in another machine with Windows 7, 32 bits
I got this error
Startxref not found

I need urgently to use this program and purchase a vversion
Please help


I putted the whole project here
https://docs.google.com/open?id=0B41VChRa9_ecdjJCSzdHV2xTdVNPSFlVa1RMQTdQQQ

Hi,

Thanks for sharing the sample application with us. I tested the scenario and able to notice the multiple issues in your sample application.

1. Kindly comment the below line of code from LinkButton2_Click method, because after execution of this line, the PDF file size changes to 0KB.

'FileUpload1.SaveAs(inputfile)

2. Kindly replace the below line of code from pdftoimage method in clasposepdf class

jpegDevice.Process(pdfDocument.Pages(1), imageStream)

with

jpegDevice.Process(pdfDocument.Pages(pageCount), imageStream)

Moreover, please visit Purchase Information for all details about licensing, even before purchasing the license, you may also request a 30 days temporary license for evaluating the product, otherwise you may face this error with evaluation version "At most 4 elements (for any collection) can be viewed in evaluation mode."

Please feel free to contact support in case you need any further assistance.

Thanks & Regards,