473,563 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Illegal Characters in FDF File - Stream

Hi all,

I have been working on a php script lately that merges results from a db
and an xml source and then populates a PDF through FDF. I have gotten
nearly everything to work except multi line javascript. I have tried
both of the following attacks on the problem to no avail.

First I tried setting the set_on_import directly... then I tried to set
all the javascript in a function and then call the function on load...
both of them generate illegal characters in the stream.

Both of these examples are in a for each that contain a $counter:

$js = 'this.getField( "moveinread y.' . $counter . '").display =
display.visible ;' . "\r";
$js .= 'this.getField( "moveinread y.' . $counter . '").display =
display.visible ;' . "\r";
fdf_set_on_impo rt_javascript($ fdf,$js,true)

and

$js = "function run_onload_()\r {\r"; $js .=
'this.getField( "moveinread y.' . $counter . '").display =
display.visible ;' . "\r";
$js .= 'this.getField( "moveinread y.' . $counter . '").display =
display.visible ;' . "\r";
$js .= "\r}\r"; fdf_add_doc_jav ascript($fdf,"r un_onload_", $js);
fdf_set_on_impo rt_javascript($ fdf,"run_onload _();",true)
both methods die if I use a string like this for $js:

this.getField(" move.1").displa y = display.hidden; \r
this.getField(" bullet.1").disp lay = display.visible ;\r
this.getField(" move.2").displa y = display.hidden; \r
this.getField(" bullet.2").disp lay = display.hidden; \r
this.getField(" move.3").displa y = display.hidden; \r
this.getField(" bullet.3").disp lay = display.hidden; \r
this.getField(" move.4").displa y = display.hidden; \r
this.getField(" bullet.4").disp lay = display.hidden; \r

both work fine if I limit the string to 1 line like this:

fdf_set_on_impo rt_javascript($ fdf , 'this.getField( "move.1").displ ay =
display.hidden; ' , true);
The fdf contains a stream of illegal characters when using a multi line
string. However I cannot simply use a single instruction as the fdf
seems to only want 1 on_import_js to a file.

any help would be great as this toolkit lacks documentation for php.
-jh


-------------------------------------
example of fdf output stream - supposed to be readable javascript here:

<<
/FDF << /Fields 2 0 R /JavaScript << /Before 10 0 R >>
>>
10 0 obj
<< /Filter [ /FlateDecode ] /Length 176 >>
stream
H=
@xJ_ S$`(5 a& .NLUap .P5 sQJ
ȵw5G&ox zdV[4G6G&o xzdvG&oxzd zecb<1 &B+S

endstream
endobj

--
Posted via a free Usenet account from http://www.teranews.com

Jun 13 '07 #1
3 2643
jh
Unless someone has a better idea - as I think this object in the tool
kit is broken - I think I will just save the fdf out and then snip the
last few lines off and add my own stream containing the js and then
close out the fdf manually like so...

10 0 obj
<< /Filter [ /FlateDecode ] /Length 107 >>
stream

function run_onload__(){ \r this.getField(" move.1").displa y =
display.hidden; \r this.getField(" bullet.1").disp lay = display.visible ;
\r this.getField(" move.2").displa y = display.hidden; \r
this.getField(" bullet.2").disp lay = display.hidden; \r }\r
endstream
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF

Jun 14 '07 #2
jh
Anyone out there actually use the FDF tool kit?

Jun 15 '07 #3
jh
On Jun 15, 10:43 am, jh <jon.harr...@gm ail.comwrote:
Anyone out there actually use theFDFtool kit?
Guess not.

I reworked the code and it seems to work now.

Jun 18 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5792
by: MB | last post by:
Hi, I am using a web service to call an asp page on a remote server via System.Net.WebClient . The asp page returns a xml stream persisted from a recordset. I am having problems converting the stream into a valid xmltextreader document. I have also converted the document to the simple format without the DTD ( just plain xml file ) and I...
14
42372
by: deko | last post by:
Is there a way to check user input for illegal characters? For example, a user enters something into a text box and clicks OK. At that point I'd like to run code such as this: illegal = Array(\, /, :, *, ?, ", <, >, |) If Me.TextBox Contains illegal Then MsgBox "You entered illegal characters. Please try again." Me.TextBox = Null
28
2753
by: wwj | last post by:
void main() { char* p="Hello"; printf("%s",p); *p='w'; printf("%s",p); }
35
9913
by: David Mathog | last post by:
Every so often one of my fgets() based programs encounters an input file containing embedded nulls. fgets is happy to read these but the embedded nulls subsequently cause problems elsewhere in the program. Since fgets() doesn't return the number of characters read it is pretty tough to handle the embedded nulls once they are in the buffer....
2
7580
by: Duncan Welch | last post by:
Hi, I'm using the XmlTextReader to read a badly formatted XML document from a URL (it has no <?xml tag) on a remote website (not mine). About halfway through, I get an Illegal Character exception, which I'm assuming means that the default encoding type is wrong. Does anyone know a way to override the encoding type on the XmlTextReader? ...
3
3026
by: =?Utf-8?B?SG9seXNtb2tl?= | last post by:
Hi there, I am having a problem im my webservices method when trying to save a file with latin characters to disk passed through WSE. I have noticed that when trying to read the file name from all the latin characters are converted ? character which is a illegal character for file name. If my file name is N° documento per Romà
4
6887
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the function creates the file as expected. When I loop through my array I get the error - "ArgumentException was unhandled - Illegal characters in...
1
2273
by: crusson | last post by:
(edited to add): this is in Visual Basic .net I am at a complete loss... I've been building a program on my machine, running it out of the developer with the f5 key and builidng it and running it off of my machine every once in a while. It works perfectly. I built it and sent it to my co worker's machine to test it out and it returns an...
34
1747
by: raphfrk | last post by:
This program should copy one file onto the other. It works if I compile it with gcc to a cygwin program. However, if I compile it with the -mno-cygwin option, it doesn't work (this targets native windows). Anyway, I just want to check that the program is valid before I see if I can find a way around a compiler bug. It might be...
0
7658
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
7579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7877
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7943
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6238
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5204
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3615
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
912
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.