Universal Data Exporter ASP Support Product Page

This topic was archived

PDF Export will not work

Reported 15 Sep 2009 22:41:27
1
has this problem
15 Sep 2009 22:41:27 Doug Coulter posted:
I am unable to get the PDF export to generate anything except a blank page.
I have been able to export to other file types but not PDF.
Do I need any server-side components?
Each time the page goes to /ScriptLibrary/udeJSON.asp
and I get a blank page with no errors and simply an empty html body.
I have created the simplest test page I can think of (below) with no luck.
What am I doing wrong?



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="ScriptLibrary/json2.js" type="text/javascript"></script>
<script src="ScriptLibrary/gridExport.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
function generateJSONASP(tableID, exportType, chs, action, styleArr) { // v1.10
	var toJSONTable = new Object();
	var table = document.getElementById(tableID);
	
	var rowNodes = table.getElementsByTagName("tr");		
	toJSONTable.page = 1;
	toJSONTable.total = rowNodes.length;
	rowsArr = new Array();
	var hiddenArr = new Array();
	toJSONTable.colCount = 0;
	for (i = 0; i < rowNodes.length; i++)
	{	
		var maxCols = 0;
		var rowObj = new Object();
		rowObj.id = (i +1);	
		var cellNodes = rowNodes.item(i).getElementsByTagName("td");
		if (cellNodes.length > 0)
		{
			cellsArr = new Array();
			for (j = 0; j < cellNodes.length; j++)
			{
				if (isGrid(tableID))
				{
					if (cellNodes.item(j).style.display != "none")
					{
						hiddenArr[j] = false;
						maxCols++;	
						cellsArr.push(cellNodes.item(j).innerHTML);
					}
					else
					{
						hiddenArr[j] = true;
					}
				}
				else 
				{
					maxCols++;	
					cellsArr.push(cellNodes.item(j).innerHTML);
				}						
			}
			if (maxCols > toJSONTable.colCount)
			{
				toJSONTable.colCount = maxCols;
			}
			rowObj.cell = cellsArr;
			rowsArr.push(rowObj);
		}
	}
	toJSONTable.rows = rowsArr;	
	if (isGrid(tableID))
	{
		//var headerNodes = table.getElementsByTagName("th");		
		var heds =  $('#' + tableID).parent().siblings(".hDiv").get(0);
		var headerNodes = heds.getElementsByTagName("th");
		var heArray = new Array();
		for (i = 0; i < headerNodes.length; i++)
		{
			if (headerNodes.item(i).style.display != "none")
			{
				heArray.push(headerNodes.item(i).innerHTML);
			}			
		}
		toJSONTable.headers = heArray;
		//toJSONTable.headers = getGridHeaders(tableID, hiddenArr);		
	}
	else 
	{
		var headerNodes =  table.getElementsByTagName("th");	
		if (headerNodes.length > 0) 
		{
			var headerArr = new Array();
			for (i = 0; i < headerNodes.length; i++)
			{
				headerArr.push(headerNodes.item(i).innerHTML);
			}
			toJSONTable.headers = headerArr;			
		}
		else 
		{
			toJSONTable.headers = new Array();
		}
	}
	
	
	var myForm = document.createElement("form"); 
	var hidden = document.createElement("input"); 
	var hidden2 = document.createElement("input"); 
	var hidden3 = document.createElement("input"); 
	var hidden4 = document.createElement("input");
	hidden.setAttribute('type', 'hidden'); 
	hidden.setAttribute('value', JSON.stringify(toJSONTable) ); 
	hidden.setAttribute('name', "JSONstring"); 
	hidden2.setAttribute('type', 'hidden'); 
	hidden2.setAttribute('value', exportType ); 
	hidden2.setAttribute('name', "exportType");
	hidden3.setAttribute('type', 'hidden'); 
	hidden3.setAttribute('value', JSON.stringify(styleArr) ); 
	hidden3.setAttribute('name', "markup"); 		
	hidden4.setAttribute('type', 'hidden'); 
	hidden4.setAttribute('value', chs ); 
	hidden4.setAttribute('name', "chs"); 		
	myForm.appendChild(hidden);
	myForm.appendChild(hidden2);
	myForm.appendChild(hidden3);
	myForm.appendChild(hidden4);
	myForm.setAttribute('name','dynaForm'); 
	myForm.setAttribute('id','dynaForm'); 
	myForm.method = "POST"; 
	myForm.action = action; 
	myForm.target = "_self"; 
	document.body.appendChild(myForm);	
	myForm.submit(); 
}
//-->
</script>
</head>

<body>
<table id="dfc3" cellpadding="2" cellspacing="2" >
	<tr>
		<td>col-1</td>
		<td>col-2</td>
		<td>col-3</td>
	</tr>
	<tr>
		<td>1111</td>
		<td>2222</td>
		<td>3333</td>
	</tr>
	<tr>
		<td>xxxxx</td>
		<td>yyyyy</td>
		<td>zzzz</td>
	</tr>
</table>
<p align="left"><a href="javascript:void();">[img]world.png" name="launch_export" width="64" height="64" align="middle" id="launch_export" onclick="generateJSONASP('dfc3','PDF','utf-8','ScriptLibrary/udeJSON.asp',{markup: ['true','helvetica','12','#FF0000','#33FF99','false','false','helvetica','12','#000000','false','false','#FFFF66','0.3','#000000','10','true','P','false','dfc3','helvetica','12','#000000','false','false','L','L','true','dfc3','true',' ""','true','true','#FFFFFF']})"   /></a></p>
</body>
</html>

Replies

