StampAnnotation read image data


#1

Is there any way to read the image data for a saved StampAnnotation? The getImage function returns null for saved documents.

Code;

  File oPath = new File(Environment.getExternalStorageDirectory(), "Documents");
  File oPdfLic = new File(oPath, "aspose_pdf.lic");
  File oPdfIn = new File(oPath, "test.pdf");
  File oPdfOut = new File(oPath, "test2.pdf");
  File oImage = new File(oPath, "test.jpg");


  FileInputStream oStream = new FileInputStream(oPdfLic.getAbsolutePath());
  License oLicense = new License();
  oLicense.setLicense(oStream);
  oStream.close();

  // create document
  {
    com.aspose.pdf.Document oDoc = new com.aspose.pdf.Document(oPdfIn.getAbsolutePath());
    Page oPage = oDoc.getPages().get_Item(1);

    FileInputStream oInFile = new FileInputStream(oImage.getAbsolutePath());

    Rectangle oImgRect = new Rectangle(5f, 5f, 150f, 150f);
    StampAnnotation oStamp = new StampAnnotation(oPage, oImgRect);

    oStamp.setImage(oInFile);

    oPage.getAnnotations().add(oStamp);
    oInFile.close();

    oPdfOut.delete();
    oDoc.save(oPdfOut.getAbsolutePath());
    oDoc.close();
  }

  // use saved document
  {
    com.aspose.pdf.Document oDoc = new com.aspose.pdf.Document(oPdfOut.getAbsolutePath());
    Page oPage = oDoc.getPages().get_Item(1);

    StampAnnotation oStamp = (StampAnnotation) oPage.getAnnotations().get_Item(1);

    // stream is null //
    InputStream oStreamIsNull = oStamp.getImage();
    log("onCreate", "is null: " + (oStreamIsNull == null));
  }

#2

@kkoch

Thank you for contacting support.

I have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFJAVA-37500 has been logged in our issue management system for further investigation and resolution. The issue ID has been linked with this thread so that you will receive notification as soon as the issue is resolved.

We are sorry for the inconvenience.


#3

@kkoch

We have further investigated the issue reported by you and we are unable to reproduce it with Aspose.PDF for Java 18.2, which has been released couple of days ago. Please test the scenario with latest version and then share your kind feedback with us. In case the issue persists with this version then please share source PDF as well as image, generated PDF file and environment details on your end so that we may proceed accordingly.


#4

According to your downloads page, the latest version for android is 17.12. Please advise if there is a 18.2 version for android I can download.


#5

@kkoch

We are investigating the scenario in Android emulator and will get back to you with our findings soon.


#6

Any progress?


#7

@kkoch

We are checking it with the collaboration of our product team and we will get back to you within couple of days. Please be patient and spare us little time.


#9

@kkoch

We have managed to replicate the issue in Android environment with latest available version, 17.12, for Android. A ticket with ID PDFANDROID-507 has been logged in our issue management system, for further investigation and resolution. The issue ID has been linked with this thread so that you will receive notification as soon as the issue is resolved.

We are sorry for the inconvenience.


#10

The issues you have found earlier (filed as PDFANDROID-507) have been fixed in Aspose.PDF for Android via Java 18.6.