Thank you for your answer. Yes, I've figured out myself the simple solution
that you have suggested.
Here's my method that creates an InputStream that have graphics that
contain name of signer and a date. Maybe It could be useful for someone.
*public static InputStream getImage (Certificate certificate,int
height, int width, int fontsize){ BufferedImage image = new
BufferedImage (height,width,BufferedImage.TYPE_4BYTE_ABGR);
ByteArrayOutputStream os = new ByteArrayOutputStream(); Graphics2D
graph = image.createGraphics(); try {
org.bouncycastle.asn1.x509.Certificate cert =
org.bouncycastle.asn1.x509.Certificate.getInstance(ASN1Primitive.fromByteArray(certificate.getEncoded()));
X500Name x500Name = cert.getSubject(); RDN rdn =
x500Name.getRDNs(BCStyle.CN)[0]; sName = "Digitally signed by:
"+ IETFUtils.valueToString(rdn.getFirst().getValue()); sDate =
"On: "+ Calendar.getInstance().getTime(); Font font = new
Font("TimesRoman", Font.BOLD, fontsize); graph.setFont(font);
graph.setPaint(Color.BLACK); graph.drawString(sName,0,20);
graph.drawString(sDate,0,40); ImageIO.write(image,
"PNG", os); } catch (Exception e) {
System.err.println("Failed to create signsture"); return null;
} InputStream fis = new ByteArrayInputStream(os.toByteArray());
graph.dispose(); return fis;}*
2015-12-08 20:32 GMT+03:00 Tilman Hausherr <[email protected]>:
> Am 08.12.2015 um 08:40 schrieb Глеб Г.Г.:
>
>> Sorry about picture. here it's URL
>>
>> http://www.biopdf.com/guide/digital-pdf-signatures/valid-visible-signature.png
>> I wanted to create an Adobe-like signature picture, not with custom
>> picture.
>>
>
> This isn't available at this time... The signature stuff is a rather
> tricky part of code. First you'd need to know how to write to a content
> stream, i.e. try to generate a PDF with ordinary text. If you know how to
> do that, you'll have to look at PDVisibleSigBuilder and
> PDVisibleSignDesigner. I could help along the way (and maybe improve our
> code), but this is only if you have a lot of time. I've been active from
> time to time to improve readability on that part of the code but there's
> still a lot to do.
>
> Another more simple way would be that you create an image that contains
> the text. I.e. create a BufferedImage of ARGB type, get a graphics object,
> and then write. I'll improve PDVisibleSignDesigner so that it can accept a
> BufferedImage instead of just an input stream.
>
>
> Tilman
>
>
>>
>> 2015-12-08 10:32 GMT+03:00 Tilman Hausherr <[email protected]>:
>>
>> Am 08.12.2015 um 08:25 schrieb Глеб Г.Г.:
>>>
>>> PDFBox 2.0.0 RC 2
>>>> How can I make visible signature look like this? I've heard it has to do
>>>> something with Acrobat's layers, but I have no idea how to do this with
>>>> pdfbox.
>>>>
>>>>
>>>> Your image didn't appear... please upload your screenshot somewhere.
>>> What
>>> also (possibly) works is to have the image not as attachment, but inline.
>>>
>>> If you want a transparent signature, create an ARGB PNG image, where the
>>> non-signature part is transparent.
>>>
>>> Tilman
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>