You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Laurent Yaish <la...@gmail.com> on 2014/08/30 23:37:07 UTC

Multi-page overlay with OverlayPDF in PDFBox 1.8.2

Hi,

I'm trying to overlay a 12 page PDF with a 2 page "template".
With the old Overlay implementation it would repeat the template 6 times:
page 1, page 2, page 1...

I tried several of the options documented, but couldn't get it to work like
it used to.

Does the new implementation support this?

I'm only using 1.8.2 because the code appears to be broken in the latest
1.8.6.

Thanks

Laurent

Re: Multi-page overlay with OverlayPDF in PDFBox 1.8.2

Posted by Laurent Yaish <la...@gmail.com>.
Hi Tilman,

I think you responded right before I subscribed to the list, so sorry if
I'm messing this up.

3) was that the PDF generated only used the first page of the template on
each of the 12 pages of the document.
But looking at the code I see that this is by design. This was using 1.8.2.

With 1.8.6 there was no overlay at all, the generated PDF looked just like
the original document. I will give the 1.8.7 snapshot a try.

Thanks

Laurent



On Sun, 31 Aug 2014 01:24:33 +0200, Tilman Hausherr wrote:

> Hello Laurent, I'm not the overlay specialist here but a good bug report
> has three
> components:
> 1) what you tried to do - you mentioned it
> 2) what you were expecting - you mentioned it
> 3) what happened instead - ???? (3) is just "but couldn't get it to work"
> instead of a description of
> what really happened. However... Andreas recently (today) solved a bug in
> the overlay code, so
> please test a current snapshot .jar:
>
> http://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/1.8.7-SNAPSHOT/pdfbox-app-1.8.7-20140830.170955-123.jar
> If it works - great
> If it doesn't work - please open an issue in JIRA, and describe what
> happened. Tilman



On Sat, Aug 30, 2014 at 2:37 PM, Laurent Yaish <la...@gmail.com> wrote:

> Hi,
>
> I'm trying to overlay a 12 page PDF with a 2 page "template".
> With the old Overlay implementation it would repeat the template 6 times:
> page 1, page 2, page 1...
>
> I tried several of the options documented, but couldn't get it to work
> like it used to.
>
> Does the new implementation support this?
>
> I'm only using 1.8.2 because the code appears to be broken in the latest
> 1.8.6.
>
> Thanks
>
> Laurent
>
>

Re: Multi-page overlay with OverlayPDF in PDFBox 1.8.2

Posted by Tilman Hausherr <TH...@t-online.de>.
Hello Laurent,

I'm not the overlay specialist here but a good bug report has three 
components:
1) what you tried to do - you mentioned it
2) what you were expecting - you mentioned it
3) what happened instead - ????

(3) is just "but couldn't get it to work" instead of a description of 
what really happened.

However... Andreas recently (today) solved a bug in the overlay code, so 
please test a current snapshot .jar:
http://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/1.8.7-SNAPSHOT/pdfbox-app-1.8.7-20140830.170955-123.jar

If it works - great
If it doesn't work - please open an issue in JIRA, and describe what 
happened.

Tilman



Am 30.08.2014 23:37, schrieb Laurent Yaish:
> Hi,
>
> I'm trying to overlay a 12 page PDF with a 2 page "template".
> With the old Overlay implementation it would repeat the template 6 times:
> page 1, page 2, page 1...
>
> I tried several of the options documented, but couldn't get it to work like
> it used to.
>
> Does the new implementation support this?
>
> I'm only using 1.8.2 because the code appears to be broken in the latest
> 1.8.6.
>
> Thanks
>
> Laurent
>


Re: Multi-page overlay with OverlayPDF in PDFBox 1.8.2

Posted by Laurent Yaish <la...@gmail.com>.
Here you go https://issues.apache.org/jira/browse/PDFBOX-2314




On Tue, Sep 2, 2014 at 1:01 PM, Andreas Lehmkuehler <an...@lehmi.de>
wrote:

