Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.AcroFields$Item


    Document doc = _docBuilder.newDocument();
    Element elem = doc.createElement("item-notes");
    Text textValue = doc.createTextNode("SalesID# 3445");
    elem.appendChild(textValue);
   
    Item item = pBuilder.createShoppingItem(itemName, itemDesc, quantity,
      unitPrice, null, currency, elem);
   
    assertEquals(itemName, item.getItemName());
    assertEquals(itemDesc, item.getItemDescription());
    assertEquals(quantity, item.getQuantity());
    assertEquals(4999.99F, item.getUnitPrice().getValue().floatValue());
    assertEquals(currency, item.getUnitPrice().getCurrency());
    assertEquals(elem, item.getMerchantPrivateItemData().getAny());
  }
View Full Code Here


    String[] itemDescs = new String[] {"mp3 player", "podcast subscription"};
    int[] quantities = new int[] {2, 1};
    float[] prices = new float[] {249.99F, 3.99F};
    List<Item> itemList = new ArrayList<Item>();
    for (int i = 0; i < itemNames.length; i++) {
      Item cartItem = pBuilder.createShoppingItem(itemNames[i], itemDescs[i],
        quantities[i], prices[i], null, null, null);
      itemList.add(cartItem);
    }
   
    return itemList;
View Full Code Here

  public Item createShoppingItem(String itemName, String itemDesc,
      int quantity, float unitPrice, String currency,
      String taxTableSelector, Element privateItemData)
      throws ProtocolException {
    Money money = createMoney(unitPrice, currency);
    Item item = _objectFact.createItem();
    item.setItemName(itemName);
    item.setItemDescription(itemDesc);
    item.setQuantity(quantity);
    item.setUnitPrice(money);

    if (taxTableSelector != null) {
      item.setTaxTableSelector(taxTableSelector);
    }
   
    if (privateItemData != null) {
      AnyType anyType = _objectFact.createAnyType();
      anyType.setAny(privateItemData);
      item.setMerchantPrivateItemData(anyType);
    }
   
    return item;
  }
View Full Code Here

      String taxTableSelector, Element privateItemData)
      throws ProtocolException {
   
    try {
      Money money = createMoney(unitPrice, currency);
      Item item = _objectFact.createItem();
      item.setItemName(itemName);
      item.setItemDescription(itemDesc);
      item.setQuantity(quantity);
      item.setUnitPrice(money);
 
      if (taxTableSelector != null) {
        item.setTaxTableSelector(taxTableSelector);
      }
     
      if (privateItemData != null) {
        AnyType anyType = _objectFact.createAnyType();
        anyType.setAny(privateItemData);
        item.setMerchantPrivateItemData(anyType);
      }
     
      return item;
    } catch (JAXBException jaxbEx) {
      throw new ProtocolException(jaxbEx.getMessage());
View Full Code Here

    Document doc = _docBuilder.newDocument();
    Element elem = doc.createElement("item-notes");
    Text textValue = doc.createTextNode("SalesID# 3445");
    elem.appendChild(textValue);
   
    Item item = pBuilder.createShoppingItem(itemName, itemDesc, quantity,
      unitPrice, null, currency, elem);
   
    assertEquals(itemName, item.getItemName());
    assertEquals(itemDesc, item.getItemDescription());
    assertEquals(quantity, item.getQuantity());
    assertEquals(4999.99F, item.getUnitPrice().getValue().floatValue(), 0);
    assertEquals(currency, item.getUnitPrice().getCurrency());
    assertEquals(elem, item.getMerchantPrivateItemData().getAny());
  }
View Full Code Here

    String[] itemDescs = new String[] {"mp3 player", "podcast subscription"};
    int[] quantities = new int[] {2, 1};
    float[] prices = new float[] {249.99F, 3.99F};
    List itemList = new ArrayList();
    for (int i = 0; i < itemNames.length; i++) {
      Item cartItem = pBuilder.createShoppingItem(itemNames[i], itemDescs[i],
        quantities[i], prices[i], null, null, null);
      itemList.add(cartItem);
    }
   
    return itemList;
View Full Code Here

        // Open the document for reading.
        PdfReader reader = new PdfReader(documentFileName);

        // Get the signatures in the document.
        AcroFields fields = reader.getAcroFields();
        ArrayList<String> signatures = fields.getSignatureNames();
        Map<String, PdfPKCS7> result = new LinkedHashMap<String, PdfPKCS7>();

        // Check if the input document is signed.
        if (signatures.size() == 0) {
            throw new NoSignatureException(messages.getString(
View Full Code Here

        NoOCSPResponseException,
        NoCRLException,
        GeneralSecurityException
    {
        // Get all the information about the signature.
        AcroFields fields = reader.getAcroFields();
        PdfPKCS7 pkcs7 = fields.verifySignature(signature);

        // Use the signature to check the document integrity.
        if (!pkcs7.verify()) {
            throw new InvalidSignatureException(
                String.format(messages.getString(
View Full Code Here

        // Open the document for reading.
        PdfReader reader = new PdfReader(documentFileName);

        // Get the signatures in the document.
        AcroFields fields = reader.getAcroFields();
        ArrayList<String> signatures = fields.getSignatureNames();
        Map<String, PdfPKCS7> result = new LinkedHashMap<String, PdfPKCS7>();

        // Get signature data encoded in PKCS #7 format for each signature.
        for (String signature : signatures) {
            // Verify the signature.
            PdfPKCS7 pkcs7 = fields.verifySignature(signature);

            // Check if the signature is a document level timestamp.
            if (pkcs7.isTsp() && !includeTimestamps) {
                // Skip document level timestamps.
                continue;
View Full Code Here

        // Open input file for reading.
        PdfReader reader = new PdfReader(inputFileName);

        // Get the list of signatures in the document.
        AcroFields fields = reader.getAcroFields();
        ArrayList<String> signatures = fields.getSignatureNames();
        if (signatures.size() == 0) {
            throw new NoSignatureException(messages.getString(
                "Document_has_no_signature."));
        }

        // Check if the last signature is a timestamp.
        String lastSignature = signatures.get(signatures.size() - 1);
        PdfPKCS7 pkcs7 = fields.verifySignature(lastSignature);
        if (pkcs7.isTsp()) {
            // Prepare to store certificates, OCSP responses and CRLs only for the last timestamp.
            signatures.clear();
            signatures.add(lastSignature);
        }

        // Prepare structures to store all certificates and CRLs.
        ArrayList<X509Certificate> allCertificates = new ArrayList<X509Certificate>();
        ArrayList<String> allCRLDistributionPoints = new ArrayList<String>();
        HashMap<String, ArrayList<X509Certificate>> certMap = new HashMap<String, ArrayList<X509Certificate>>();
        HashMap<String, ArrayList<X509CRL>> crlMap = new HashMap<String, ArrayList<X509CRL>>();
        HashMap<String, ArrayList<BasicOCSPResp>> ocspMap = new HashMap<String, ArrayList<BasicOCSPResp>>();

        // Store certificates, OCSP responses and CRLs for each signature.
        for (String signature : signatures) {
            // Get signature data.
            pkcs7 = fields.verifySignature(signature);

            // Get certificate path.
            X509Certificate signingCertificate = (X509Certificate) factory.generateCertificate(
                new ByteArrayInputStream(pkcs7.getSigningCertificate().getEncoded()));
            Certificate[] chain = pkcs7.getSignCertificateChain();
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.AcroFields$Item

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.