Not too worry I found the answer:-
java.io.FileInputStream fis;
try {
fis = new java.io.FileInputStream(file1);
PDType0Font fnt = null;
TTFParser p = new TTFParser();
TrueTypeFont ttf = p.parse(fis);
if( ttf.getOS2Windows() != null){
if ((ttf.getOS2Windows().getFsType() &
OS2WindowsMetricsTable.FSTYPE_NO_SUBSETTING) ==
OS2WindowsMetricsTable.FSTYPE_NO_SUBSETTING){
fnt = PDType0Font.load(doc, ttf, false);
}
}
if(fnt == null) {
fnt = PDType0Font.load(doc, ttf, true);
}
fis.close();
return fnt;
} catch (FileNotFoundException ex) {
Logger.getLogger(reportPdf.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(reportPdf.class.getName()).log(Level.SEVERE, null, ex);
}
On 17/11/2016 17:13, clifford wrote:
In Class org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder it has a
method called private boolean isSubsettingPermitted(TrueTypeFont ttf)
throws IOException that checks if you are allowed to embed the font
This method is called when doing PDDocument save which is a bit late
to find out that you have embedded a font, that you should not have
done so.
is it possible after you do a (or even before)
public static PDType0Font load(PDDocument doc, InputStream input)
throws IOException
to find out if you are allowed to embed the font, that you have got,
and then just add it so that it is not embedded, if you are not
allowed to embed it.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
*Kind regards*
*Clifford Dann
Paprika*
T +44 (0)1732 811601
www.paprika-software.com <https://www.paprika-software.com%3C>
Latters House, High Street, Hadlow, Tonbridge, Kent, TN11 0EF, United
Kingdom
Agency Software Worldwide Ltd. Registered in England and Wales 01665695