You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Joseph Siddal <jo...@omlet.co.uk> on 2014/04/10 18:08:06 UTC

possible missing fonts pdfbox 2.0.0

When I try to print the pdf available
here<https://www.dropbox.com/s/bb44l6r6lno4sgt/pdf_fail.pdf> there
are 2 boxes on the second page with text "CV 138" and "D946". both text are
in black boxes. When this is printed out on windows machine the text in the
2 boxes is not there but on a mac its fine. Using pdffonts command it shows
their are 3 fonts Helvetica, Helvetica-Bold and Courier that are not
embedded in the pdf.  Could this be causing it?

How do I solve it so the text will be visible in the boxes?

Thank you

Regards
Joseph

Re: possible missing fonts pdfbox 2.0.0

Posted by Tilman Hausherr <TH...@t-online.de>.
I have a €100 HP printer. And yes, I used the physical printer.

Also you also the creator of this PDF, or are the creators of PDF in 
your company ? If yes, why not use a different color / different design 
as a workaround?

Also, just to be sure, check if there are updates to the printer driver.

Tilman

Am 11.04.2014 12:39, schrieb Joseph Siddal:
> Hi Tilman and John,
> When I print to a virtual printer there is no problem, it is only when I
> print to physical printers I get this problem.
> What printers are you using to print the pdf? I'm Printing to Zebra LP2844
> and can recreate it on a Citizen.
> I'm on the very latest source with svn (revision: 1586460).
> I'm using Windows 7 and have the exact same java version and build
> (24.51-b03) installed.
>
> It's only on windows I get this problem.
>
> Thank you
>
> Regards
> Joseph
>
>
>
> On 10 April 2014 22:41, John Hewson <jo...@jahewson.com> wrote:
>
>> Hi Joseph
>>
>> I'm not able to reproduce this either. I'm on Windows 7 with the following
>> version of Java:
>>
>> java version "1.7.0_51"
>> Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
>> Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
>>
>> Cheers
>>
>> -- John
>>
>> On 10 Apr 2014, at 18:24, Tilman Hausherr <TH...@t-online.de> wrote:
>>
>>> It works for me. Did you get the latest source with svn?
>>>
>>> Tilman
>>>
>>> Am 10.04.2014 18:08, schrieb Joseph Siddal:
>>>> When I try to print the pdf available
>>>> here<https://www.dropbox.com/s/bb44l6r6lno4sgt/pdf_fail.pdf> there
>>>> are 2 boxes on the second page with text "CV 138" and "D946". both text
>> are
>>>> in black boxes. When this is printed out on windows machine the text in
>> the
>>>> 2 boxes is not there but on a mac its fine. Using pdffonts command it
>> shows
>>>> their are 3 fonts Helvetica, Helvetica-Bold and Courier that are not
>>>> embedded in the pdf.  Could this be causing it?
>>>>
>>>> How do I solve it so the text will be visible in the boxes?
>>>>
>>>> Thank you
>>>>
>>>> Regards
>>>> Joseph
>>>>
>>


Re: possible missing fonts pdfbox 2.0.0

Posted by John Hewson <jo...@jahewson.com>.
I was using Microsoft’s XPS virtual printer driver. I know that Java converts
the Graphics2D command into PostScript it order to send them to printers,
so it may be a problem in how the printer driver (or the printer itself) is
handling PostScript, especially given that we’re not seeing the same result
on other printers.

If there’s something unusual about the text in those boxes then it might be
possible to work around printer driver bugs… alternatively we could render
the page to a BufferedImage and send it to the printer as a bitmap instead
of as graphics commands which get converted into PostScript.

-- John

On 11 Apr 2014, at 11:39, Joseph Siddal <jo...@omlet.co.uk> wrote:

