Highlighted

Insert a Page Using Scripting

Avatar

Avatar

_Michael_Feicht

Avatar

_Michael_Feicht

_Michael_Feicht

27-05-2008

Hi,



I've wondered if there is a possibility to insert a certain page when rendering the PDF using JavaScript.



I've a table that contains n records. If the table reaches for example page five, I want to insert a page (cover sheet) because the following pages should be packed into a separate envelope and then continue with the table.



I solved the problem partially using conditional breaks on table rows when a certain number of rows has been reached. This solution works only when all rows have the same height. If the heights vary the result is not as good as expected.



Can I create nodes and append them to the document-tree?



thanks in advance

Michael

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

27-05-2008

Could you not cause a conditional break when you reach the end of page 5. In the conditional break section you could test to see which page you are on and then if you are on page 5 see where the x,y coordinates are on the row you have added. If you are too close to the bottom of the page force the break.
Highlighted

Avatar

Avatar

_Michael_Feicht

Avatar

_Michael_Feicht

_Michael_Feicht

27-05-2008

Hi Paul,



thanks for your quick answer.



The page number is always -1 and x is "0in". I think the positioning will be done after generating the table rows and cell. The conditional breaks code is called before the layout ready events.



Maybe I should mention, that there is no user interaction. We have the PDF template and XML data. The render PDF operation creates the final document.



I've just tested it with PreviewPDF. I'm going to test it with a real process.



thanks in advance

Michael
Highlighted

Avatar

Avatar

_Michael_Feicht

Avatar

_Michael_Feicht

_Michael_Feicht

28-05-2008

Hello Paul,



I've used the renderPDF operation to merge the PDF template with data. The x-value is always "0in".



kind regards

Michael
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

28-05-2008

I see .....I do not think you will get the info I request until after the script completes (the objects don't really exist until then that is why you are getting the rsult you mentioned). I do not see how you can do this today.