RE: iText PDF signature

2010-03-12 Thread Chad Gray

Thanks for the suggestions Paul.

I don’t see any setRender or setSignatureGraphic method.  Are you on CF9?  
Maybe that is the difference.

All I have is setImage and setImageScale.  These lay an image behind the text 
in the signature.

I did find that I can do setLayer2Text to blank and it will clear the type on 
top of the image.  So maybe that is the route I will go.  I really don’t feel 
like monkey'ing around with replacing iText in CF8.

Thanks again,
Chad



-Original Message-
From: Paul Hastings [mailto:p...@sustainablegis.com] 
Sent: Thursday, March 11, 2010 8:38 PM
To: cf-talk
Subject: Re: iText PDF signature 


On 3/12/2010 5:12 AM, Chad Gray wrote:
> I want to create a signature in a PDF that has an image like this example 
> code is doing:
> http://itextpdf.com/examples/index.php?page=example&id=221

that's for the latest version of iText not the one shipped with cf. you can 
drop 
the new version into cfs class path or use mark's javaLoader & away you go (but 
make sure you read the new licensing first). on the plus side is that the new 
version's class, etc names have changed so no classpath hell w/existing cf 
version.

---or---

if you want to use the existing version maybe this will help:

setRenderingMode ===> setRender "Sets the rendering mode for this signature"
setSignatureGraphic ===> setSignatureGraphic (still there), it's looking for a 
"com.lowagie.text.Image"



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331654
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: iText PDF signature

2010-03-12 Thread Marco Antonio C. Santos

We're using iText-2.0.7.jar + javaLoader + CF 7 Std with success. Please
take a look this code to insert an image and a description in your PDF
signed:


 
 
 

 
 
 
 

 
  
 
 
  setReason='ACME Corporation';
  setPassword='yourPFXPassword';
  setLocation='Your City-State';

  fullPathToPFXFile = local.pathArqPFX;
  fullPathToOriginalFile = local.pathPDF;
  fullPathToSignedFile = local.pathPDFSigned;
  string = createObject("java","java.lang.String");
  passwordSign = string.init(setPassword);
  keyStore =
createObject("java","java.security.KeyStore").getInstance("pkcs12");
  privateKey = createObject("java","java.security.PrivateKey");
  inputStream =
createObject("java","java.io.FileInputStream").init(fullPathToPFXFile);
  keyStore.load(inputStream, passwordSign.toCharArray());
  keyStoreAlias = keyStore.aliases().nextElement();
  privateKey = keyStore.getKey(keyStoreAlias,
passwordSign.toCharArray());
  chainArray = keyStore.getCertificateChain(keyStoreAlias);
  pdfReader =
server[application.javaLoaderInit].create("com.lowagie.text.pdf.PdfReader").init(fullPathToOriginalFile);

  outStream =
createObject("java","java.io.FileOutputStream").init(fullPathToSignedFile);

  pdfStamper =
server[application.javaLoaderInit].create("com.lowagie.text.pdf.PdfStamper");

  pdfVersion = string.init(URLDecode('%00')).charAt(0);
  stamper = pdfStamper.createSignature(pdfReader, outStream, pdfVersion);

  signatureAppearance = stamper.getSignatureAppearance();
  PdfSignatureAppearance =
server[application.javaLoaderInit].create("com.lowagie.text.pdf.PdfSignatureAppearance");

  signatureAppearance.setCrypto( privateKey, chainArray, javacast("null",
0),PdfSignatureAppearance.WINCER_SIGNED);
  signatureAppearance.setReason(setReason);
  signatureAppearance.setLocation(setLocation);
  rectangle =
server[application.javaLoaderInit].create("com.lowagie.text.Rectangle").init(
 javacast("float", 100),
 javacast("float", 100),
 javacast("float", 200),
 javacast("float", 200) );
  signatureAppearance.setVisibleSignature( rectangle, javacast("int", 1),
javacast("null", "") );
  
signatureAppearance.setCertificationLevel(signatureAppearance.CERTIFIED_NO_CHANGES_ALLOWED);
  stamper.close();
  inputStream.close();
  pdfReader.close();
  outStream.close();
  return true;
 

Cheers
Marco Antonio
On Thu, Mar 11, 2010 at 7:12 PM, Chad Gray  wrote:

>
> Hello, I am working with iText that comes with CF8 and I don’t see these
> methods in com.lowagie.text.pdf.PdfSignatureAppearance
> setRenderMode
> setSignatureGraphic
>
> I want to create a signature in a PDF that has an image like this example
> code is doing:
> http://itextpdf.com/examples/index.php?page=example&id=221
>
> Anyone figured out how to get an image and description into a PDF
> signature?
>
> If I use the method setImage that is in the CF8 class the image is laid on
> top of the description and you cannot read it.
>
> Thanks,
> Cha
>
> 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331637
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: iText PDF signature

2010-03-11 Thread Paul Hastings

On 3/12/2010 5:12 AM, Chad Gray wrote:
> I want to create a signature in a PDF that has an image like this example 
> code is doing:
> http://itextpdf.com/examples/index.php?page=example&id=221

that's for the latest version of iText not the one shipped with cf. you can 
drop 
the new version into cfs class path or use mark's javaLoader & away you go (but 
make sure you read the new licensing first). on the plus side is that the new 
version's class, etc names have changed so no classpath hell w/existing cf 
version.

---or---

if you want to use the existing version maybe this will help:

setRenderingMode ===> setRender "Sets the rendering mode for this signature"
setSignatureGraphic ===> setSignatureGraphic (still there), it's looking for a 
"com.lowagie.text.Image"

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331624
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


iText PDF signature

2010-03-11 Thread Chad Gray

Hello, I am working with iText that comes with CF8 and I don’t see these 
methods in com.lowagie.text.pdf.PdfSignatureAppearance
setRenderMode
setSignatureGraphic
 
I want to create a signature in a PDF that has an image like this example code 
is doing:
http://itextpdf.com/examples/index.php?page=example&id=221
 
Anyone figured out how to get an image and description into a PDF signature?
 
If I use the method setImage that is in the CF8 class the image is laid on top 
of the description and you cannot read it.
 
Thanks,
Cha

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331618
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm