locked
PdfDocument.GetPage() error

    Question

  • Hi 

    I am downloading the PDF file from Amazon S3 storage by using AWS sdk by using the given code

    using (GetObjectResponse response = await _s3Client.GetObjectAsync(request))
    {
             using (var photoOutputStream = await url.OpenStreamForWriteAsync())
             {                           
                     await response.ResponseStream.CopyToAsync(photoOutputStream);                          
             }
    }

    sometimes data is not downloaded completely. For ex. 2 MB file will be 1.6 MB.

    When I read the PDF file and getting 1st page of PDF I am getting given error.

    Syste.AccessViolationException unhandled

    exception also is not catching this error.

     var _pdfDocument = await PdfDocument.LoadFromFileAsync(_pdfFile,PDFPassword);                   
    if (_pdfDocument != null)
    {
          _pdfPage = _pdfDocument.GetPage(0);
    }

    How do we resolve this error. If I catch the exception I can download that file again.

    Or Please try to read corrupted PDF file in PdfDocument.GetPage(). 

    Please help me


    Thanks by Manivel


    • Edited by Manivelp Friday, March 14, 2014 2:43 PM
    Friday, March 14, 2014 2:41 PM

All replies

  • It sounds like the problem is in the downloading and not in the PDF API. I wouldn't expect the PdfDocument to work with a partial file.

    Does the AWS SDK provide a way to detect errors or partial downloads?

    --Rob

    Saturday, March 15, 2014 12:33 AM
    Owner
  • Hi Rob

    Thank for your reply.

    I did not get any error while download files from AWS S3.

    How do we manage the partial file in PDF API in windows 8.1 apps?


    Thanks by Manivel

    Saturday, March 15, 2014 12:35 PM