You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Vincent Roydor <ro...@ocas.ch> on 2015/12/08 16:13:14 UTC

Problem when I print a PDF with a "Watermark"

Hi, 
When I try to print the join PDF with this code : 
travailImpression = printService.createPrintJob(); 
HashPrintRequestAttributeSet printAttributs = creerPrintAttributes(pImprimante, flavor, pDoc, unFormat); 
if(ImprimanteControleurImpl.getEcouteurPrintService().get(pImprimante.getPrintService()).isServiceAccepteJob()){ 
travailImpression.print(docImpression, printAttributs); 
jobsImpression.add(new TravailImpression(travailImpression)); 
} 

(the printing is TWO_SIDED_LONG_EDGE) 
The first page is good but the page 3 and 5 is white where the "Watermark" would be printing. 

Have you an idea where is my error? 

Thanks for your help. 

regards, 



V.Roydor 

Re: Problem when I print a PDF with a "Watermark"

Posted by Vincent Roydor <ro...@ocas.ch>.
Hi,
Yes the problem has been solved.

I use twelvemonkeys library in my pom (with maven) :
                <dependency>
			<groupId>com.twelvemonkeys.imageio</groupId>
			<artifactId>imageio-core</artifactId>
			<version>3.2</version>
		</dependency>
		<dependency>
			<groupId>com.twelvemonkeys.imageio</groupId>
			<artifactId>imageio-jpeg</artifactId>
			<version>3.2</version>
		</dependency>
		<dependency>
			<groupId>com.twelvemonkeys.imageio</groupId>
			<artifactId>imageio-metadata</artifactId>
			<version>3.2</version>
		</dependency>
		<dependency>
			<groupId>com.twelvemonkeys.common</groupId>
			<artifactId>common-lang</artifactId>
			<version>3.2</version>
		</dependency>
		<dependency>
			<groupId>com.twelvemonkeys.common</groupId>
			<artifactId>common-io</artifactId>
			<version>3.2</version>
		</dependency>
		<dependency>
			<groupId>com.twelvemonkeys.common</groupId>
			<artifactId>common-image</artifactId>
			<version>3.2</version>
		</dependency>


And as you suggested, I have adding the attribute printable area : pAttributsDocument.add(0, 0, MediaSize.ISO.A4.getX(MediaSize.MM), MediaSize.ISO.A4.getY(MediaSize.MM), MediaSize.MM);

But with 
this constructor : new PDFPrintable(document, scaling, showPageBorder, dpi)
the bottom of footer is cutting when printing.

And with this constructor : new PDFPrintable(document, scaling)
all is ok.

I don't change driver or frimware. (I can't do that, is not in my service).

Thanks for your help, Tilman


Regards, 

Vincent ROYDOR 


----- Mail original -----
De: "Tilman Hausherr" <TH...@t-online.de>
À: "users" <us...@pdfbox.apache.org>
Envoyé: Vendredi 11 Décembre 2015 19:57:22
Objet: Re: Problem when I print a PDF with a "Watermark"

Just for the record, the problem has been solved by using twelvemonkeys 
and by using the dpi constructor of PDFPageable. There were blank areas 
on the page only when printing, which I'd rather suspect is a 
driver/firmware problem.

Tilman


Am 08.12.2015 um 16:13 schrieb Vincent Roydor:
> Hi,
> When I try to print the join PDF with this code :
> /travailImpression = printService.createPrintJob();/
> /               HashPrintRequestAttributeSet printAttributs = 
> creerPrintAttributes(pImprimante, flavor, pDoc, unFormat);/
> /if(ImprimanteControleurImpl.getEcouteurPrintService().get(pImprimante.getPrintService()).isServiceAccepteJob()){/
> /                    travailImpression.print(docImpression, 
> printAttributs);/
> /                    jobsImpression.add(new 
> TravailImpression(travailImpression));/
> /                }/
>
> (the printing is TWO_SIDED_LONG_EDGE)
> The first page is good but the page 3 and 5 is white where the 
> "Watermark" would be printing.
>
> Have you an idea where is my error?
>
> Thanks for your help.
>
> regards,
>
> *V.Roydor*
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Problem when I print a PDF with a "Watermark"

Posted by Tilman Hausherr <TH...@t-online.de>.
Just for the record, the problem has been solved by using twelvemonkeys 
and by using the dpi constructor of PDFPageable. There were blank areas 
on the page only when printing, which I'd rather suspect is a 
driver/firmware problem.

