I am having problems trying to convert pdf files into jpeg files, the result image looks distorted, Do you know how to fix it?
Thanks for your inquiry.
Would you please share your sample PDF document along with sample code snippet which you are using to convert it in JPEG image. We will test the scenario in our environment and address it accordingly.
Sorry for the delay I was asking if I can share the file with you, finally I attached the files here please take a look, I attached the pdf file and two screenshoots one of them is the image generated and the other is a screenshot of the pdf (just the first page) and this is the VB code:
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
context.Response.ContentType = "image/jpg" Dim fileId As Guid Guid.TryParse(context.Request("FileID"), fileId) Dim path As String = GetFilePath(fileId) Dim pageCount As Integer = CInt(context.Request("Page")) Using pdfDocument As New Document(path) 'create Resolution object Dim resolution As New Devices.Resolution(300) Using page As Aspose.Pdf.Page = pdfDocument.Pages(pageCount) Dim rect As Rectangle = page.GetPageRect(True) Dim jpegDevice As New Devices.JpegDevice(rect.Width, rect.Height, resolution, 85) jpegDevice.Process(page, context.Response.OutputStream) End Using End Using
Thanks for sharing requested information.
We have tested the scenario in our environment using your PDF and code snippet with Aspose.PDF for .NET 18.11. We have noticed that output image quality was better using latest version of the API. For you kind reference, we have also attached an output image generated in our environment. 1.jpg (220.9 KB)
Would you please make sure if you are using latest version of the API and in case you still face any issue or have another requirement, please feel free to let us know.