on 03-20-2007 5:38 PM
Hello, all,
I used FM CONVERT_OTF_2_PDF, and I can create a pdf file on my PC by using content in table lines of FM. Now I don't want to create a pdf file on my desktop. I want to pass the value of the table lines to remote java program to show this PDF file on the web. Does anyone knows how do I code it in Java program to be able to show the contents in table lines as PDF? Would you please give an example code? Thank you!
Meiying
Hi Meiying,
If your client side program is a web application (jsp,etc), you can pass the generated pdf file to the client side and display it with Acrobat reader (preinstalled) automatically.
wish it helps.
Dennis
Message was edited by:
Dennis Xi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Dennis,
Thank you for the reply. But I don't want to generate pdf file and then pass it to client side, beacuse there maybe serveral people runing the program at the same time. I want to pass the table which contains the content of PDF file (the data start with %PDF-) to java program as parameter. But I don't know how to write java code to show it ( I mean pdf content not pdf file) on the web.
Meiying
If you want to display the content of PDF in BINARY, ignore my comments. For instance, the following stuffs.
%PDF-1.4
%âãÏÓ
5344 0 obj
<<
/Linearized 1
/O 5347
/H [ 11184 12830 ]
/L 4687557
/E 113355
/N 677
/T 4580557
>>
endobj
xref
5344 526
0000000016 00000 n
0000010876 00000 n
0000011141 00000 n
0000024014 00000 n
0000024194 00000 n
0000024264 00000 n
Otherwise,
Since all the contents of the pdf file are already in table, you can get or convert them into a array of bytes (Binary). Open a stream to the client side and pass the bytes to the client side then resemble them into a pdf file (maybe just in memory or put it in a temporary location), the ways I talked about in my above posts are the solutions you can use to display the pdf file.
Dennis
Hi, Dennis,
The contents in the table look like following. (code)
TD TDLINE
%P DF-1.3##%âãÏÓ##2 0 obj##<<##/Type /XObject##/Subtype /Image##/Filter 3 0 R##/Length 4 0 R##/Name /00002##/Width 604##/Height 263##/B
it sPerComponent 1##/ImageMask true##>>##stream##x#íÜ¿o#É##ðÙìA#C#Í#>#£q#>#®Ñ!#÷#+óG#H#4#b#A ##î##Àîte##ç2mÊt###S###)¼##W## âFðx&ß7³Ë#2
Í£ w7@ÎÑÂ#(jøáîì#Ù7³C{#·Ým[·#å]Q#±´+#eô¯#Í#ï-ïÆRËoí7î#ËuÖ#ee#ºw¢#Kç#[>îÂ#[²Ä¼#k###¼#K#d1#µ§l?P,ë ò####µ·®t´ÒE{k¡¢#\u00B5·f±ê#3íó#b'yk«_[G
Y[ Ê#Õ#xÚÖ²§µÅÏÛZF×VÚ:À®ÊÚJZ#X#ØZ#Ø#bi}ÞÖºXRì¤õÅ##·´zá####ëIPÂwÑÒrǤ<y##U¶´#Ó!ÜÐAò§í,Ka##ùã@¶´Ê#X##Xtpɬúù¢¥¥ªówÜÞº#õ#=¸ÄA^·´##\u00D2##ª
µ# ¦Í3zàÐ'>ii-#ôW;##cßÆG¨¹OÚY##?###fÇí¬¯YïAìq##Úv`_¯%ãE¯#õÕ#ÅZZ#Yu«?`GyW#kkõØrÀaØa;ëø¿feÝY-/#ÝZk#oe¹.ÇLj?²Rç#Û¡å:°J#####;Ø/^ô#áê##Î,Ù
0.1. ÀÊÞeKti©h%]YâÎúþ[#;ë#³#ÞYï##ýOYù#õnYUNn###±¿niÙlÇ#·XªC#µµð#§#ÝXa®Oe-#Kµ±N0VÈS#ðµõ#0î°#±_½ ê#L·°ªÙ¸#X~æ#Ütd]ÀºQy3ëk&©##÷?´ìÄ?#õª#õ
¹ _47Ärp#X4gÅ ck¶>Fþ¼²#Qþźõ¤¥U¬Y×í¬ë-Ö°#+ÌÕ¶°®ÔëVÒÐ##íÕFsÛ.in#-Vê#Ý#¶zeQÊ#-#âÿm7º¯p#}#²#Ç{#Á²Ì####hrè^#ëWqî##K5óeùö#Ý#y/ù##uT[#æ'M.#=
XL '#f/Gý¥ÞñYáÓ&Ö#dýí}ö#8a#,9##½½uAÇø#(>cì4Zö K#ob¡qÃJÙgñ#!Y#×#^æoo-#;LtÊ#ã½Ì`ùÄ#&Öê¾h¸ÇJVâqÁl²fdu¿#Ó#ɤĥF6é,V÷##ÝG6##¢U6Y#ãNjKÊÊâ°z#V
@# ÕV?[Z¼l¶(i¹#à4¯,#«Ù#¤YÕ³Æ5##{-#]²#µ¨#"®Å KZÞ0=Ñ#kD´hc#j¡##µ#Q#ØÈrY´#Ye#Í-/Bå'qOÙÎ##VÄ㵧²#¦:¥#+#Õ#Ê#[&ÃA&Õ#`éÃ"kf9aq#M µ#Ö½"û¶#6ôF
Ök Ü##G:Q²áâ#êÚ]l##¥H¿tª##¯Ð#Öã<´#²#&y3ËSÝW#K#c4²l#ëàÈnï#íd%ÞÿíÖÙÒp#îl3#ZW£½#QJ_~Wn:]x¤###Å®bÙÇ"%÷¾#ß´iXvk㳫##j#Tf÷%ؼÑ*W#ym©###õ#.ì
¹Û (§óUÒ#þ#ê¡#óm_n·6W##Ùª§°k##ñ¹ê`#×+ê#Ö¬#ºP[-&tì@Üm#9M##×÷kÃ##å#¬¬ú##׫ÚrÛ¬ µ#´ÚQ§mw[femt#ʽÁ#«Ãްĺµ¹Fw¾Í2°b©z#ôr#oäºukÛféÕÕéiü±±j#
#s #ËÒ#Où©ÜRrÃÚÚ=#îÊÚ=ù#Eõ#¬ÉîtQïi##`#ö´Î#dÈ,p²ù+ü:±ÜIO#J##ë!#ò"ÓÔJ¬Àß#Ì0#âìK#Ûp~)ölê#î##ÖÇ8;5 #G}#8#N`I±sÌ##E#$#å(#d##v#Á#æeV#µ´#=Óc
gH &##O4ë'#=##>##ä"X²ÈX>Q9##Ç089M#TØÛB##e04P\u00DDg#æDRðd¢##Í###Ù#kA#²Ð§#ÀÉbÀò±qbª¤ÍøÔ<J#,8ËØ#5×°ÿ\u00D13#iÏÎäðï#éÈ>LJö(X###!ú,E##Øsn¼.¤ÎÇcûÏ´
ì# ÀÕÉÃ#bi1y#?#Ú#§ÙÐ#pî##æØe#1##EKçE#=§Z/eé/#ÎTyrÊËcìM^[##ð##ûâ1¬÷#¨##l#YNT#:ºÒ³¼À#Ñ9,Em#ÖOMøZYºG¯#ÀÊS#Ávm¡#h Eûï6LQÇ#W¥ñ+X2X##5õêÑ#å6
# ¬#ïP#UT##_ax#êUh#ÝF#¯##¸Á»#%#ed´æ#Ñ##3Á#ñ;Ya¨YR####W##àoè#¢#FP[#X<X)嶰r<«$#gÄ##9om!#W #Ïh#:Z:#Ó#8>Ô5Y,ÇU²Ì##bÁÂ+7,A3øÜ##Îñ#eÁ#kÖÔ³
#b ݧ&´#Xt###ºW¢ÅpÓB(##Ä#%¢EõY##ãh¥%#hGì#¡5ÆA##µU#za°X#Ö²Ôr#HkK##qì#K-C##d#°DKUYImáê#gÏÈÊ`9#DKËuëaî##"#×#+###ðH##AO´(v°§Ñ#±Ðó##±##Î7êò
!. #è!#Z £#hÉ5+£.#Ú¤ª,áG##!z#¥#C#ÊkK¡#$«dèn#ºVVfÑ#V#-ÄñA´##'#O##ie%°(â¨Ã,(O±d#°-ûÁ#ÁÊñ,¬C²r¼g´T°¤#½¿J£##i°_8#WYC_#j#N1tôðd¡¦]må¨Ï¥Å£#
#µ #Z##û#LMÕ#«,ÃÝQ´#ÝÁ##þ#ú##f³ÈB]ñ$X##¥Ðc[YviÙ#?Ä##GKF#&#Ç#Þ#Í^Ð0Ø#$#`##ö#½Ü0X#/d#¡#Ñ##ÁzJsi@##ÅLÈ6É#Áº##ZòÊë#àz#¿#a#BÞ#±:5#¯#úÒè
¤# #°x°î#«¤4#zÀ¬²8NGrãËßú´Èá#çµ5Ä#ë##_¤è¤#j@ RßW#k6¡ý##eBo#ëàÂ#æº#üÙ«#ÇqÍB´¤èÈ)M-Q##Y#õ#)#p#¸H#Þ¹NÃÙ##ESFø#Nwj#²rÀ#óá#×8Aó###Ñb¸Â¡#+#
¶# Î#õ#>ùÆ#tj@JÎ}øAV##P±¾#:ö¸Ç#Îpí5#KL#F_##þè}#d#®#K#D< SJ齤#ãt'þ##ÅN¹B¹Ô%tÂðÊ#^###é#ZDê###Ê#4´@#¤töuF##Çq#ÅgHÛ#;Æ##Þ3¥î5¥#;#s#Vú#;ªl#
ëÕ ##eóc,<¦N·ç#¦1ŤY#z¹Ûg^¤NpwÌ/P&궥o#,#«½>:#*##lo]V#Ûe#ýæXfÕ#Ø®#ú#cö°ÆÕ'#wYf_KWVÞÞâÕ(Ùî(#,¹#UÝ¡Ûu·##}î$¥Óøs²£#ÞÏrI5ý¸kÒdOk¹¼cקwÂpc#+
ÿî 2#¾ö(w·mÙÖno·Û:¶î¶»íûµÅîní##Ûîùß_nþ##?#µ<f#åz#UÏ1×I#¯[Ìf÷#Ö\u00B8×,½^¦¸m¹ºËÝ´4e#6þi¼#7>cþtù¹¢Ê²#ð##m~#yNÇW]ìgûZ&Zö5##§õ<»e¹Ö##le#×
,Ê L####ߪò[¬ùµÁ#Ò#Ó##M¾áL##A#_ø?Ê#1##~~5B¶N#p#BÒÄÉÕ#,î¹¾/K*#,µÐb"JQòp#9#0:¿ïî#0###½'0#e^êq°¸ÿ###iöŦ¦##T0XúBç³±#³q#9ä7#û;síNÜI6ª,#(ËO
ݱ #ó)Y#ùs1##1#Ù#íç=*#,#L>#ëËñ,Z/§æÚ¼p?·'Ùø¼²#¼Òö4####CÛ#ù#Ç8}5w'þ##FKÂ#i#>#Çè#æ¥9wb#5##T·ÈÄy°#îzîHÖ#ÍL^YT÷>Õ´V!±}²(Ö+#####YYC÷###j#
£¬ `Ñ##sª{²0Ì#V##XÆf#,##»´lâ?##¬#ö«:Æê? àz#käÕY?VÃr¿òhy#ã##yâßG3##Ñ#BÝÃ#Wíñ#¬#3·¬«°_#ÛÖ##ÕVéäM<#~T[S##KgbÝGë°²#Ñ#Ç8###{«cÔgÙ5#ù鹦[Ûñ#S
ó# Ñ#S×Ë«]#t#fáî#ø¢##7#eb9¬##0ÍBA##Ù´#%Æê*öFB'6-#û#s##§#uC#me#ÝÇÖÊhà##Ei#Ð:Õ,H]ßås#_>»úw´Ì7#/N2###ü¯`ýÒOÿ#¬td##{C#a##ß{ù§oì#ü%záXðµí#
£# FÿÙ#ìÎzÙ¡U#ôº±Þð 'ÿ#Mµ5]Ír·ÝmÝlÿ###í###endstream##endobj##4 0 obj##3341##endobj##3 0 obj####[/FlateDecode]##endobj##5 0 obj##/WinAns
iE ncoding##endobj##6 0 obj##<<##%Devtype SAPWIN Font COURIER bold Lang EN##/Type /Font##/Subtype /Type1##/BaseFont /Courier-Bold##/
Na me /F001##/Encoding 5 0 R##>>##endobj##7 0 obj##<<##%Devtype SAPWIN Font COURIER normal Lang EN##/Type /Font##/Subtype /Type1##/B
as eFont /Courier##/Name /F002##/Encoding 5 0 R##>>##endobj##8 0 obj##<<##/Length 9 0 R##>>##stream## q 0 0 0 rg 144.95 0 0 63.10 23 71
5 cm /00002 Do Q /F001 12.00 Tf 0 g BT 22.70 682.45 Td 0 Tw <4F6666696365206F6620427572736172>Tj ET 0 g BT 22.70 670.45 Td 0 Tw <506F7
37 4204F666669636520426F782031383438>Tj ET 0 g BT 22.70 658.45 Td 0 Tw## <556E69766572736974792C204D5320203338363737>Tj ET q 0.90 g 283
.4 5 634.95 273.55 136.90 re f Q /F001 12.00 Tf 0 g BT 286.30 759.85 Td 0 Tw <202020202020556E6976657273697479206F66204D697373697373697
07 069>Tj ET 0 g BT 286.30 747.85 Td 0 Tw## <2020202020204163636F756E742053746174656D656E742053756D6D617279>Tj ET 0 g BT 286.30 723.85
Td 0 Tw <53747564656E74204E756D626572202020202020202020202020203130303035333030>Tj ET 0 g BT 286.30 711.85 Td 0 Tw## <426567696E6E696E
67 2044617465202020202020202020202031312F30312F32303036>Tj ET 0 g BT 286.30 699.85 Td 0 Tw <456E64696E672044617465202020202020202020202
02 0202031312F33302F32303036>Tj ET 0 g BT 286.30 687.85 Td 0 Tw## <426567696E6E696E672042616C616E636520202020202020202020392C3339352E30
31 20>Tj ET 0 g BT 286.30 675.85 Td 0 Tw <416374697669747920202020202020202020202020202020202031302C3234322E35352D>Tj ET 0 g BT 286.30
66 3.85 Td 0 Tw## <456E64696E672042616C616E63652020202020202020202020202020203834372E35342D>Tj ET 0 g BT 286.30 651.85 Td 0 Tw <46696E6
16 E6369616C20486F6C6473202020202020202020202020202020204E4F4E45>Tj ET q 0 0 0 RG 0.50 w 283.45 771.85 m 283.45 634.95 l S Q q 0 0 0 RG
(/code)
There are two fields (TDFORMAT and TDLINE) in the table, I used following Java code to put them together as PDF. But When I open it as PDF file, it says "the file does not start with %PDF-' . Do you see why
(code)
byte[] pdfstream;
byte[] myout = new byte[]{};
byte[] tdformat = new byte[]{};
byte[] tdline = new byte[]{};
//String myout = "";
for (int i = 0; i < lt_pdftab.getNumRows() ; i++) {
JCO.FieldIterator e1 = lt_pdftab.fields();
while (e1.hasMoreElements()) {
JCO.Field field = e1.nextField();
lt_pdftab.setRow(i);
if (field.getName().equals("TDFORMAT")) {
tdformat = field.getString().getBytes("UTF-16LE");
}
if (field.getName().equals("TDLINE")) {
tdline = field.getString().getBytes("UTF-16LE");
}
myout = tdformat = tdline ;
}
System.out.println("myout " + myout );
pdfstream = myout;
}
(/code)
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.