> Hi Tilman and John,
> When I print to a virtual printer there is no problem, it is only when I
> print to physical printers I get this problem.
> What printers are you using to print the pdf? I'm Printing to Zebra LP2844
> and can recreate it on a Citizen.
> I'm on the very latest source with svn (revision: 1586460).
> I'm using Windows 7 and have the exact same java version and build
> (24.51-b03) installed.
> 
> It's only on windows I get this problem.
> 
> Thank you
> 
> Regards
> Joseph
> 
> 
> 
> On 10 April 2014 22:41, John Hewson <jo...@jahewson.com> wrote:
> 
>> Hi Joseph
>> 
>> I'm not able to reproduce this either. I'm on Windows 7 with the following
>> version of Java:
>> 
>> java version "1.7.0_51"
>> Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
>> Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
>> 
>> Cheers
>> 
>> -- John
>> 
>> On 10 Apr 2014, at 18:24, Tilman Hausherr <TH...@t-online.de> wrote:
>> 
>>> It works for me. Did you get the latest source with svn?
>>> 
>>> Tilman
>>> 
>>> Am 10.04.2014 18:08, schrieb Joseph Siddal:
>>>> When I try to print the pdf available
>>>> here<https://www.dropbox.com/s/bb44l6r6lno4sgt/pdf_fail.pdf> there
>>>> are 2 boxes on the second page with text "CV 138" and "D946". both text
>> are
>>>> in black boxes. When this is printed out on windows machine the text in
>> the
>>>> 2 boxes is not there but on a mac its fine. Using pdffonts command it
>> shows
>>>> their are 3 fonts Helvetica, Helvetica-Bold and Courier that are not
>>>> embedded in the pdf.  Could this be causing it?
>>>> 
>>>> How do I solve it so the text will be visible in the boxes?
>>>> 
>>>> Thank you
>>>> 
>>>> Regards
>>>> Joseph
>>>> 
>>> 
>> 
>> 


Re: possible missing fonts pdfbox 2.0.0

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 12.04.2014 02:35, schrieb John Hewson:
> Let me know if it works.

Joseph, it would be nice to give some feedback re: whether / which 
changes do work or don't.

Tilman



Re: possible missing fonts pdfbox 2.0.0

Posted by John Hewson <jo...@jahewson.com>.
Joseph,

I took a closer look at how PDFBox is rendering this file, the text in
question is being rendered using AWT, which Java passes to the
printer as a (PostScript?) text drawing command. It seems that your
printer driver always draws the text in back, so what you’re seeing is
probably black text on top of a black box.

I think I might have a workaround for you, instead of passing the
vector drawing commands to the printer driver via Graphics2D we
can make PDFBox render the PDF itself into a BufferedImage and
then send that rasterised image to the printer driver. This might be
slower and use more memory, but it is guaranteed to produce the
same result as PDFBox does on the screen.

I've added a new constructor to PDFPrinter in revision 1586802, which
accepts a dpi parameter. If you set this (e.g. to 300) then the printed
output will be rasterized and sent to the printer as a bitmap, instead of
the usual vector graphics, which should bypass your buggy printer driver
and its text rendering.

Let me know if it works.

Cheers

-- John

On 11 Apr 2014, at 11:39, Joseph Siddal <jo...@omlet.co.uk> wrote:

> Hi Tilman and John,
> When I print to a virtual printer there is no problem, it is only when I
> print to physical printers I get this problem.
> What printers are you using to print the pdf? I'm Printing to Zebra LP2844
> and can recreate it on a Citizen.
> I'm on the very latest source with svn (revision: 1586460).
> I'm using Windows 7 and have the exact same java version and build
> (24.51-b03) installed.
> 
> It's only on windows I get this problem.
> 
> Thank you
> 
> Regards
> Joseph
> 
> 
> 
> On 10 April 2014 22:41, John Hewson <jo...@jahewson.com> wrote:
> 
>> Hi Joseph
>> 
>> I'm not able to reproduce this either. I'm on Windows 7 with the following
>> version of Java:
>> 
>> java version "1.7.0_51"
>> Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
>> Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
>> 
>> Cheers
>> 
>> -- John
>> 
>> On 10 Apr 2014, at 18:24, Tilman Hausherr <TH...@t-online.de> wrote:
>> 
>>> It works for me. Did you get the latest source with svn?
>>> 
>>> Tilman
>>> 
>>> Am 10.04.2014 18:08, schrieb Joseph Siddal:
>>>> When I try to print the pdf available
>>>> here<https://www.dropbox.com/s/bb44l6r6lno4sgt/pdf_fail.pdf> there
>>>> are 2 boxes on the second page with text "CV 138" and "D946". both text
>> are
>>>> in black boxes. When this is printed out on windows machine the text in
>> the
>>>> 2 boxes is not there but on a mac its fine. Using pdffonts command it
>> shows
>>>> their are 3 fonts Helvetica, Helvetica-Bold and Courier that are not
>>>> embedded in the pdf.  Could this be causing it?
>>>> 
>>>> How do I solve it so the text will be visible in the boxes?
>>>> 
>>>> Thank you
>>>> 
>>>> Regards
>>>> Joseph
>>>> 
>>> 
>> 
>> 


