com.cete.dynamicpdf.pageelements
Class MacroPdf417




Examples Description
Example 1 The following example will place a MacroPdf417 bar code on the page.
Example 2 The following example shows you how to use the getOverflowMacroPdf417 method to generate more than one MacroPdf417 bar codes to flow onto new pages as needed.
Example 3 The following example shows you how to use the getOverflowMacroPdf417 method with x and y co ordinates to generate more than one MacroPdf417 bar codes on the page.



Example 1: The following example will place a MacroPdf417 bar code on the page.

 import com.cete.dynamicpdf.*;
 import com.cete.dynamicpdf.pageelements.*;
 import com.cete.dynamicpdf.pageelements.barcoding.*;
   
 public class MyClass {
      public static void Main(String args[]) {
       
        // Create a PDF Document
        Document document = new Document();
 
        // Create a Page and add it to the document
        Page page = new Page();
        document.getPages().add(page);
 
        // Create a MacroPdf417 bar code
        MacroPdf417 macroPdf417 = new MacroPdf417( "MacroPdf417 Bar code", 10.0f, 10.0f, 3, 2.0f );			          

        // Add the MacroPdf417 Bar code to the page
        page.getElements().add(macroPdf417);
 
        // Save the PDF
        document.draw("[PhysicalPath]/MyDocument.pdf");
     }
 }

Top

Example 2: The following example shows you how to use the getOverflowMacroPdf417 method to generate more than one MacroPdf417 bar codes to flow onto new pages as needed.

 import com.cete.dynamicpdf.*;
 import com.cete.dynamicpdf.pageelements.*;
 import com.cete.dynamicpdf.pageelements.barcoding.*;
 import java.io.*;

 public class MyClass {
      public static void Main(String args[]) {
        // Create a PDF Document
        Document document = new Document();
                       
        byte[] bytArry = null;
        try {
            FileInputStream fi = new FileInputStream("[PhysicalPath]/Textdata.txt");
            int avail = fi.available();
            bytArry = new byte[avail];
            fi.read(bytArry);
            fi.close();
        } catch(Exception e) {
            System.out.println("EXCEPTION  "+e.getMessage());
        }

        float x = 10.0f;
        float y = 10.0f;;

        // Create a MacroPdf417 bar code
        MacroPdf417 macroPdf417 = new MacroPdf417( bytArry, x, y, 14, 0.5f );
        
        macroPdf417.setFileName("Textdata.txt");
        macroPdf417.setSender("Your Name");
        macroPdf417.setAddress("Your Address");
        macroPdf417.includeFileSize(true);
        macroPdf417.includeCheckSum(true);
        macroPdf417.includeTimeStamp(true);
        macroPdf417.setFileId(22222222);
                       
        while( macroPdf417 != null ) {
            // Create a Page 
            Page page = new Page();
            // Add the MacroPdf417 bar code to the page
            page.getElements().add( macroPdf417 );
            // Add page to the document
            document.getPages().add( page );
            macroPdf417 = macroPdf417.getOverflowMacroPdf417();           
        } 
	   
        // Save the PDF
        document.draw("[PhysicalPath]/MyDocument.pdf");
    }
}

Top

Example 3: The following example shows you how to use the getOverflowMacroPdf417 method with x and y coordinates to generate more than one MacroPdf417 bar codes on the page.

import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.*;
import com.cete.dynamicpdf.pageelements.barcoding.*;
import java.io.*;

public class MyClass {
     public static void Main(String args[]) {
        // Create a PDF Document
        Document document = new Document();
        
        // Create a Page and add it to the document
        Page page = new Page();
        document.getPages().add( page );

        byte[] bytArry = null;
        try {
            FileInputStream fi = new FileInputStream("[PhysicalPath]/Textdata.txt");
            int avail = fi.available();
            bytArry = new byte[avail];
            fi.read(bytArry);
            fi.close();
        } catch(Exception e) {
            System.out.println("EXCEPTION  "+e.getMessage());
        }

        float x = 10.0f;
        float y = 10.0f;;

        // Create a MacroPdf417 bar code
        MacroPdf417 macroPdf417 = new MacroPdf417( bytArry, x, y, 14, 0.5f );
        
        macroPdf417.setFileName("Textdata.txt");
        macroPdf417.setSender("Your Name");
        macroPdf417.setAddress("Your Address");
        macroPdf417.includeFileSize(true);
        macroPdf417.includeCheckSum(true);
        macroPdf417.includeTimeStamp(true);
        macroPdf417.setFileId(22222222);
       
        // Add the MacroPdf417 bar code to the page
        page.getElements().add( macroPdf417 );

        y += macroPdf417.getSymbolHeight() + 20.0f;
       
        MacroPdf417 objMacroPdf417 = null;
        do {
            objMacroPdf417 = macroPdf417.getOverflowMacroPdf417( x, y );
            if ( objMacroPdf417 != null ) {
                page.getElements().add( objMacroPdf417 );
                y += objMacroPdf417.getSymbolHeight() + 20.0f;
            }	
        } while( objMacroPdf417 != null );
	   
        // Save the PDF
        document.draw("[PhysicalPath]/MyDocument.pdf");
    }
}

Top