473,408 Members | 1,980 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,408 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 2632
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.