Examples of PDFFont


Examples of com.canoo.webtest.plugins.pdftest.htmlunit.PDFFont

  static String fontsToString(final List _fonts)
  {
    final List strings = new ArrayList();
        for (int i = 0; i < _fonts.size(); i++) {
            final PDFFont font = (PDFFont) _fonts.get(i);
            strings.add(font.getPage() + "|" + font.getType() + "|" + font.getName());
        }
        Collections.sort(strings);

        final String lineSep = System.getProperty("line.separator");
        return StringUtils.join(strings, lineSep);
View Full Code Here

Examples of com.canoo.webtest.plugins.pdftest.htmlunit.PDFFont

      final List fonts = pdfPage.getFonts();
      LOG.debug(fonts.size() + " fonts to examine");

      final IStringVerifier verifier = getVerifier();
      for (final Iterator iter = fonts.iterator(); iter.hasNext();) {
      final PDFFont font = (PDFFont) iter.next();
      if (verifyFont(font, verifier))
      {
          LOG.info("Found font " + font);
        return; // right font has been found
      }
View Full Code Here

Examples of net.sf.jasperreports.engine.export.PdfFont

     * @throws JRException
     */
    public byte[] getPdf() throws JRException {
       
        Map fontMap = new HashMap();
        fontMap.put(new FontKey("Arial", true, false), new PdfFont("Helvetica-Bold", "Cp1252", false));
        fontMap.put(new FontKey("Arial", false, true), new PdfFont("Helvetica-Oblique", "Cp1252", false));
        fontMap.put(new FontKey("Arial", true, true), new PdfFont("Helvetica-BoldOblique", "Cp1252", false));
        fontMap.put(new FontKey("Comic Sans MS", false, false), new PdfFont("COMICBD.TTF", "Cp1252", true));
       
        ByteArrayOutputStream out = new ByteArrayOutputStream();
       
        JRPdfExporter exporter = new JRPdfExporter();
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.getJasperPrint());
View Full Code Here

Examples of org.axsl.pdf.PdfFont

            final boolean kern) throws PdfException {
        if (size < 1) {
            return;
        }
        final FontPdf fontPdf = (FontPdf) fontUse.getFontOutput(Mime.PDF.getMimeString());
        final PdfFont pdfFont = this.getPDFDocument().getPdfFont(fontPdf);
        getContentStream().setFont(pdfFont, toPoints(area.traitFontSize()));

        /* Paint the text. */
        final CharSequence textToWrite = text.subSequence(startIndex, startIndex + size);
        getContentStream().drawText(textToWrite, kern);
View Full Code Here

Examples of org.jpedal.fonts.PdfFont

                                    if(currentTextState.hasFontChanged()){

                                        //switch to correct font
                                        String fontID=currentTextState.getFontID();
                                        PdfFont restoredFont = resolveFont(fontID);
                                        if(restoredFont!=null){
                                            currentFontData=restoredFont;
                                            current.drawFontBounds(currentFontData.getBoundingBox());
                                        }
                                    }

                                    if(currentFontData==null)
                                        currentFontData=new PdfFont(currentPdfFile);

                                    if(currentTextState.hasFontChanged()){
                                        currentTextState.setFontChanged(false);
                                    }
View Full Code Here

Examples of org.jpedal.fonts.PdfFont

     * decode or get font
     * @param fontID
     */
    private PdfFont resolveFont(String fontID) {

        PdfFont restoredFont=(PdfFont) cache.resolvedFonts.get(fontID);

        //check it was decoded
        if(restoredFont==null){

            String ref=(String)cache.unresolvedFonts.get(fontID);
View Full Code Here

Examples of org.jpedal.fonts.PdfFont

    }

    public PdfFont createFont(PdfObject pdfObject, String font_id, ObjectStore objectStoreStreamRef, boolean renderPage, ErrorTracker errorTracker, boolean isPrinting) throws PdfException {


        PdfFont currentFontData=null;
        /**
         * allow for no actual object - ie /PDFdata/baseline_screens/debug/res.pdf
         **/
        //found examples with no type set so cannot rely on it
        //int rawType=pdfObject.getParameterConstant(PdfDictionary.Type);
        //if(rawType!=PdfDictionary.Font)
        //  return null;

        baseFont="";
        rawFontName=null;
        subFont=null;

        int fontType= PdfDictionary.Unknown;
        origfontType=PdfDictionary.Unknown;

        PdfObject descendantFont=pdfObject.getDictionary(PdfDictionary.DescendantFonts);

        boolean isEmbedded= isFontEmbedded(pdfObject);
        boolean isFontBroken=true; //ensure enters once

        while(isFontBroken){ //will try to sub font if error in embedded
            isFontBroken=false;

            /**
             * handle any font remapping but not on CID fonts or Type3 and gets too messy
             **/
            if(FontMappings.fontSubstitutionTable!=null && !isEmbedded &&
                    pdfObject.getParameterConstant(PdfDictionary.Subtype)!= StandardFonts.TYPE3)
                fontType = getFontMapping(pdfObject, font_id, fontType, descendantFont);

            //get subtype if not set above
            if(fontType==PdfDictionary.Unknown){
                fontType=pdfObject.getParameterConstant(PdfDictionary.Subtype);

                /**handle CID fonts where /Subtype stored inside sub object*/
                if (fontType==StandardFonts.TYPE0) {

                    //get CID type and use in preference to Type0 on CID fonts
                    PdfObject desc=pdfObject.getDictionary(PdfDictionary.DescendantFonts);
                    fontType=desc.getParameterConstant(PdfDictionary.Subtype);

                    origfontType=fontType;

                    //track non-embedded, non-substituted CID fonts
                    if(!isEmbedded && subFont==null) {
                        hasNonEmbeddedCIDFonts=true;

                        //track list
                        if(nonEmbeddedCIDFonts.length()>0)
                            nonEmbeddedCIDFonts.append(',');
                        nonEmbeddedCIDFonts.append(baseFont);
                    }
                }
            }

            if(fontType==PdfDictionary.Unknown){

              if(LogWriter.isOutput())
                LogWriter.writeLog("Font type not supported");


                currentFontData=new PdfFont(currentPdfFile);
            }

            /**
             * check for OpenType fonts and reassign type
             */
            if(fontType==StandardFonts.TYPE1 || fontType==StandardFonts.CIDTYPE2)
                fontType = scanForOpenType(pdfObject, currentPdfFile, fontType);

            try{
                currentFontData=FontFactory.createFont(fontType,currentPdfFile,subFont, isPrinting);

                /**set an alternative to Lucida*/
                if(FontMappings.defaultFont!=null)
                    currentFontData.setDefaultDisplayFont(FontMappings.defaultFont);

                currentFontData.createFont(pdfObject, font_id,renderPage, objectStoreStreamRef, fontsLoaded);

                //save raw version
                currentFontData.setRawFontName(rawFontName);

                //fix for odd file
                if(fontType==StandardFonts.TYPE1 && currentFontData.is1C() && pdfObject.getInt(PdfDictionary.FirstChar)==32 &&
                        pdfObject.getInt(PdfDictionary.FirstChar)==pdfObject.getInt(PdfDictionary.LastChar)){

                    if(isEmbedded){
                        isFontBroken=true;
                        isEmbedded=false;
View Full Code Here

Examples of org.jpedal.fonts.PdfFont

            default:


                //LogWriter.writeLog("Font type " + subtype + " not supported");
                return new PdfFont(currentPdfFile);
        }

    }
View Full Code Here

Examples of org.jpedal.fonts.PdfFont

      //special case used from PdfStreamDecoder to get font data
    case SAVE_EMBEDDED_FONT:

      //save ttf font data as file
      Object[] fontData= (Object[]) str;
      PdfFont pdfFont=(PdfFont)fontData[0];
      String fontName=pdfFont.getFontName();
      String fileType=(String)fontData[2];

      //make sure Dir exists
      String fontPath = rootDir + javaFxFileName + '/';
      File cssDir = new File(fontPath);
View Full Code Here

Examples of org.jpedal.fonts.PdfFont

      //special case used from PdfStreamDecoder to get font data
    case SAVE_EMBEDDED_FONT:

      //save ttf font data as file
      Object[] fontData= (Object[]) str;
      PdfFont pdfFont=(PdfFont)fontData[0];
      String fontName=pdfFont.getFontName();
      String fileType=(String)fontData[2];

      //make sure Dir exists
      String fontPath = rootDir + javaFxFileName + '/';
      File cssDir = new File(fontPath);
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.