Free Support Forum - aspose.com

Trouble converting PDF to JPEG

I am using VS 2013 .Net 4.5 and need to convert PDF to JPEG. I get a message saying to use Words 4.6 or Standard to open PDF file. If I add netstandard2.0 Words reference it says “Reference required to assembly ‘netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ containing the implemented interface ‘System.Collections.Generic.IEnumerable`1’. Add one to your project.”
I already have Imports System.Collections.Generic. What’s missing?

@rdaviessci,

Starting from the 20.2 release, Aspose.Words for .NET supports loading/processing PDF file format in its .NET Standard variant (i.e. use the DLLs from netstandard2.0 folder ). After that, starting from the 20.4 release, Aspose.Words also provides DLL for .NET 4.6.1 (i.e. use DLLs from net461 folder ) to read/load/process PDF documents. I suggest you to please create a new Visual Studio project, set the target framework to 4.6.1 and finally install latest (21.1) version of Aspose.Words for .NET API from NuGet.

Thanks so much, Awais. I wasn’t aware that I could target a later framework than the one that came with the VS version. It works.
One more question: When I load an Aspose.Words.Document -
Dim doc As Aspose.Words.Document = New Aspose.Words.Document(sFName)

  • for the first time it takes about 10 seconds. Subsequent is faster. Can I speed up that first time?

@rdaviessci,

I think, Aspose.Words needs to precache fonts and other resources for rendering or updating page layout. This only happens for the first time when you convert to PDF or call Document.UpdatePageLayout method or invoke Document.PageCount property. Can you please ZIP and upload the input Word document (you are getting this problem with) here for testing? We will then investigate the issue on our end and provide you more information.

I was testing with the Correspondence.docx file included in my zip. It’s pretty simple though it contains an image.
I have another different problem with the PDF in the zip, where I load it with Aspose.Words and then save it as a Jpeg image with a different name, the jpeg file is blank - using this command:
doc.Save(sFileSrvPath & sImgOutFName, Aspose.Words.SaveFormat.Jpeg)
Thanks for your help on both issues!Correspondence.zip (2.3 MB)

@rdaviessci,

We have logged the following problem in our issue tracking system:

  • WORDSNET-21677: Blank Output produced when Converting a PDF with Images to JPEG Format

We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

We are unable to observe any issue during converting Correspondence.docx to different formats using latest (21.1) version of Aspose.Words for .NET on our end. Please elaborate your inquiry further by providing complete details along with screenshot(s). This will help us to understand your scenario, and we will be in a better position to address your concerns accordingly.

I didn’t have a problem with the conversion of Correspondence.docx. The issue was about it taking 10 seconds for Aspose.Words to open the document for the first time.
That was my second question up above, to which you responded, " Can you please ZIP and upload the input Word document (you are getting this problem with ) here for testing?"

@rdaviessci,

Loading of “Correspondence.docx” into 21.1 version of Aspose.Words’ for the very first time took just 600 milliseconds and saving to PDF took another 1300 milliseconds on my end. Subsequent calls took an average of 425 and 950 milliseconds respectively (loading & saving). I tested this scenario on Windows 10 using .NET Framework 4.6.1.