目前我在Android上使用pdftron APi。我已经在pdf doc中添加了一个图像我现在需要的是当用户点击或长按图像时它显示文本“删除图像”并选择添加的图像可以被删除。
我使用以下代码在pdf文档中添加图像
public void processCameraResult(PDFDoc doc, Bitmap bitmap)
{
try
{
ElementBuilder elementBuilder = new ElementBuilder();
ElementWriter writer = new ElementWriter();
doc.lock();
Page page = doc.pageCreate(); // Create a new page
writer.begin(page); // Begin writing to this page
Image img = Image.create(doc.getSDFDoc(), bitmap);
//Element element = elementBuilder.createImage(img,new Matrix2D(img.getImageWidth(), 0, 0, img.getImageHeight(),100, 450));
Element element = elementBuilder.createImage(img,new Matrix2D(img.getImageWidth(), 0, 0, img.getImageHeight(),150, 450));
writer.writePlacedElement(element); // Write the graphic image to page
writer.end(); // Save the page
doc.pagePushBack(page); // Add the page to the document page sequence
doc.save(SDFDoc.e_linearized, null); // Update the doc with the image
doc.unlock(); // unlock doc
mPDFView.updatePageLayout(); // Update the Page Layout after change
mPDFView.setDoc(doc); // Update the view with the new appended document
}
catch (PDFNetException exception)
{
handleException(exception, "processCameraResult", "E1032");
}
catch (InterruptedException exception)
{
handleException(exception, "processCameraResult", "E1033");
}
}