I am looking for a way to embedd an external Font to use in on a PDF page (other fonts which are not available by default) in Java Apache PdfBox. Does someone know how to do it.
They have a way to use external fonts as described at
Ref - https://pdfbox.apache.org/1.8/cookbook/workingwithfonts.html :
...PDFBox will load Resources/PDFBox_External_Fonts.properties off of the classpath to map font names to TTF font files. The UNKNOWN_FONT property in that file will tell PDFBox which font to use when no mapping exists.
If you could share the specific issue/error you ran into, if you did, I can offer a better actionable-response.
Related
I am using aspose java jar for web application and aspose Android via java for mobile application. By default aspose increase font size when i create pdf from mobile . Can someone tell me what exactly aspose doing for mobile?
Thanks for your inquiry. I suspect that the difference in font size is actually the difference in fonts. Android has a limited set of fonts and when Aspose.Words cannot find some fonts upon rendering document to PDF it tries to substitute them. You can configure font substitution rules using FontSubstitutionSetings class.
If you need the exact rendering, then the same set of fonts must be used on different platforms. You can put the required fonts into a folder and use it as font source in FontSettings.
I have an existing PDF file that I would like to convert to excel file using python script. Currently using PDFBox, however there are multiple errors similar to the following:
org.apache.pdfbox.pdmodel.font.PDType0Font toUnicode
No Unicode mapping for CID+24 (24) in font DroidSansFallback
Can I substitute the droidsansfallback font or replace the font with another font using pdfbox or other java/python script?
Please help.
Convert PDF using print to Microsoft pdf file and use that. It will take care of all fonts
For android app I'm working right now i have to test that font file supplies all needed characters. Hoverwer I can have a lot ttf files, so i wanted to check every.
But heres my problem: How to read font chars in UTF-8 and iterate through them?
Any help would be appreciated.
You should try using the sfntly library
This has been used in Android Font Creator project
I was able to print glyph ids and names using the test program on a desktop app. Should work on Android as well.
Ok, the way it worked for me was that a friend of mine prepared svg file with font and we could generate data with javascript from that file.
I am using PDFBox to display PDF files inside a JInternalFrame. When opening PDF I get lots of warnings like this:
Changing font on <m> from <Tahoma Negrita> to the default font
I am aware that the fonts being reported are not part of the standard set of 14 fonts. So I decided to check if those fonts are embedded on the PDF file (thinking that there shouldn't be a problem loading embedded fonts, right?).
So I open the file on different readers and check properties/fonts. I am in doubt whether this section reports fonts required by the document or fonts actually embedded in the document.
The information that I get is as follows:
BAAAA+Tahoma-Bold (embedded Subset), type:TrueType, Encoding:
CAAAA+Tahoma (Embedded Subset), type:TrueType, Encoding:
Confused about this, I researched on how to embed fonts from OpenOffice and found that the PDF/A-1a option should be checked. So I made another PDF using this option (in case this was not used when making the original PDF file), yet I got the same results.
I would like your guidance understanding how this works. I would like to be able to open PDF files just as PDF readers do. I also read about the PDFBox_External_Fonts.properties but I am guessing this file shouldn't be modified since I am dealing with embedded fonts.
Thanks.
pdfbox is not able to parse embedded subsets of TrueType fonts.
As far as I understand it, embedded TrueType subsets are missing some metadata for the font file that pdfbox needs.
The bug is known but not easy to solve. Right now I can only advise to use embedded Type 1 Fonts if possible, pdfbox can deal with them.
You can also try to set the path to your complete font files in your pdfbox.jar under org/apache/pdfbox/resources/PDFBox_External_Fonts.properties, so if pdfbox cannot parse the subset, at least it can find a full path to the original font file. Maybe that works, but I have not tested this.
Good Luck!
We are currently working with a selection of publishers to generate online books from their PDF's. Our legacy app uses flex, so for this we are converting the PDF to SWF files using PDF2SWF by SWFTools.
The problem that we are having is that the text within the SWF document is not being highlighted by our flex reader when the user performs a search. After a quick investigation we found that when extracting text we need to embed the fonts that are used by the PDF document:
http://wiki.swftools.org/wiki/How_do_I_highlight_text_in_the_SWF%3F
pdf2swf -F $YOUR_FONTS_DIR$ -f input.pdf -o output.swf
As you can see from the code above, we need a path to a font directory containig the fonts found within that PDF.
Since we will be converting a large number of PDF's, is it possible to access the font files directly through the PDF rather than having a lot of fonts stored within our app?
Additional Information
Our app is written in Java.
We are currently using PDFBox and Ghostscript within the app, so if any solutions use these libraries than that would be a preferred option, but we are open to all ideas.
PDF files don't contain font 'files' they may not even contain any fonts at all, though this is rare. The embedded font data can be in a bewildering variety of formats:
type 1 PostScript fonts
type 3 PostScript
fonts TrueType fonts
PostScript CFF fonts
CIDFonts with type 1 PostScript outlines
CIDFonts with type 3 PostScript outlines
CIDFonts with TrueType outlines
CIDFonts with CFF outlines
CIDFonts with bitmap images
Will your application be able to read all these font formats ? If you want to use them then you must use the fonts embedded in the PDF file as these will very often be subset fonts, and supplied with a custom Encoding, which means that even if you have the original font, you can't use it because the Encoding will not be correct.
Of course it may be that these PDF files are all created in a consistent way and do not use embedded fonts, but I have my doubts....