> Hi,
>
> Am 02.09.2014 18:53, schrieb Laurent Yaish:
>
>  Hi Andreas,
>>
>> Should I create an issue in Jira for this?
>>
> Yes, please, good idea.
>
>
>  Thanks
>>
>> Laurent
>>
>
> BR
> Andreas Lehmkühler
>
>
>>
>> On Sun, Aug 31, 2014 at 11:32 AM, Laurent Yaish <la...@gmail.com>
>> wrote:
>>
>>  Hi Andreas,
>>>
>>> Yes that is correct. The pages of the overlay used to get repeated
>>> instead
>>> of just using the first page.
>>>
>>> Thanks
>>>
>>> Laurent
>>>
>>>
>>> On Sun, Aug 31, 2014 at 3:52 AM, Andreas Lehmkuehler <an...@lehmi.de>
>>> wrote:
>>>
>>>  Hi,
>>>>
>>>> Am 31.08.2014 02:45, schrieb Laurent Yaish:
>>>>
>>>>   So I looked at the code and it does look like there is no way to do
>>>> this
>>>>
>>>>> with the new implementation.
>>>>> Using the -even, -odd or -page options could work for a small document,
>>>>> but
>>>>> we wouldn't be able to overlay a 999 page PDF with a 3 page template.
>>>>>
>>>>> What if we added something like a -useAllOverlayPages parameter (it's a
>>>>> bad
>>>>> name, I know)  that would then populate specificPageOverlayPage with
>>>>> all
>>>>> the pages available from the defaultOverlay and then just do something
>>>>> like:
>>>>>
>>>>> int usePageNum = pageNumber % specificPageOverlayPage.size(); if
>>>>> (useAllOverlayPages && specificPageOverlayPage.
>>>>> containsKey(usePageNum))
>>>>> {
>>>>> layoutPage = specificPageOverlayPage.get(usePageNum); }
>>>>>
>>>>> in the overlayPage() method.
>>>>>
>>>>> I'd try it, but don't code in Java and it probably would take me a
>>>>> while
>>>>> just to get the thing to compile... :)
>>>>>
>>>>>  Just for clarification. In your given example you expect to overlay
>>>> your
>>>> 999 pages pdf with a 3 pages overlay pdf by repeating those 3 pages over
>>>> and over again. Am I right?
>>>>
>>>>   Thoughts?
>>>>
>>>>>
>>>>>  Obviously the old implementation provided that feature and the current
>>>> one not. So, if it's needed we should reimplement it. Shouldn't be that
>>>> hard ....
>>>>
>>>>   Thanks
>>>>
>>>>>
>>>>> Laurent
>>>>>
>>>>>
>>>> BR
>>>> Andreas Lehmkühler
>>>>
>>>>
>>>>
>>>>
>>>>> On Sat, Aug 30, 2014 at 2:37 PM, Laurent Yaish <la...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>   Hi,
>>>>>
>>>>>>
>>>>>> I'm trying to overlay a 12 page PDF with a 2 page "template".
>>>>>> With the old Overlay implementation it would repeat the template 6
>>>>>> times:
>>>>>> page 1, page 2, page 1...
>>>>>>
>>>>>> I tried several of the options documented, but couldn't get it to work
>>>>>> like it used to.
>>>>>>
>>>>>> Does the new implementation support this?
>>>>>>
>>>>>> I'm only using 1.8.2 because the code appears to be broken in the
>>>>>> latest
>>>>>> 1.8.6.
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Laurent
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: Multi-page overlay with OverlayPDF in PDFBox 1.8.2

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,

Am 02.09.2014 18:53, schrieb Laurent Yaish:
> Hi Andreas,
>
> Should I create an issue in Jira for this?
Yes, please, good idea.

> Thanks
>
> Laurent

BR
Andreas Lehmkühler