Replied 17 Sep 2009 20:46:28
17 Sep 2009 20:46:28 Doug Coulter replied:
is there anyone out there?
Replied 17 Sep 2009 23:08:11
17 Sep 2009 23:08:11 Patrick Julicher replied:
Hi Doug,

Yes there is. Could you please post a link to a test-page so we can see what happens?

Kind regards, Patrick
Replied 18 Sep 2009 03:06:38
18 Sep 2009 03:06:38 Doug Coulter replied:
Yes, for example you can view it here:
67.43.167.126/testpdf3.asp

Click on the image to generate PDF
Replied 18 Sep 2009 20:24:45
18 Sep 2009 20:24:45 Patrick Julicher replied:
Hi Doug,

I just created a test page according to the manual provided (www.dmxzone.com/go?16433&LinkFile=the_basics_exporting.htm) and compared the source code with yours. Could you change the link on the image to the following:

<a href="#">


Now try what happens.

Kind regards, Patrick
Replied 24 Sep 2009 20:05:40
24 Sep 2009 20:05:40 Doug Coulter replied:
Patrick,

I tried as you suggested but I get the same result.
The new page is at the same url.

Doug
Replied 24 Sep 2009 20:19:21
24 Sep 2009 20:19:21 Doug Coulter replied:
Patrick.

Can you take a look at this page?:
67.43.167.126/testpdf4.asp

This one does generate a PDF
however when I try other export to PDFs
for real, non-trivial data I get a blank page
and it is a mystery how to get it to work reliably.

Doug
Replied 24 Sep 2009 21:58:40
24 Sep 2009 21:58:40 Patrick Julicher replied:
Hi Doug,

I had a look, but from the page itself there is not much to see. Could you use the e-mail link to send me a zip-file containing the testpdf3.asp and tespdf4.asp.
I'd like to compare them to see if I can discover any differences.

Kind regards, Patrick
Replied 25 Sep 2009 10:17:49
25 Sep 2009 10:17:49 Doug Coulter replied:
Patrick,

I sent the zip file with both examples.
I simply created a table with an id
and added the export to it with the default values.

Doug
Replied 25 Sep 2009 20:48:49
25 Sep 2009 20:48:49 Patrick Julicher replied:
Hi Doug,

The difference I see in the 2 files is the character set that is used.

In testpdf4.asp it is set to iso-8859-1, in testpdf3 the utf-8 character set is used. To be honest I don't know where that is coming from. Look at the code for testpdf4.asp:

<a href="javascript:void();"><img src="world.png" name="launch_export" width="64" height="64" align="middle" id="launch_export" onclick="generateJSONASP('uerInfo','PDF','iso-8859-1','ScriptLibrary/udeJSON.asp',{markup: ['true','helvetica','12','#FF0000','#33FF99','false','false','helvetica','12','#000000','false','false','#FFFF66','0.3','#000000','10','true','P','false','Title','helvetica','12','#000000','false','false','L','L','true','output','false',' ','true','true','#FFFFFF']})"  /></a>


and testpdf3.asp:

<a href="#"><img src="world.png" name="launch_export" width="64" height="64" align="middle" id="launch_export" onclick="generateJSONASP('dfc3','PDF','utf-8','ScriptLibrary/udeJSON.asp',{markup: ['true','helvetica','12','#FF0000','#33FF99','false','false','helvetica','12','#000000','false','false','#FFFF66','0.3','#000000','10','true','P','false','dfc3','helvetica','12','#000000','false','false','L','L','true','dfc3','true',' &quot;&quot;','true','true','#FFFFFF']})"   /></a>


Since testpdf3 is not working, could you change it's characterset to iso-8859-1 and try what happens then?

Kind regards, Patrick
Replied 25 Sep 2009 21:01:02
25 Sep 2009 21:01:02 Patrick Julicher replied:
Hi Doug,

I figured out that the UDE takes the character set from what is set on the page it is used on. Please change the character set of the page:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />


Then try adding the UDE end test it.

Kind regards, Patrick
Replied 28 Sep 2009 22:32:12
28 Sep 2009 22:32:12 Doug Coulter replied:
Patrick,

The same problems occur either way.
Regardless of the character set used, the PDf does not generate.

I tried using Dreamweaver-generated code and hand-coding, same result.
Is there a fix for this?

Doug
Replied 29 Sep 2009 08:04:23
29 Sep 2009 08:04:23 Patrick Julicher replied:
Hi Doug,

Unless we find what's causing this issue it will be hard to fix!
I see you changed the charecterset in testpdf3.asp. Can you confirm that in the code for the UDE the same (new) characterset is used?

Kind regards, Patrick
Replied 30 Sep 2009 07:19:39
30 Sep 2009 07:19:39 Doug Coulter replied:
Patrick,

For the sake of my client who has been waiting patiently for PDF files, is there some code I can use that generates PDFs?

Let's assume that I add an id to the table desired and a onclick=generateJSONASP referencing this id, can you provide the Universal Data Exporter code needed?

What do you suggest?

Doug
Replied 30 Sep 2009 20:15:23
30 Sep 2009 20:15:23 Patrick Julicher replied:
Hi Doug,

Please check your e-mail.

Kind regards, Patrick
Replied 01 Oct 2009 09:47:01
01 Oct 2009 09:47:01 Miroslav Zografski replied:
Hello Doug,

I have checked the code on your testpdf3.asp and it was working fine for me. You can check that out here :
bg.dynamiczones.com:81/ASPSites/DougPDFExport.asp

Then I traced the HTTP traffic with your test page and what is to be mentioned is that there is no qualified response from the /SriptLibrary/udeJSON.asp . It is strange to return no error.
Please, provide your IIS version.
Also provide the restrictions you have set to your site directory.

Regards,

Reply to this topic