Hello,
Hi Troy,
- createPolygon(…)
- createLine(…)
- createPolyLine(lineInfo, page, annotRect, annotContents)
Thanks Nayyer!
Nayyer,
tekstream:I apologize - but I would also like to know if drawing circles/rectangles in addition to free hand drawing on the pdf document is available.
//
instantiate pdfContentEditor instance<o:p></o:p>
com.aspose.pdf.facades.PdfContentEditor editor = new com.aspose.pdf.facades.PdfContentEditor();
// bind source PDF file
editor.bindPdf("c:/pdftest/font)_output.pdf");
// pass 4th argument as flase to draw circle. When using true, square will be added
editor.createSquareCircle(new java.awt.Rectangle(10, 10, 50, 30), "contents", java.awt.Color.BLUE, false, 1, 2);
// save resultant file
editor.save(“c:/pdftest/CircleAdded.pdf”);
Thanks Nayyer! Appreciate your help and prompt response. I’ll try that code you provided.
Hello Nayyer,
Hi Troy,
Nayyer,
Hi Troy,
Please try using following code snippet to set access privileges over PDF file. When using following code snippet, the users viewing the PDF file will not be able to add/modify annotations but the Admin viewing the file with owner password will be able to make any modifications.
For further details, please visit Set Privileges on an Existing PDF File
[Java]
//
load existing PDF file
Document document = new Document("c:/pdftest/font_output.pdf");
try /*JAVA: was using*/
{
// allow all the feature / modifications over PDF file
com.aspose.pdf.facades.DocumentPrivilege documentPrivilege = com.aspose.pdf.facades.DocumentPrivilege.getAllowAll();
documentPrivilege.setAllowScreenReaders(true);
// revoke annotation modification. Only admin will be able to modify comments/annotations
documentPrivilege.setAllowModifyAnnotations(false);
document.encrypt("user", "owner", documentPrivilege, CryptoAlgorithm.AESx128, false);
// save updated file
document.save("c:/pdftest/AnnotationModify_revoked.pdf");
}
finally { if (document != null) document.dispose(); }
Hello Nayyer,
Hi Troy,
Nayyer,
documentPrivilege.setAllowModifyContents(false);
Hi Troy,
the sake of correction, I have logged it in our issue tracking system as PDFNEWJAVA-34480. We will
investigate this issue in details and will keep you updated on the status of a
correction.
We apologize for your inconvenience.
Nayyer,
Hi Troy,
Hello Nayyer,
Hi Troy,
Thanks for your inquiry. I am afraid your issue is not resolved as we have noticed it recently. It is pending for investigation in the queue with other priority task. As soon as its investigation is completed then we will share our findings or ETA with you.<o:p></o:p>
We are sorry for the inconvenience caused.<o:p></o:p>
Best Regards,
hi nayer, this looks like a way to create drawings in pdf. is this considered an annotation?
Hi Chit,
Document pdfDocument = new Document(“annotation_out.pdf”);<o:p></o:p>
TextAnnotation replyAnnotation = new TextAnnotation(pdfDocument.getPages().get_Item(1), new com.aspose.pdf.Rectangle(200, 300, 300, 400));
replyAnnotation.setTitle("It needs to revisit");
replyAnnotation.setInReplyTo(pdfDocument.getPages().get_Item(1).getAnnotations().get_Item(1));
pdfDocument.getPages().get_Item(1).getAnnotations().add(replyAnnotation);
pdfDocument.save("Replied.pdf");