Tilman


Am 08.12.2015 um 16:13 schrieb Vincent Roydor:
> Hi,
> When I try to print the join PDF with this code :
> /travailImpression = printService.createPrintJob();/
> /               HashPrintRequestAttributeSet printAttributs = 
> creerPrintAttributes(pImprimante, flavor, pDoc, unFormat);/
> /if(ImprimanteControleurImpl.getEcouteurPrintService().get(pImprimante.getPrintService()).isServiceAccepteJob()){/
> /                    travailImpression.print(docImpression, 
> printAttributs);/
> /                    jobsImpression.add(new 
> TravailImpression(travailImpression));/
> /                }/
>
> (the printing is TWO_SIDED_LONG_EDGE)
> The first page is good but the page 3 and 5 is white where the 
> "Watermark" would be printing.
>
> Have you an idea where is my error?
>
> Thanks for your help.
>
> regards,
>
> *V.Roydor*
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Problem when I print a PDF with a "Watermark"

Posted by Tilman Hausherr <TH...@t-online.de>.
That is because PDFDebugger doesn't use twelvemonkeys. You need to 
launch it in a different way, i.e. with "java -cp" which contains the 
jar files (both of PDFDebugger and all of twelvemonkeys), and the start 
class for PDFDebugger is org.apache.pdfbox.debugger.PDFDebugger. However 
you can still look at the "tree" after closing the error anyway.

https://en.wikipedia.org/wiki/Classpath_%28Java%29

several jars are separated with ";". You can use "*".

Alternatively, upload your PDF file somewhere and I'll look at it myself.

Your screenshots didn't make it through the mailing list.

Tilman

Am 09.12.2015 um 07:49 schrieb Vincent Roydor:
> When I launch debugger I have the same error : java.util.concurrent.ExecutionException: java.lang.NegativeArraySizeException
> I put the stack trace in join file.
>
>
> When I select a page with the "WaterMark" I have the error and no display.
> Sorry I don't know what is the "group" in the tree.
>
> I put a screen shot of the tree with the first (up) selected Xf3 is the "WaterMark" (visible in TextView) and the second (down) is the text content in page.
>
> Vincent ROYDOR
>
>
> ----- Mail original -----
> De: "Tilman Hausherr" <TH...@t-online.de>
> À: "users" <us...@pdfbox.apache.org>
> Envoyé: Mardi 8 Décembre 2015 18:05:25
> Objet: Re: Problem when I print a PDF with a "Watermark"
>
> Am 08.12.2015 um 16:13 schrieb Vincent Roydor:
>> Hi,
>> When I try to print the join PDF with this code :
>> /travailImpression = printService.createPrintJob();/
>> /               HashPrintRequestAttributeSet printAttributs =
>> creerPrintAttributes(pImprimante, flavor, pDoc, unFormat);/
>> /if(ImprimanteControleurImpl.getEcouteurPrintService().get(pImprimante.getPrintService()).isServiceAccepteJob()){/
>> /                    travailImpression.print(docImpression,
>> printAttributs);/
>> /                    jobsImpression.add(new
>> TravailImpression(travailImpression));/
>> /                }/
>>
>> (the printing is TWO_SIDED_LONG_EDGE)
>> The first page is good but the page 3 and 5 is white where the
>> "Watermark" would be printing.
>>
> Try displaying it with PDFDebugger. Does it also happen? If yes: open
> the "tree" and look for "group". If yes, then it is possibly one of the
> few things that we don't do properly, i.e. transparency groups.
>
> Tilman
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Problem when I print a PDF with a "Watermark"

Posted by Vincent Roydor <ro...@ocas.ch>.
Sorry I forgot the printscreen

regards,
Vincent ROYDOR 

----- Mail original -----
De: "Vincent Roydor" <ro...@ocas.ch>
À: "users" <us...@pdfbox.apache.org>
Envoyé: Mercredi 9 Décembre 2015 07:49:49
Objet: Re: Problem when I print a PDF with a "Watermark"

When I launch debugger I have the same error : java.util.concurrent.ExecutionException: java.lang.NegativeArraySizeException
I put the stack trace in join file.


When I select a page with the "WaterMark" I have the error and no display.
Sorry I don't know what is the "group" in the tree.