>
>
> On Sun, Aug 31, 2014 at 11:32 AM, Laurent Yaish <la...@gmail.com> wrote:
>
>> Hi Andreas,
>>
>> Yes that is correct. The pages of the overlay used to get repeated instead
>> of just using the first page.
>>
>> Thanks
>>
>> Laurent
>>
>>
>> On Sun, Aug 31, 2014 at 3:52 AM, Andreas Lehmkuehler <an...@lehmi.de>
>> wrote:
>>
>>> Hi,
>>>
>>> Am 31.08.2014 02:45, schrieb Laurent Yaish:
>>>
>>>   So I looked at the code and it does look like there is no way to do this
>>>> with the new implementation.
>>>> Using the -even, -odd or -page options could work for a small document,
>>>> but
>>>> we wouldn't be able to overlay a 999 page PDF with a 3 page template.
>>>>
>>>> What if we added something like a -useAllOverlayPages parameter (it's a
>>>> bad
>>>> name, I know)  that would then populate specificPageOverlayPage with all
>>>> the pages available from the defaultOverlay and then just do something
>>>> like:
>>>>
>>>> int usePageNum = pageNumber % specificPageOverlayPage.size(); if
>>>> (useAllOverlayPages && specificPageOverlayPage.containsKey(usePageNum))
>>>> {
>>>> layoutPage = specificPageOverlayPage.get(usePageNum); }
>>>>
>>>> in the overlayPage() method.
>>>>
>>>> I'd try it, but don't code in Java and it probably would take me a while
>>>> just to get the thing to compile... :)
>>>>
>>> Just for clarification. In your given example you expect to overlay your
>>> 999 pages pdf with a 3 pages overlay pdf by repeating those 3 pages over
>>> and over again. Am I right?
>>>
>>>   Thoughts?
>>>>
>>> Obviously the old implementation provided that feature and the current
>>> one not. So, if it's needed we should reimplement it. Shouldn't be that
>>> hard ....
>>>
>>>   Thanks
>>>>
>>>> Laurent
>>>>
>>>
>>> BR
>>> Andreas Lehmkühler
>>>
>>>
>>>
>>>>
>>>> On Sat, Aug 30, 2014 at 2:37 PM, Laurent Yaish <la...@gmail.com>
>>>> wrote:
>>>>
>>>>   Hi,
>>>>>
>>>>> I'm trying to overlay a 12 page PDF with a 2 page "template".
>>>>> With the old Overlay implementation it would repeat the template 6
>>>>> times:
>>>>> page 1, page 2, page 1...
>>>>>
>>>>> I tried several of the options documented, but couldn't get it to work
>>>>> like it used to.
>>>>>
>>>>> Does the new implementation support this?
>>>>>
>>>>> I'm only using 1.8.2 because the code appears to be broken in the latest
>>>>> 1.8.6.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Laurent
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>


Re: Multi-page overlay with OverlayPDF in PDFBox 1.8.2

Posted by Laurent Yaish <la...@gmail.com>.
Hi Andreas,

Should I create an issue in Jira for this?

Thanks

Laurent


On Sun, Aug 31, 2014 at 11:32 AM, Laurent Yaish <la...@gmail.com> wrote:

