We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Device Process argument component error

Hi!

The following code is throwing this exception on a pdf file fully customized:
Exception: System.ArgumentOutOfRangeException: Arguments should lies in interval [0, 1] Parameter name: component

This is happening on the Process() call. Each page that has more complex formatting and links, throws an exception.
Any pdf file without these kind of customizations works just fine.
Can you guys please help?

public void Convert (Stream streamIn, int hr, int vr) {
    Aspose.Pdf.Document document = new Aspose.Pdf.Document (streamIn);

    for (int i = 1; i <= document.Pages.Count; i++) {
        MemoryStream page = new MemoryStream ();
        ImageFormat saveFormat;
        Resolution resolution = new Resolution (hr, vr);
        ImageDevice device;

        switch (format) {
            case ConversionSaveFormat.Png:
            default:
                device = new PngDevice ();
                saveFormat = ImageFormat.Png;
                break;
            case ConversionSaveFormat.Jpeg:
                device = new JpegDevice ();
                saveFormat = ImageFormat.Jpeg;
                break;
        }
        device.Process (document.Pages[i], page);
    }
}

@afbmora

Can you please share the source PDF file so that we may try to reproduce the same on our end.

Hi!
Here’s an example:

@afbmora

I can not reproduce the issue so please upgrade to latest version and share your feedback.