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 <[email protected]> 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 <[email protected]> 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 <[email protected]> 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
>>>> 
>>> 
>> 
>> 

Reply via email to