[ 
https://issues.apache.org/jira/browse/PDFBOX-4556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16867656#comment-16867656
 ] 

bal commented on PDFBOX-4556:
-----------------------------

hi, thanks for your support. I have tried with your code, using  jpeg image it 
throws the  exception. i have tried with below code. I have also wrote the 
appearance stream hard way as you mentioned but not got any visual 
representation for that. opening pdf with the editor able to see the same.  

PDXObjectImage imgxobj = null;

imagefile = new java.io.File(tickImage);
 BufferedImage bufferedImage = null;
 bufferedImage = ImageIO.read(imagefile);
 if (bufferedImage.getColorModel().getNumComponents() == 3)
 {
 PDDeviceRGB rgb = PDDeviceRGB.INSTANCE;
 imgxobj.setColorSpace(rgb);
 }
 if (bufferedImage.getColorModel().getNumComponents() == 1)
 {
 PDDeviceGray gray = new PDDeviceGray();
 imgxobj.setColorSpace(gray);
 }

float compression = 0.75f;
 imgxobj = new PDJpeg(doc, bufferedImage, compression);

 

below is the stacktrace for the exception at above line

at org.apache.pdfbox.util.JPEGUtil.updateMetadata(IIOMetadata , Int32 )
 at org.apache.pdfbox.util.ImageIOUtil.writeImage(BufferedImage image, String 
formatName, OutputStream output, Int32 dpi, Single quality)
 at 
org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg.createImageStream(PDDocument 
, BufferedImage , Single )
 at org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg..ctor(PDDocument doc, 
BufferedImage bi, Single compressionQuality)

 

> how the visual representation of the signature is achieved  
> ------------------------------------------------------------
>
>                 Key: PDFBOX-4556
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4556
>             Project: PDFBox
>          Issue Type: Wish
>          Components: .NET
>    Affects Versions: 1.8.16
>            Reporter: bal
>            Priority: Major
>         Attachments: image  error stacktrace.txt, npe at adappearence 
> dictionary.txt, pdfAnnotation.pdf, visibleSignature.pdf
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to