You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Agustin Rios <ag...@gmail.com> on 2014/04/04 22:04:57 UTC

Image from String

Hi, there is some way to transform a String to an image and inserting it
into a Page?
I'm working with codebar and I have problems opening the pdf in some
viewers, so I want to transform the codebar into an image.
The problem is that in adobe reader, sometimes show extrange symbols when
open the pdf. In linux doesn't happening.

Thanks!

-- 
SerĂ¡ el intento a buscar
lo que valore tu vida
buscar termina en encontrar

Re: Image from String

Posted by Agustin Rios <ag...@gmail.com>.
Thanks for your answer, I'm doing a mass print and I'm doing it like a text
including the font.
 I had problems with the font in some viewers. I have changed the font and
could solve those problems.

p.s: sorry my bad english!


2014-04-30 12:54 GMT-03:00 Tilman Hausherr <TH...@t-online.de>:

> Hello,
>
> I see nobody answered; assuming that with "codebar" you mean a barcode,
> you can create an image by creating a BufferedImage object, then getting a
> graphics2d device from it, writing on it with your barcode font. Don't
> forget to dispose the graphics2d device. You can then use it as in the
> AddImageToPDF example.
>
> If you're doing a mass print (i.e. a PDF file with many pages), then it
> would be better to do it as text and include the font. See here:
> https://pdfbox.apache.org/cookbook/pdfacreation.html
>
> HTH
>
> Tilman
>
> Am 04.04.2014 22:04, schrieb Agustin Rios:
>
>  Hi, there is some way to transform a String to an image and inserting it
>> into a Page?
>> I'm working with codebar and I have problems opening the pdf in some
>> viewers, so I want to transform the codebar into an image.
>> The problem is that in adobe reader, sometimes show extrange symbols when
>> open the pdf. In linux doesn't happening.
>>
>> Thanks!
>>
>>
>


-- 
SerĂ¡ el intento a buscar
lo que valore tu vida
buscar termina en encontrar

Re: Image from String

Posted by Tilman Hausherr <TH...@t-online.de>.
Hello,

I see nobody answered; assuming that with "codebar" you mean a barcode, 
you can create an image by creating a BufferedImage object, then getting 
a graphics2d device from it, writing on it with your barcode font. Don't 
forget to dispose the graphics2d device. You can then use it as in the 
AddImageToPDF example.

If you're doing a mass print (i.e. a PDF file with many pages), then it 
would be better to do it as text and include the font. See here:
https://pdfbox.apache.org/cookbook/pdfacreation.html

HTH

Tilman

Am 04.04.2014 22:04, schrieb Agustin Rios:
> Hi, there is some way to transform a String to an image and inserting it
> into a Page?
> I'm working with codebar and I have problems opening the pdf in some
> viewers, so I want to transform the codebar into an image.
> The problem is that in adobe reader, sometimes show extrange symbols when
> open the pdf. In linux doesn't happening.
>
> Thanks!
>