cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding Image field based on the page number in Adobe Form- Script

Former Member
0 Kudos

Hi Folks,

I have a problem with the print form that I am working on. I need to insert an image of lines (OMR) based on the page numbers. For the OMR part, the first page will always have 4 lines as a image, the middle pages will have 3 lines as a image and the last page will have two lines as a image.

I have uploaded these 3 images a BMPs in SE78 and I am using Xstring of these images in the form. I have two master pages. First master page is for the first page and the second master page is for the remaining pages. The first master page will always have the 4 line image. I created a positioned subform in the master page2, in that subform, I have 2 hidden numeric fields, as the run time properties one for the current page number, other one for the total number of pages. I placed those two images(one for the three line image and the other one for the two line image) exactly on the same location positioned dimensions wise.

I have written the java script for these two image fields to show based on the page numbering. But, somehow, it is not working. Can anybody please let me know where I am doing wrong. I am posting my java script here.

for the three line image:

var cp = data.PageSet.MasterPage2.OMR.cpage.rawValue;

var np = data.PageSet.MasterPage2.OMR.npages.rawValue;

//if(data.#pageSet[0].MasterPage2.OMR.cpage.rawvalue == data.#pageSet[0].MasterPage2.OMR.npages.rawvalue){

for (j=0; j<xfa.layout.pageCount(); j++){

if(cp == np){

xfa.resolveNode("data.PageSet.MasterPage2[" + j + "]").OMR.OMR2.presence = "hidden";

}

else{

xfa.resolveNode("data.pageSet.MasterPage2[" + j + "]").OMR.OMR2.presence = "visible";

}

}

For the two line image:

var cp = data.PageSet.MasterPage2.OMR.cpage.rawValue;

var np = data.PageSet.MasterPage2.OMR.npages.rawValue;

for (j=0; j<xfa.layout.pageCount(); j++){

if(cp == np){

xfa.resolveNode("data.PageSet.MasterPage2[" + j + "]").OMR.OMR3.presence = "hidden";

}

else{

xfa.resolveNode("data.pageSet.MasterPage2[" + j + "]").OMR.OMR3.presence = "visible";

}

}

Please give me a direction as this is kind of hurry.

Thanks,

Srinivas.

Edited by: srinivas kari on Jun 9, 2010 2:03 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Guys,

There was a problem in the script that was the reason it was not executed. Now everything is fine.

Thanks,

Srinivas.

OttoGold
Active Contributor
0 Kudos

Not to experience such problem any more I can recommend you to install LCD 8.1 with the syntax check. Otto

OttoGold
Active Contributor
0 Kudos

Looks like you´re trying some master pages logic. In my experience scripting with a master page objects is always a little weird and does not work as one would expect. Probably there are some limitations... but I have never find a list of the limitations (find myself to write that don´t or find a SAP official document).

Regards Otto

Former Member
0 Kudos

HI Otto,

Thanks for the response. You are right, I am struck with this image. My problem was to keep the OMR marking on each page based on the page number. It is like a lines with 10mmX10mm dimension at the top right corner for the sorter machine to know the number of pages to put in the envelope. The logic for this is, on the first page, it has 4 lines each 3mm apart. On the middle pages it has 3 lines . On the last page it has 2 lines. When the sorter machine picks these, it looks at the first page with 4 lines, it will count as a first page, it will continue through the 3 line pages as the middle pages until it reaches the 2 line to know it as the last page. This is all happens in the master pages. I have two master pages , one for the first page and the second one for the remaining pages.

At first I did not know how to To achieve this, I created 3 images. one with 4 lines, another ones with 3 lines and 2 lines. The 4 lines image was on the first master page. The 3 lines and 2 lines images were on the second master page at the same place as the image fields positioned. Thats where I was trying this scripting. I was trying to capture the current page and number of pages. Based on these, I was trying to place them.

Is there any other way to achieve this instead of using the images? I thought of sy-uline. but some in the forum told that its not going to work. Even if I use the sy-uline, I have to do some script to achieve this I believe.

Any inputs on this.. Please give the direction.

Thanks,

Srinivas.

Former Member
0 Kudos

HI Otto,

Thanks for the response. You are right, I am struck with this image. My problem was to keep the OMR marking on each page based on the page number. It is like a lines with 10mmX10mm dimension at the top right corner for the sorter machine to know the number of pages to put in the envelope. The logic for this is, on the first page, it has 4 lines each 3mm apart. On the middle pages it has 3 lines . On the last page it has 2 lines. When the sorter machine picks these, it looks at the first page with 4 lines, it will count as a first page, it will continue through the 3 line pages as the middle pages until it reaches the 2 line to know it as the last page. This is all happens in the master pages. I have two master pages , one for the first page and the second one for the remaining pages.

At first I did not know how to To achieve this, I created 3 images. one with 4 lines, another ones with 3 lines and 2 lines. The 4 lines image was on the first master page. The 3 lines and 2 lines images were on the second master page at the same place as the image fields positioned. Thats where I was trying this scripting. I was trying to capture the current page and number of pages. Based on these, I was trying to place them.

Is there any other way to achieve this instead of using the images? I thought of sy-uline. but some in the forum told that its not going to work. Even if I use the sy-uline, I have to do some script to achieve this I believe.

Any inputs on this.. Please give the direction.

Thanks,

Srinivas.