shame on me.
just got it.

Roger Misteli wrote:
> 
> Uhm.. could it be that you COMPILED it using iText but you did not RUN it
> with iText? In other words, iText was in the classpath for the compiling 
> process, but when you java mysample, you did not add the iText jar to the
> classpath?
> 
> Rog
> 
> 
> Noe Rocha wrote:
>> hi
>> i was compiling this in a Linux enviroment:
>> 
>> import java.io.*;
>> import java.security.*;
>> import java.security.cert.*;
>> import com.lowagie.text.*;
>> import com.lowagie.text.pdf.*;
>> 
>> public class Sign{
>>         public static void main(String args[]) throws Exception{
>>                 String pdf = "lista.pdf";
>>                 String cer = "ksb_cred.p12";
>> 
>>                         KeyStore ks = KeyStore.getInstance("pkcs12");
>>                         ks.load(new FileInputStream(cer),
>> "fujiwara".toCharArray());
>>                         String alias =
>> (String)ks.aliases().nextElement();
>>                         PrivateKey key = (PrivateKey)ks.getKey(alias,
>> "fujiwara".toCharArray());
>>                         java.security.cert.Certificate[] chain =
>> ks.getCertificateChain(alias);
>>                         PdfReader reader = new PdfReader(pdf);
>>                         FileOutputStream fout = new
>> FileOutputStream("assinado.pdf");
>>                         PdfStamper stp =
>> PdfStamper.createSignature(reader,
>> fout, '\0');
>>                         PdfSignatureAppearance sap =
>> stp.getSignatureAppearance();
>>                         sap.setCrypto(key, chain, null,
>> PdfSignatureAppearance.WINCER_SIGNED);
>>                         sap.setReason("I'm the author");
>>                         sap.setLocation("Lisbon");
>>                         // comment next line to have an invisible
>> signature
>>                         sap.setVisibleSignature(new Rectangle(100, 100,
>> 200,
>> 200), 1, null);
>>                         stp.close();
>> 
>>         }
>> }
>> 
>> and got
>> 
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> com/lowagie/text/pdf/PdfReader
>>         at Sign.main(Sign.java:17)
>> 
>> any ideas why the reading is not working?
>> i'm using the latest version too - itext-1.4.5.jar
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> 

-- 
View this message in context: 
http://www.nabble.com/error-compiling-example-tf2318396.html#a6449681
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to