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/09 17:12:37 UTC

bug with printing pdf on windows

Hi,
I'm using pdfbox 2.0.0 to print pdfs of size 4x6" to label printers.
On windows 7 I try to print a 2 page pdf. It prints successfully however
the second page is completely black when it should be a table with some
text.

The pdf I am printing is available
here<https://www.dropbox.com/sh/bkzf7nbrs04hm4w/YasXlgnftK/job.pdf>
.
What is printed on Windows 7 is available
here<https://www.dropbox.com/s/lxnsgcfsdc0k2rh/printjob_windows.pdf>

If anyone can help me get the pdf printing on Windows 7 I would really
appreciate it.

Thank you.

Regards
Joseph

Re: bug with printing pdf on windows

Posted by Tilman Hausherr <TH...@t-online.de>.
I did some debugging. I found out that I also got the "mostly black" 
image by doing a renderPageToGraphics() into the graphics context of a 
BufferedImage and save that one. This means that it is not a printer 
problem.

The solution:

g.setBackground(Color.WHITE);

was missing in PDFPrintable, or in a later method. If I use this, I get 
a clean image. And also a clean print.

Joseph, if you're building from source, just add the line

g.setBackground(Color.WHITE);

above

renderer.renderPageToGraphics(pageIndex, graphics2D, (float)scale);


Tilman


Am 09.04.2014 20:04, schrieb Tilman Hausherr:
> I was able to reproduce it with the app and using the PDFReader 
> parameter and then print from the GUI. I get the effect both  when 
> printing to a printer (there goes the toner...) and printing to a PDF 
> driver.
>
> I mention this so that people can try the same with another OS or 
> another JDK to see if there's a difference.
>
> I did it with W7, JDK 1.7.0_51 (64bit)
>
> Tilman
>
>
>
> Am 09.04.2014 19:39, schrieb John Hewson:
>> Hi Joseph
>>
>> This seems to be a Windows-specific JVM issue, I can’t find an 
>> obvious cause.
>> I thought you were using Mac OS X?
>>
>> I have to go and catch another plane now.
>>
>> Cheers
>>
>> -- John
>>
>> On 9 Apr 2014, at 16:12, Joseph Siddal <jo...@omlet.co.uk> wrote:
>>
>>> Hi,
>>> I'm using pdfbox 2.0.0 to print pdfs of size 4x6" to label printers.
>>> On windows 7 I try to print a 2 page pdf. It prints successfully 
>>> however
>>> the second page is completely black when it should be a table with some
>>> text.
>>>
>>> The pdf I am printing is available
>>> here<https://www.dropbox.com/sh/bkzf7nbrs04hm4w/YasXlgnftK/job.pdf>
>>> .
>>> What is printed on Windows 7 is available
>>> here<https://www.dropbox.com/s/lxnsgcfsdc0k2rh/printjob_windows.pdf>
>>>
>>> If anyone can help me get the pdf printing on Windows 7 I would really
>>> appreciate it.
>>>
>>> Thank you.
>>>
>>> Regards
>>> Joseph
>>
>


Re: bug with printing pdf on windows

Posted by Tilman Hausherr <TH...@t-online.de>.
I was able to reproduce it with the app and using the PDFReader 
parameter and then print from the GUI. I get the effect both  when 
printing to a printer (there goes the toner...) and printing to a PDF 
driver.

I mention this so that people can try the same with another OS or 
another JDK to see if there's a difference.

I did it with W7, JDK 1.7.0_51 (64bit)

Tilman



Am 09.04.2014 19:39, schrieb John Hewson:
> Hi Joseph
>
> This seems to be a Windows-specific JVM issue, I can’t find an obvious cause.
> I thought you were using Mac OS X?
>
> I have to go and catch another plane now.
>
> Cheers
>
> -- John
>
> On 9 Apr 2014, at 16:12, Joseph Siddal <jo...@omlet.co.uk> wrote:
>
>> Hi,
>> I'm using pdfbox 2.0.0 to print pdfs of size 4x6" to label printers.
>> On windows 7 I try to print a 2 page pdf. It prints successfully however
>> the second page is completely black when it should be a table with some
>> text.
>>
>> The pdf I am printing is available
>> here<https://www.dropbox.com/sh/bkzf7nbrs04hm4w/YasXlgnftK/job.pdf>
>> .
>> What is printed on Windows 7 is available
>> here<https://www.dropbox.com/s/lxnsgcfsdc0k2rh/printjob_windows.pdf>
>>
>> If anyone can help me get the pdf printing on Windows 7 I would really
>> appreciate it.
>>
>> Thank you.
>>
>> Regards
>> Joseph
>


Re: bug with printing pdf on windows

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

This seems to be a Windows-specific JVM issue, I can’t find an obvious cause.
I thought you were using Mac OS X?

I have to go and catch another plane now.

Cheers

-- John

On 9 Apr 2014, at 16:12, Joseph Siddal <jo...@omlet.co.uk> wrote:

> Hi,
> I'm using pdfbox 2.0.0 to print pdfs of size 4x6" to label printers.
> On windows 7 I try to print a 2 page pdf. It prints successfully however
> the second page is completely black when it should be a table with some
> text.
> 
> The pdf I am printing is available
> here<https://www.dropbox.com/sh/bkzf7nbrs04hm4w/YasXlgnftK/job.pdf>
> .
> What is printed on Windows 7 is available
> here<https://www.dropbox.com/s/lxnsgcfsdc0k2rh/printjob_windows.pdf>
> 
> If anyone can help me get the pdf printing on Windows 7 I would really
> appreciate it.
> 
> Thank you.
> 
> Regards
> Joseph


Re: bug with printing pdf on windows

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

As a workaround until this is fixed - have you tried rendering it into 
an image that has the dpi of the printer, and then print that one?

Tilman

Am 09.04.2014 17:12, schrieb Joseph Siddal:
> Hi,
> I'm using pdfbox 2.0.0 to print pdfs of size 4x6" to label printers.
> On windows 7 I try to print a 2 page pdf. It prints successfully however
> the second page is completely black when it should be a table with some
> text.
>
> The pdf I am printing is available
> here<https://www.dropbox.com/sh/bkzf7nbrs04hm4w/YasXlgnftK/job.pdf>
> .
> What is printed on Windows 7 is available
> here<https://www.dropbox.com/s/lxnsgcfsdc0k2rh/printjob_windows.pdf>
>
> If anyone can help me get the pdf printing on Windows 7 I would really
> appreciate it.
>
> Thank you.
>
> Regards
> Joseph
>