I put a screen shot of the tree with the first (up) selected Xf3 is the "WaterMark" (visible in TextView) and the second (down) is the text content in page. 

Vincent ROYDOR 


----- Mail original -----
De: "Tilman Hausherr" <TH...@t-online.de>
À: "users" <us...@pdfbox.apache.org>
Envoyé: Mardi 8 Décembre 2015 18:05:25
Objet: Re: Problem when I print a PDF with a "Watermark"

Am 08.12.2015 um 16:13 schrieb Vincent Roydor:
> Hi,
> When I try to print the join PDF with this code :
> /travailImpression = printService.createPrintJob();/
> /               HashPrintRequestAttributeSet printAttributs = 
> creerPrintAttributes(pImprimante, flavor, pDoc, unFormat);/
> /if(ImprimanteControleurImpl.getEcouteurPrintService().get(pImprimante.getPrintService()).isServiceAccepteJob()){/
> /                    travailImpression.print(docImpression, 
> printAttributs);/
> /                    jobsImpression.add(new 
> TravailImpression(travailImpression));/
> /                }/
>
> (the printing is TWO_SIDED_LONG_EDGE)
> The first page is good but the page 3 and 5 is white where the 
> "Watermark" would be printing.
>

Try displaying it with PDFDebugger. Does it also happen? If yes: open 
the "tree" and look for "group". If yes, then it is possibly one of the 
few things that we don't do properly, i.e. transparency groups.

Tilman

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

Re: Problem when I print a PDF with a "Watermark"

Posted by Vincent Roydor <ro...@ocas.ch>.
When I launch debugger I have the same error : java.util.concurrent.ExecutionException: java.lang.NegativeArraySizeException
I put the stack trace in join file.


When I select a page with the "WaterMark" I have the error and no display.
Sorry I don't know what is the "group" in the tree.

I put a screen shot of the tree with the first (up) selected Xf3 is the "WaterMark" (visible in TextView) and the second (down) is the text content in page. 

Vincent ROYDOR 


----- Mail original -----
De: "Tilman Hausherr" <TH...@t-online.de>
À: "users" <us...@pdfbox.apache.org>
Envoyé: Mardi 8 Décembre 2015 18:05:25
Objet: Re: Problem when I print a PDF with a "Watermark"

Am 08.12.2015 um 16:13 schrieb Vincent Roydor:
> Hi,
> When I try to print the join PDF with this code :
> /travailImpression = printService.createPrintJob();/
> /               HashPrintRequestAttributeSet printAttributs = 
> creerPrintAttributes(pImprimante, flavor, pDoc, unFormat);/
> /if(ImprimanteControleurImpl.getEcouteurPrintService().get(pImprimante.getPrintService()).isServiceAccepteJob()){/
> /                    travailImpression.print(docImpression, 
> printAttributs);/
> /                    jobsImpression.add(new 
> TravailImpression(travailImpression));/
> /                }/
>
> (the printing is TWO_SIDED_LONG_EDGE)
> The first page is good but the page 3 and 5 is white where the 
> "Watermark" would be printing.
>

Try displaying it with PDFDebugger. Does it also happen? If yes: open 
the "tree" and look for "group". If yes, then it is possibly one of the 
few things that we don't do properly, i.e. transparency groups.

Tilman

Re: Problem when I print a PDF with a "Watermark"

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 08.12.2015 um 16:13 schrieb Vincent Roydor:
> Hi,
> When I try to print the join PDF with this code :
> /travailImpression = printService.createPrintJob();/
> /               HashPrintRequestAttributeSet printAttributs = 
> creerPrintAttributes(pImprimante, flavor, pDoc, unFormat);/
> /if(ImprimanteControleurImpl.getEcouteurPrintService().get(pImprimante.getPrintService()).isServiceAccepteJob()){/
> /                    travailImpression.print(docImpression, 
> printAttributs);/
> /                    jobsImpression.add(new 
> TravailImpression(travailImpression));/
> /                }/
>
> (the printing is TWO_SIDED_LONG_EDGE)
> The first page is good but the page 3 and 5 is white where the 
> "Watermark" would be printing.
>

Try displaying it with PDFDebugger. Does it also happen? If yes: open 
the "tree" and look for "group". If yes, then it is possibly one of the 
few things that we don't do properly, i.e. transparency groups.

Tilman