You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Sebastian Ortiz Vasquez <ne...@gmail.com> on 2009/05/21 09:50:08 UTC

PDFBox String Drawing

Hello Ben,

I write to you because you write lot of code with i have problems,
also please excuse my english is not good.

I want to send a PDF by Fax, in order to do that i need to convert the
pdf to image, by now i am using pdf-render library but it dosen't
render the image at good quality the the fax is poor.

I am looking in pdfbox a good alternative, because it works better,
but in my particular case isn't working.

I use iText 2.1.4 to generate some text on the PDF i need to send by
fax, when i try to use PDFToImage the final image don't contain any
text i write.

I have been debuggin last four hours the code of pdf, at the
begginning i got some problems relative with fonts because my linux
box dosen't have the font pdfbox was looking for (arial,
timesnewroman).

I got this stack for writting text

org.apache.pdfbox.pdmodel.font.PDType1Font.drawString(PDType1Font.java:2xx)
//I modified other things
org.apache.pdfbox.pdfviewer.PageDrawer.processTextPosition(PageDrawer.java:174)
org.apache.pdfbox.util.PDFStreamEngine.processEncodedText(PDFStreamEngine.java:446)
org.apache.pdfbox.util.operator.ShowText.process(ShowText.java:50)
org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:497)
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:217)
org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:176)
org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:90)
org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:669)
org.apache.pdfbox.util.PDFImageWriter.WriteImage(PDFImageWriter.java:86)
org.apache.pdfbox.PDFToImage.main(PDFToImage.java:165)

I find the way pdf box renders the image is first in
org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:669) it
creates a new BufferedImage that will be the final image, with this
bufferedImage get the graphics an pass it to each other components
that in the end PageDrawer will be write  on it.

I think the are some problems with this because i write to an image
BufferedImage retVal in
org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:669) and
dosen't contains anything.

But i'm sure the
org.apache.pdfbox.pdmodel.font.PDType1Font.drawString(PDType1Font.java:2xx)
 is drawing the String rigth in the graphics that the method gets.

I really apreciate your time and ideas with this problem.

You can reproduce the problem using some pdf made with iText
http://itextdocs.lowagie.com/tutorial/general/index.php
-- 
Sebastián Ortiz Vásquez.
Estudiante Ingeniería de Sistemas.
Auxiliar de Investigación Grupo de Física Atómica.
Universidad de Antioquia.
Oficina: 2196577
SIP: 3903639
2009

Re: PDFBox String Drawing

Posted by Sebastian Ortiz Vasquez <ne...@gmail.com>.
On Thu, May 21, 2009 at 6:25 AM, Daniel Wilson
<wi...@gmail.com> wrote:
> Sebastian,
>
> Are you using PDFBox 0.7.3?  Andreas has fixed most of those font problems
> in 0.8.0.
>
> If 0.8.0 doesn't work for you either, please create an issue and attach one
> of the PDF's with which you're having problems.
>
> Thanks.
>
> Daniel Wilson
>
> On Thu, May 21, 2009 at 3:50 AM, Sebastian Ortiz Vasquez
> <ne...@gmail.com>wrote:
>
>> Hello Ben,
>>
>> I write to you because you write lot of code with i have problems,
>> also please excuse my english is not good.
>>
>> I want to send a PDF by Fax, in order to do that i need to convert the
>> pdf to image, by now i am using pdf-render library but it dosen't
>> render the image at good quality the the fax is poor.
>>
>> I am looking in pdfbox a good alternative, because it works better,
>> but in my particular case isn't working.
>>
>> I use iText 2.1.4 to generate some text on the PDF i need to send by
>> fax, when i try to use PDFToImage the final image don't contain any
>> text i write.
>>
>> I have been debuggin last four hours the code of pdf, at the
>> begginning i got some problems relative with fonts because my linux
>> box dosen't have the font pdfbox was looking for (arial,
>> timesnewroman).
>>
>> I got this stack for writting text
>>
>> org.apache.pdfbox.pdmodel.font.PDType1Font.drawString(PDType1Font.java:2xx)
>> //I modified other things
>>
>> org.apache.pdfbox.pdfviewer.PageDrawer.processTextPosition(PageDrawer.java:174)
>>
>> org.apache.pdfbox.util.PDFStreamEngine.processEncodedText(PDFStreamEngine.java:446)
>> org.apache.pdfbox.util.operator.ShowText.process(ShowText.java:50)
>>
>> org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:497)
>>
>> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:217)
>>
>> org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:176)
>> org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:90)
>> org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:669)
>> org.apache.pdfbox.util.PDFImageWriter.WriteImage(PDFImageWriter.java:86)
>> org.apache.pdfbox.PDFToImage.main(PDFToImage.java:165)
>>
>> I find the way pdf box renders the image is first in
>> org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:669) it
>> creates a new BufferedImage that will be the final image, with this
>> bufferedImage get the graphics an pass it to each other components
>> that in the end PageDrawer will be write  on it.
>>
>> I think the are some problems with this because i write to an image
>> BufferedImage retVal in
>> org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:669) and
>> dosen't contains anything.
>>
>> But i'm sure the
>> org.apache.pdfbox.pdmodel.font.PDType1Font.drawString(PDType1Font.java:2xx)
>>  is drawing the String rigth in the graphics that the method gets.
>>
>> I really apreciate your time and ideas with this problem.
>>
>> You can reproduce the problem using some pdf made with iText
>> http://itextdocs.lowagie.com/tutorial/general/index.php
>> --
>> Sebastián Ortiz Vásquez.
>> Estudiante Ingeniería de Sistemas.
>> Auxiliar de Investigación Grupo de Física Atómica.
>> Universidad de Antioquia.
>> Oficina: 2196577
>> SIP: 3903639
>> 2009
>>
>

