Unable to Convert Secured PDF with Print Disabled to JPG using VB.Net, WIinforms

Hi All,

I am converting PDF to Image using Aspose.Pdf licensed version. Before I go ahead, I would like to give a heads up that the aspose (.dll) I use in my project is age old. I am not sure where to check the version but in code it reads “Assembly aspose.pdf.kit version 4.7.0.0”. Unfortunately, I have to go through loads of approvals to get it updated, which I cannot afford to right now.

Normally when we upload a standard PDF, it gets converted properly. But when I try to convert PDFs, which has print disabled in them, to JPG it fails and errors out. Can someone help with what can be done for this?

@Adithya_Mani

Could you please share your sample PDF document with us. We will test the scenario with latest version of the API and share our feedback with you.

Hi Asad,

Thank you for responding. Unfortunately, i cannot share the PDF right now as these are highly confidential ones. But yes, whenever a PDF has its printing functionality disabled, aspose cannot convert it to JPG. Could you please verify that at your end? It can happen for any random pdf with PDF disabled to it.

TextAndImage-test.pdf (277.0 KB)

I am sharing the pdf that is failing for us. please let me know

@asad.ali Any luck on this? i am actually time bound for this request

@Adithya_Mani

We tested the scenario using Aspose.PDF for .NET 20.8 and were unable to notice any issue. The API generated all images without throwing any error. Attached are the images generated at our end using following code snippet:

var fs = new FileStream(dataDir + "TextAndImage-test.pdf", FileMode.Open);
Document pdfDocument = new Document(fs);
foreach (Page page in pdfDocument.Pages)
{
 using (FileStream imageStream = new FileStream(dataDir + "image" + page.Number + ".jpg", FileMode.Create))
 {
  Resolution resolution = new Resolution(300);
  JpegDevice jpegDeviceLarge = new JpegDevice(resolution, 100);
  jpegDeviceLarge.RenderingOptions.InterpolationHighQuality = true;
  jpegDeviceLarge.RenderingOptions.UseNewImagingEngine = true;
  jpegDeviceLarge.Process(page, imageStream);
 }
}

image5.jpg (575.9 KB)
image6.jpg (823.4 KB)
image4.jpg (946.4 KB)
image2.jpg (1.3 MB)
image3.jpg (1.0 MB)
image1.jpg (985.3 KB)

Please note that we always recommend to use latest version of the API because it contains more fixes and improvements. Furthermore, the issues reported in older versions of the API are resolved in latest/higher version. We strongly recommend you to upgrade to latest version of the API because there are many classes and methods which have been discontinued in the version which you are using. In case of any further assistance, please feel free to let us know.