> Hi Andreas,
>
> Yes that is correct. The pages of the overlay used to get repeated instead
> of just using the first page.
>
> Thanks
>
> Laurent
>
>
> On Sun, Aug 31, 2014 at 3:52 AM, Andreas Lehmkuehler <an...@lehmi.de>
> wrote:
>
>> Hi,
>>
>> Am 31.08.2014 02:45, schrieb Laurent Yaish:
>>
>>  So I looked at the code and it does look like there is no way to do this
>>> with the new implementation.
>>> Using the -even, -odd or -page options could work for a small document,
>>> but
>>> we wouldn't be able to overlay a 999 page PDF with a 3 page template.
>>>
>>> What if we added something like a -useAllOverlayPages parameter (it's a
>>> bad
>>> name, I know)  that would then populate specificPageOverlayPage with all
>>> the pages available from the defaultOverlay and then just do something
>>> like:
>>>
>>> int usePageNum = pageNumber % specificPageOverlayPage.size(); if
>>> (useAllOverlayPages && specificPageOverlayPage.containsKey(usePageNum))
>>> {
>>> layoutPage = specificPageOverlayPage.get(usePageNum); }
>>>
>>> in the overlayPage() method.
>>>
>>> I'd try it, but don't code in Java and it probably would take me a while
>>> just to get the thing to compile... :)
>>>
>> Just for clarification. In your given example you expect to overlay your
>> 999 pages pdf with a 3 pages overlay pdf by repeating those 3 pages over
>> and over again. Am I right?
>>
>>  Thoughts?
>>>
>> Obviously the old implementation provided that feature and the current
>> one not. So, if it's needed we should reimplement it. Shouldn't be that
>> hard ....
>>
>>  Thanks
>>>
>>> Laurent
>>>
>>
>> BR
>> Andreas Lehmkühler
>>
>>
>>
>>>
>>> On Sat, Aug 30, 2014 at 2:37 PM, Laurent Yaish <la...@gmail.com>
>>> wrote:
>>>
>>>  Hi,
>>>>
>>>> I'm trying to overlay a 12 page PDF with a 2 page "template".
>>>> With the old Overlay implementation it would repeat the template 6
>>>> times:
>>>> page 1, page 2, page 1...
>>>>
>>>> I tried several of the options documented, but couldn't get it to work
>>>> like it used to.
>>>>
>>>> Does the new implementation support this?
>>>>
>>>> I'm only using 1.8.2 because the code appears to be broken in the latest
>>>> 1.8.6.
>>>>
>>>> Thanks
>>>>
>>>> Laurent
>>>>
>>>>
>>>>
>>>
>>
>

Re: Multi-page overlay with OverlayPDF in PDFBox 1.8.2

Posted by Laurent Yaish <la...@gmail.com>.
Hi Andreas,

Yes that is correct. The pages of the overlay used to get repeated instead
of just using the first page.

Thanks

Laurent

On Sun, Aug 31, 2014 at 3:52 AM, Andreas Lehmkuehler <an...@lehmi.de>
wrote:

> Hi,
>
> Am 31.08.2014 02:45, schrieb Laurent Yaish:
>
>  So I looked at the code and it does look like there is no way to do this
>> with the new implementation.
>> Using the -even, -odd or -page options could work for a small document,
>> but
>> we wouldn't be able to overlay a 999 page PDF with a 3 page template.
>>
>> What if we added something like a -useAllOverlayPages parameter (it's a
>> bad
>> name, I know)  that would then populate specificPageOverlayPage with all
>> the pages available from the defaultOverlay and then just do something
>> like:
>>
>> int usePageNum = pageNumber % specificPageOverlayPage.size(); if
>> (useAllOverlayPages && specificPageOverlayPage.containsKey(usePageNum)) {
>> layoutPage = specificPageOverlayPage.get(usePageNum); }
>>
>> in the overlayPage() method.
>>
>> I'd try it, but don't code in Java and it probably would take me a while
>> just to get the thing to compile... :)
>>
> Just for clarification. In your given example you expect to overlay your
> 999 pages pdf with a 3 pages overlay pdf by repeating those 3 pages over
> and over again. Am I right?
>
>  Thoughts?
>>
> Obviously the old implementation provided that feature and the current one
> not. So, if it's needed we should reimplement it. Shouldn't be that hard
> ....
>
>  Thanks
>>
>> Laurent
>>
>
> BR
> Andreas Lehmkühler
>
>
>
>>
>> On Sat, Aug 30, 2014 at 2:37 PM, Laurent Yaish <la...@gmail.com>
>> wrote:
>>
>>  Hi,
>>>
>>> I'm trying to overlay a 12 page PDF with a 2 page "template".
>>> With the old Overlay implementation it would repeat the template 6 times:
>>> page 1, page 2, page 1...
>>>
>>> I tried several of the options documented, but couldn't get it to work
>>> like it used to.
>>>
>>> Does the new implementation support this?
>>>
>>> I'm only using 1.8.2 because the code appears to be broken in the latest
>>> 1.8.6.
>>>
>>> Thanks
>>>
>>> Laurent
>>>
>>>
>>>
>>
>