Added as issue.

https://issues.apache.org/jira/browse/PDFBOX-478

-- 
Sebastián Ortiz Vásquez.
Estudiante Ingeniería de Sistemas.
Auxiliar de Investigación Grupo de Física Atómica.
Universidad de Antioquia.
Oficina: 2196577
SIP: 3903639
2009

Re: PDFBox String Drawing

Posted by Daniel Wilson <wi...@gmail.com>.
Sebastian,

Are you using PDFBox 0.7.3?  Andreas has fixed most of those font problems
in 0.8.0.

If 0.8.0 doesn't work for you either, please create an issue and attach one
of the PDF's with which you're having problems.

Thanks.

Daniel Wilson

On Thu, May 21, 2009 at 3:50 AM, Sebastian Ortiz Vasquez
<ne...@gmail.com>wrote:

> Hello Ben,
>
> I write to you because you write lot of code with i have problems,
> also please excuse my english is not good.
>
> I want to send a PDF by Fax, in order to do that i need to convert the
> pdf to image, by now i am using pdf-render library but it dosen't
> render the image at good quality the the fax is poor.
>
> I am looking in pdfbox a good alternative, because it works better,
> but in my particular case isn't working.
>
> I use iText 2.1.4 to generate some text on the PDF i need to send by
> fax, when i try to use PDFToImage the final image don't contain any
> text i write.
>
> I have been debuggin last four hours the code of pdf, at the
> begginning i got some problems relative with fonts because my linux
> box dosen't have the font pdfbox was looking for (arial,
> timesnewroman).
>
> I got this stack for writting text
>
> org.apache.pdfbox.pdmodel.font.PDType1Font.drawString(PDType1Font.java:2xx)
> //I modified other things
>
> org.apache.pdfbox.pdfviewer.PageDrawer.processTextPosition(PageDrawer.java:174)
>
> org.apache.pdfbox.util.PDFStreamEngine.processEncodedText(PDFStreamEngine.java:446)
> org.apache.pdfbox.util.operator.ShowText.process(ShowText.java:50)
>
> org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:497)
>
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:217)
>
> org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:176)
> org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:90)
> org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:669)
> org.apache.pdfbox.util.PDFImageWriter.WriteImage(PDFImageWriter.java:86)
> org.apache.pdfbox.PDFToImage.main(PDFToImage.java:165)
>
> I find the way pdf box renders the image is first in
> org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:669) it
> creates a new BufferedImage that will be the final image, with this
> bufferedImage get the graphics an pass it to each other components
> that in the end PageDrawer will be write  on it.
>
> I think the are some problems with this because i write to an image
> BufferedImage retVal in
> org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:669) and
> dosen't contains anything.
>
> But i'm sure the
> org.apache.pdfbox.pdmodel.font.PDType1Font.drawString(PDType1Font.java:2xx)
>  is drawing the String rigth in the graphics that the method gets.
>
> I really apreciate your time and ideas with this problem.
>
> You can reproduce the problem using some pdf made with iText
> http://itextdocs.lowagie.com/tutorial/general/index.php
> --
> Sebastián Ortiz Vásquez.
> Estudiante Ingeniería de Sistemas.
> Auxiliar de Investigación Grupo de Física Atómica.
> Universidad de Antioquia.
> Oficina: 2196577
> SIP: 3903639
> 2009
>