Requesting information on silent print using Adobe 7.0 on windows 2000


we trying implement silent print pdf generated using adobe. accomplish this, using following solution. want check see if anticipate problems approach. appreciated. thanks.

issue - trying send pdf default printer on client machine without opening document in adobe 7.0.
the logic used is:

1. search /type /catalog in byte stream coming web server app server.

2. insert following acrobat java script code @ point stream trigger silent print without opening pdf.

java script being inserted -

/*check validate if script silent print inserted, script written once*/

boolean isinserted = false;

/*search string type catalog in byte stream. */

string strsearchstring = new string("/type /catalog");

byte[] bytearray = new byte[byte_size];

fileinputstream fin = new fileinputstream(new file(file));

int bytelength = fin.read(bytearray, 0, bytearray.length);

/* convert string searching */

string strpdf = new string(bytearray);

while( bytelength != -1 )

{

int searchind = strpdf.indexof(strsearchstring);

if ((searchind != -1) && !(isinserted))

{

isinserted = true;

iswritten = true;

stringbuffer strbufpdf = new stringbuffer(strpdf);

stringbuffer strbufreplace = new stringbuffer();

/*the script silent print*/

strbufreplace = strbufreplace.append("\n/openaction <<");

strbufreplace = strbufreplace.append("\n/type /action");

strbufreplace = strbufreplace.append("\n/s /javascript");

strbufreplace = strbufreplace.append("\n/js (this.print\\({bui: false, bsilent: false, bshrinktofit: true}\\);)");

strbufreplace = strbufreplace.append("\n>>\n");

strbufpdf.insert(searchind+14,strbufreplace);

byte[] byteinsertarray = new byte[strbufpdf.tostring().length()];

byteinsertarray = strbufpdf.tostring().getbytes();

res.getoutputstream().write(byteinsertarray ,0 ,byteinsertarray.length);

}

else

{

res.getoutputstream().write(bytearray ,0 ,bytelength);

}

bytelength = fin.read(bytearray, 0, bytearray.length);

strpdf = new string(bytearray);

searchind = strpdf.indexof(strsearchstring);

}

res.flushbuffer();// flush buffer content type sent right away.

fin.close();



More discussions in LiveCycle pre-ES (6.x and 7.x) discussions


adobe

Comments