Quantcast
Viewing all articles
Browse latest Browse all 3131

Using Aspose.Pdf.dll in sql clr not converting Pdfs to images

Hi, 

I've created a console app to convert PDFs to PNGs using Aspose.Pdf.dll and this is working fine. I've migrated the same code (below) to be used in a Sql Server 2012 CLR function. The CLR is not generating any output. My guess is that I'm missing an assembly reference. Could you let me know what the dependency is for the aspose dll. 

Thanks,
Reuven

code snippet: 
  var pdfDocument = new Document(stream);

                for (int pgIdx = 1; (pgIdx <= pdfDocument.Pages.Count && pgIdx <= 4); pgIdx++)
                {
                    var imageStream = new System.IO.MemoryStream();
                    var resolution = new Resolution(70);
                    var pngDevice = new PngDevice(resolution);

                    //convert a particular page and save the image to stream
                    pngDevice.Process(pdfDocument.Pages[pgIdx], imageStream);
                    imageStream.Close();

                    var pgBytes = imageStream.ToArray();
                    conversionsCollection.Add(new Converted(attachmentID, pgBytes, (SqlInt32)(pgIdx + 1), ""));
                }
                return conversionsCollection;

Viewing all articles
Browse latest Browse all 3131

Trending Articles