Re: possible missing fonts pdfbox 2.0.0

Posted by Joseph Siddal <jo...@omlet.co.uk>.
Hi Tilman and John,
When I print to a virtual printer there is no problem, it is only when I
print to physical printers I get this problem.
What printers are you using to print the pdf? I'm Printing to Zebra LP2844
and can recreate it on a Citizen.
I'm on the very latest source with svn (revision: 1586460).
I'm using Windows 7 and have the exact same java version and build
(24.51-b03) installed.

It's only on windows I get this problem.

Thank you

Regards
Joseph



On 10 April 2014 22:41, John Hewson <jo...@jahewson.com> wrote:

> Hi Joseph
>
> I'm not able to reproduce this either. I'm on Windows 7 with the following
> version of Java:
>
> java version "1.7.0_51"
> Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
> Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
>
> Cheers
>
> -- John
>
> On 10 Apr 2014, at 18:24, Tilman Hausherr <TH...@t-online.de> wrote:
>
> > It works for me. Did you get the latest source with svn?
> >
> > Tilman
> >
> > Am 10.04.2014 18:08, schrieb Joseph Siddal:
> >> When I try to print the pdf available
> >> here<https://www.dropbox.com/s/bb44l6r6lno4sgt/pdf_fail.pdf> there
> >> are 2 boxes on the second page with text "CV 138" and "D946". both text
> are
> >> in black boxes. When this is printed out on windows machine the text in
> the
> >> 2 boxes is not there but on a mac its fine. Using pdffonts command it
> shows
> >> their are 3 fonts Helvetica, Helvetica-Bold and Courier that are not
> >> embedded in the pdf.  Could this be causing it?
> >>
> >> How do I solve it so the text will be visible in the boxes?
> >>
> >> Thank you
> >>
> >> Regards
> >> Joseph
> >>
> >
>
>

Re: possible missing fonts pdfbox 2.0.0

Posted by John Hewson <jo...@jahewson.com>.
Hi Joseph

I’m not able to reproduce this either. I’m on Windows 7 with the following version of Java:

java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)

Cheers

-- John

On 10 Apr 2014, at 18:24, Tilman Hausherr <TH...@t-online.de> wrote:

> It works for me. Did you get the latest source with svn?
> 
> Tilman
> 
> Am 10.04.2014 18:08, schrieb Joseph Siddal:
>> When I try to print the pdf available
>> here<https://www.dropbox.com/s/bb44l6r6lno4sgt/pdf_fail.pdf> there
>> are 2 boxes on the second page with text "CV 138" and "D946". both text are
>> in black boxes. When this is printed out on windows machine the text in the
>> 2 boxes is not there but on a mac its fine. Using pdffonts command it shows
>> their are 3 fonts Helvetica, Helvetica-Bold and Courier that are not
>> embedded in the pdf.  Could this be causing it?
>> 
>> How do I solve it so the text will be visible in the boxes?
>> 
>> Thank you
>> 
>> Regards
>> Joseph
>> 
> 


Re: possible missing fonts pdfbox 2.0.0

Posted by Tilman Hausherr <TH...@t-online.de>.
It works for me. Did you get the latest source with svn?

Tilman

Am 10.04.2014 18:08, schrieb Joseph Siddal:
> When I try to print the pdf available
> here<https://www.dropbox.com/s/bb44l6r6lno4sgt/pdf_fail.pdf> there
> are 2 boxes on the second page with text "CV 138" and "D946". both text are
> in black boxes. When this is printed out on windows machine the text in the
> 2 boxes is not there but on a mac its fine. Using pdffonts command it shows
> their are 3 fonts Helvetica, Helvetica-Bold and Courier that are not
> embedded in the pdf.  Could this be causing it?
>
> How do I solve it so the text will be visible in the boxes?
>
> Thank you
>
> Regards
> Joseph
>