Re: Multi-page overlay with OverlayPDF in PDFBox 1.8.2

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,

Am 31.08.2014 02:45, schrieb Laurent Yaish:
> So I looked at the code and it does look like there is no way to do this
> with the new implementation.
> Using the -even, -odd or -page options could work for a small document, but
> we wouldn't be able to overlay a 999 page PDF with a 3 page template.
>
> What if we added something like a -useAllOverlayPages parameter (it's a bad
> name, I know)  that would then populate specificPageOverlayPage with all
> the pages available from the defaultOverlay and then just do something like:
>
> int usePageNum = pageNumber % specificPageOverlayPage.size(); if
> (useAllOverlayPages && specificPageOverlayPage.containsKey(usePageNum)) {
> layoutPage = specificPageOverlayPage.get(usePageNum); }
>
> in the overlayPage() method.
>
> I'd try it, but don't code in Java and it probably would take me a while
> just to get the thing to compile... :)
Just for clarification. In your given example you expect to overlay your 999 
pages pdf with a 3 pages overlay pdf by repeating those 3 pages over and over 
again. Am I right?

> Thoughts?
Obviously the old implementation provided that feature and the current one not. 
So, if it's needed we should reimplement it. Shouldn't be that hard ....

> Thanks
>
> Laurent

BR
Andreas Lehmkühler

>
>
> On Sat, Aug 30, 2014 at 2:37 PM, Laurent Yaish <la...@gmail.com> wrote:
>
>> Hi,
>>
>> I'm trying to overlay a 12 page PDF with a 2 page "template".
>> With the old Overlay implementation it would repeat the template 6 times:
>> page 1, page 2, page 1...
>>
>> I tried several of the options documented, but couldn't get it to work
>> like it used to.
>>
>> Does the new implementation support this?
>>
>> I'm only using 1.8.2 because the code appears to be broken in the latest
>> 1.8.6.
>>
>> Thanks
>>
>> Laurent
>>
>>
>


Re: Multi-page overlay with OverlayPDF in PDFBox 1.8.2

Posted by Laurent Yaish <la...@gmail.com>.
So I looked at the code and it does look like there is no way to do this
with the new implementation.
Using the -even, -odd or -page options could work for a small document, but
we wouldn't be able to overlay a 999 page PDF with a 3 page template.

What if we added something like a -useAllOverlayPages parameter (it's a bad
name, I know)  that would then populate specificPageOverlayPage with all
the pages available from the defaultOverlay and then just do something like:

int usePageNum = pageNumber % specificPageOverlayPage.size(); if
(useAllOverlayPages && specificPageOverlayPage.containsKey(usePageNum)) {
layoutPage = specificPageOverlayPage.get(usePageNum); }

in the overlayPage() method.

I'd try it, but don't code in Java and it probably would take me a while
just to get the thing to compile... :)

Thoughts?

Thanks

Laurent


On Sat, Aug 30, 2014 at 2:37 PM, Laurent Yaish <la...@gmail.com> wrote:

> Hi,
>
> I'm trying to overlay a 12 page PDF with a 2 page "template".
> With the old Overlay implementation it would repeat the template 6 times:
> page 1, page 2, page 1...
>
> I tried several of the options documented, but couldn't get it to work
> like it used to.
>
> Does the new implementation support this?
>
> I'm only using 1.8.2 because the code appears to be broken in the latest
> 1.8.6.
>
> Thanks
>
> Laurent
>
>