Examples of PdfDecoder


Examples of org.jpedal.PdfDecoder

    /**
     * set up PdfDecoder object telling
     * it whether to display messages
     * and where to find its lookup tables
     */
    PdfDecoder decode_pdf;
   
    //PdfDecoder returns a PdfException if there is a problem
    try
    {
      decode_pdf = new PdfDecoder( false ); //false as no GUI display needed
     
      /**
       * open the file (and read metadata including pages in  file)
       */
      System.out.println( "Opening file :" + file_name );
      decode_pdf.openPdfFile( file_name );
     
      /**see if file contains embedded fonts*/
      System.out.println( "File contains embedded fonts=" + decode_pdf.PDFContainsEmbeddedFonts() );

      /**close the pdf file*/
      decode_pdf.closePdfFile();
     
    }
    catch( Exception e )
    {
      System.err.println( "2.Exception " + e + " in pdf code" );
View Full Code Here

Examples of org.jpedal.PdfDecoder

      name=file_name.substring(0,file_name.length()-4);
    }

    //PdfDecoder returns a PdfException if there is a problem
    try {
      decode_pdf = new PdfDecoder(true);

      /**
       * font mappings
       */
      if(!isTest){
 
View Full Code Here

Examples of org.jpedal.PdfDecoder

    /**
     * set up PdfDecoder object telling
     * it whether to display messages
     * and where to find its lookup tables
     */
    PdfDecoder decode_pdf = null;
   
    //PdfDecoder returns a PdfException if there is a problem
    try
    {
      decode_pdf = new PdfDecoder( false ); //false as no GUI display needed
     
      /**
       * open the file (and read metadata including pages in  file)
       */
      System.out.println( "Opening file :" + file_name );
      decode_pdf.openPdfFile( file_name );
     
      /**get page number*/
      System.out.println( "Page count=" + decode_pdf.getPageCount() );

      /**close the pdf file*/
      decode_pdf.closePdfFile();
     
    }
    catch( Exception e )
    {
      System.err.println( "5.Exception " + e + " in pdf code" );
View Full Code Here

Examples of org.jpedal.PdfDecoder

    /**
     * set up PdfDecoder object telling
     * it whether to display messages
     * and where to find its lookup tables
     */
    PdfDecoder decode_pdf = null;
   
    //PdfDecoder returns a PdfException if there is a problem
    try
    {
      decode_pdf = new PdfDecoder( false );
     
      /**
       * open the file (and read metadata including pages in  file)
       */
      System.out.println( "Opening file :" + file_name );
      decode_pdf.openPdfFile( file_name );
    }catch( Exception e ){
      System.err.println( "3.Exception " + e + " in pdf code" )
    }

    /**
     * extract data from pdf (if allowed).
     */
    if ((decode_pdf.isEncrypted())&&(!decode_pdf.isExtractionAllowed())) {
      System.out.println("Encrypted settings");
      System.out.println("Please look at SimpleViewer for code sample to handle such files");
      System.out.println("Or get support/consultancy");
     
    }
 
    /**get the Pdf file information object to extract info from*/
    PdfFileInformation currentFileInformation=decode_pdf.getFileInformationData();
   
    /**get the document properties*/
    String[] values=currentFileInformation.getFieldValues();
    String[] fields=currentFileInformation.getFieldNames();
   
    /**display*/
    int count=fields.length;
   
    System.out.println("Fields");
    System.out.println("======");
    for(int i=0;i<count;i++){
      System.out.println(fields[i]+" = "+values[i]);
   
   
    /**get and show any metadata*/
    System.out.println("\nMetadata");
    System.out.println("======");
    System.out.println(currentFileInformation.getFileXMLMetaData());

    /**close the pdf file*/
    decode_pdf.closePdfFile();
  }
 
View Full Code Here

Examples of org.jpedal.PdfDecoder

  public SignWizardModel(SignData signData, String pdfFile, String rootDir)
  {
    this.signData = signData;
    this.rootDir = rootDir;
   
    pdfDecoder = new PdfDecoder();
    try {
      pdfDecoder.openPdfFile(pdfFile);
    }
    catch (Exception e) {
            e.printStackTrace();
View Full Code Here

Examples of org.jpedal.PdfDecoder

   
    public PDFDocument(File f, PDFImageCacher cache, String[] searchTerms) throws PdfException {
      super();
      loadFile = f;
      imageCache = cache;
      PdfDecoder d = new PdfDecoder(false);
      d.openPdfFile(loadFile.toString());
      metadata = d.getPdfPageData();
      for (int i = 1; i <= metadata.getPageCount(); i++) {
        imageCache.requestCache(loadFile, i, searchTerms);
      }
    }
View Full Code Here

Examples of org.jpedal.PdfDecoder

  float zoom = 1.25f;
 
  @SuppressWarnings("unchecked")
  public PDFHighlightImage call() throws Exception {
    PdfDecoder pdf = new PdfDecoder();
    PdfDecoder.setFontReplacements(pdf);
    pdf.openPdfFile(pdfFile.toString());
    pdf.setPageParameters(zoom, pageNum);
    pdf.decodePage(pageNum);
    BufferedImage pdfImage = pdf.getPageAsImage(pageNum);
    PdfGroupingAlgorithms grouping = pdf.getGroupingObject();
    PdfPageData page = pdf.getPdfPageData();
    int x1 = page.getMediaBoxX(pageNum);
    int x2 = page.getMediaBoxWidth(pageNum);
    int y1 = page.getMediaBoxY(pageNum);
    int y2 = page.getMediaBoxHeight(pageNum);
    final SearchListener listener = new DefaultSearchListener();
    List<Rectangle> highlights = grouping.findMultipleTermsInRectangle(
        x1, y1, x2, y2,
        page.getRotation(pageNum),
        pageNum,
        highlightTerms,
        true, SearchType.DEFAULT, listener);
    List<Rectangle> rectangles = new Vector<Rectangle>();
    for (Rectangle r: highlights) {
      int rX = Math.round((r.x - x1) * zoom);
      // 0.25f is to account for descender height, which JPedal does not seem to do
      int rY = Math.round((y2 - r.y - r.height + y1 + r.height * 0.2f) * zoom);
      int rW = Math.round(r.width * zoom);
      int rH = Math.round(r.height * zoom);
      Rectangle pdfR = new Rectangle(rX, rY, rW, rH);
      rectangles.add(pdfR);
    }
    pdf.closePdfFile();
    pdf = null;
   
    return new PDFHighlightImage(pdfImage, rectangles, pageNum);
  }
View Full Code Here

Examples of org.jpedal.PdfDecoder

    /** Creates new form PdfPanel */
    public PdfPanel() {
        initComponents();
        IDMidiPos.setPaintLabels(false);
        pdfDecoder = new PdfDecoder();
        IDScroll.setViewportView(pdfDecoder);
        midiStatRefresher = new Timer();
        midiStatRefresher.schedule(new TimerTask() {

            @Override
View Full Code Here

Examples of org.jpedal.PdfDecoder

    }

    void calcAllFormObjectPositions() {
        AcroRenderer formRenderer = pdfDecoder.getFormRenderer();
        PdfDecoder decodePdf = pdfDecoder;
        Map i = decodePdf.getFormRenderer().getCompData().getRawFormData();
        Set keys = i.keySet();
        allFormObjectPositions = new HashMap<Long, Vector<FormObject>>();
        for (Object key : keys) {
            FormObject frmOb = (FormObject) i.get(key);
            SrcPosition srcpos = new SrcPosition(frmOb);
View Full Code Here

Examples of org.jpedal.PdfDecoder

public class PDF2ImageJPedal extends PDF2Image {
 
 
  public void writeImages(byte[] input,Set pages,Resource outputDirectory, String prefix,String format, int scale,
       boolean overwrite, boolean goodQuality,boolean transparent) throws  PageException, IOException {
     PdfDecoder dec = createPdfDecoder(input);
     Resource res;
     int count = dec.getPageCount();
    
     for(int page=1;page<=count;page++) {
       if(pages!=null && !pages.contains(Integer.valueOf(page)))continue;
       //res=outputDirectory.getRealResource(prefix+"_page_"+page+"."+format);
       res=createDestinationResource(outputDirectory,prefix,page,format,overwrite);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.