473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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("moveinready.' . $counter . '").display =
display.visible;' . "\r";
$js .= 'this.getField("moveinready.' . $counter . '").display =
display.visible;' . "\r";
fdf_set_on_import_javascript($fdf,$js,true)

and

$js = "function run_onload_()\r{\r"; $js .=
'this.getField("moveinready.' . $counter . '").display =
display.visible;' . "\r";
$js .= 'this.getField("moveinready.' . $counter . '").display =
display.visible;' . "\r";
$js .= "\r}\r"; fdf_add_doc_javascript($fdf,"run_onload_", $js);
fdf_set_on_import_javascript($fdf,"run_onload_();" ,true)
both methods die if I use a string like this for $js:

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

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

fdf_set_on_import_javascript($fdf , 'this.getField("move.1").display =
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$`(5a&.NL Uap.P5sQJ
ȵw5G&oxzdV[4G6G&oxzdvG&oxzdzecb<1&B+ S

endstream
endobj

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

Jun 13 '07 #1
3 2631
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").display =
display.hidden;\r this.getField("bullet.1").display = display.visible;
\r this.getField("move.2").display = display.hidden;\r
this.getField("bullet.2").display = 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...@gmail.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
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...
14
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 =...
28
by: wwj | last post by:
void main() { char* p="Hello"; printf("%s",p); *p='w'; printf("%s",p); }
35
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...
2
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...
3
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...
4
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...
1
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...
34
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...

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.