You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by PDF Project 1 <pd...@gmail.com> on 2019/02/28 07:24:13 UTC

Conveting PDFont to java.awt.font

Hello,
We are creating a PDF viewer which is an open source project. As the pdf
engine, we use Pdfbox and now we faced a problem in converting PDFont to
java.awt.font. We use JTextPanes to display the text lines of pdf pages, so
we need to get an awt font equivalent to PDFont. We found a similar
question in StackOverflow.com but that question is unanswered. We googled
but there is no support on google to the problem. Please help.


Thank you,
LightView development team.
https://github.com/PdfProject8/LightViewer
The LightView opensource java PDF reader project

Re: Conveting PDFont to java.awt.font

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 28.02.2019 um 08:33 schrieb Maruan Sahyoun:
> Could you be a little more specific what the issues are you are facing? Please note that PDFont is the main interface to what
> are different types of font formats such as TrueType but also PDF vector based ones.

Yeah, good luck in displaying type 3 fonts with awt 🤣  Try displaying 
such files with the 1.8 version.

https://jira.apache.org/jira/secure/attachment/12445254/PDFBOX31-yeung_inv.pdf

Tilman




>
> BR
> Maruan
>   
>> Hello,
>> We are creating a PDF viewer which is an open source project. As the pdf
>> engine, we use Pdfbox and now we faced a problem in converting PDFont to
>> java.awt.font. We use JTextPanes to display the text lines of pdf pages, so
>> we need to get an awt font equivalent to PDFont. We found a similar
>> question in StackOverflow.com but that question is unanswered. We googled
>> but there is no support on google to the problem. Please help.
>>
>>
>> Thank you,
>> LightView development team.
>> https://github.com/PdfProject8/LightViewer
>> The LightView opensource java PDF reader project



Re: Conveting PDFont to java.awt.font

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Could you be a little more specific what the issues are you are facing? Please note that PDFont is the main interface to what
are different types of font formats such as TrueType but also PDF vector based ones.

BR
Maruan
 
> Hello,
> We are creating a PDF viewer which is an open source project. As the pdf
> engine, we use Pdfbox and now we faced a problem in converting PDFont to
> java.awt.font. We use JTextPanes to display the text lines of pdf pages, so
> we need to get an awt font equivalent to PDFont. We found a similar
> question in StackOverflow.com but that question is unanswered. We googled
> but there is no support on google to the problem. Please help.
> 
> 
> Thank you,
> LightView development team.
> https://github.com/PdfProject8/LightViewer
> The LightView opensource java PDF reader project
-- 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Conveting PDFont to java.awt.font

Posted by Tilman Hausherr <TH...@t-online.de>.
This was done in the 1.8 version but no longer in the 2.0 version, 
because awt would often choke (including jvm crashes) on fonts that were 
not fully perfect. This got us too many support questions that contained 
the sentence "but it displays with Adobe Reader". The 2.0 version does 
its own font rendering.

To convert to awt fonts, extract the font stream (there are differences 
depending on the font type) and feed that stream to Font.createFont(). 
See the 1.8 source code.

Tilman

Am 28.02.2019 um 08:24 schrieb PDF Project 1:
> Hello,
> We are creating a PDF viewer which is an open source project. As the pdf
> engine, we use Pdfbox and now we faced a problem in converting PDFont to
> java.awt.font. We use JTextPanes to display the text lines of pdf pages, so
> we need to get an awt font equivalent to PDFont. We found a similar
> question in StackOverflow.com but that question is unanswered. We googled
> but there is no support on google to the problem. Please help.
>
>
> Thank you,
> LightView development team.
> https://github.com/PdfProject8/LightViewer
> The LightView opensource java PDF reader project
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org