Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Fonts are stored in the catalog (I suppose in a sub-catalog of type font). If you open a pdf as a text file, you should be able to find catalog entries (they begin and end with "&lt;&lt;" and ">>" respectively.</p> <p>On a simple pdf file, i found the following:</p> <pre><code>&lt;&lt;/Type/Font/BaseFont/Helvetica-Bold/Subtype/Type1/Encoding/WinAnsiEncoding&gt;&gt; </code></pre> <p>thus searching for the prefix should help you (in some pdf files, there are spaces between the commponents but '/Type /Font' should be ok).</p> <p>Of course this is a manual process, while you would probably prefer an automatic one. </p> <p>On another note, we sometime use <a href="http://www.identifont.com" rel="nofollow noreferrer">identifont</a> or <a href="http://new.myfonts.com/WhatTheFont/" rel="nofollow noreferrer">what the font</a> to find uncommon fonts that give us problem (logo font).</p> <p>regards Guillaume</p> <p>Edit : the following code will find all font in the pages. To be short, you search the dictionnary of each page for the subdictionnary "ressource" and then the subdictionnary "font". Each entry in the later is a font dictionnary, describing a font.</p> <pre><code> PdfReader reader = new PdfReader( new FileInputStream(new File("file.pdf"))); int nbmax = reader.getNumberOfPages(); System.out.println("nb pages " + nbmax); for (int i = 1; i &lt;= nbmax; i++) { System.out.println("----------------------------------------"); System.out.println("Page " + i); PdfDictionary dico = reader.getPageN(i); PdfDictionary ressource = dico.getAsDict(PdfName.RESOURCES); PdfDictionary font = ressource.getAsDict(PdfName.FONT); // we got the page fonts Set keys = font.getKeys(); Iterator it = keys.iterator(); while (it.hasNext()) { PdfName name = (PdfName) it.next(); PdfDictionary fontdict = font.getAsDict(name); PdfObject typeFont = fontdict.getDirectObject(PdfName.SUBTYPE); PdfObject baseFont = fontdict.getDirectObject(PdfName.BASEFONT); System.out.println(baseFont.toString()); } } </code></pre> <p>The name (variable "name" in the following code) is what is used in the text to change font. In the PDF, you'll have to find it next to a text. The following number is the size. Here for example, it's size 12. (sorry, still no code for this part).</p> <pre><code>BT /F13 12 Tf 288 720 Td the text to find Tj ET </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload