Embedding Foxit PDF Reader into a webpage - pdf

I need to embed Foxit Reader (PDF reading software) into a web page. Does anybody know the correct classid and parameters to use in the following code:
<object id="pdfReaderObj" classid="CLSID:XXXX" width="500" height="700">
<param name="Filename" value="/1234-56789-abc-123-3.pdf">
<param name="SRC" value="/1234-56789-abc-123-3.pdf">
You must install Foxit Reader to view this document.
</object>
Additionally if anyone has experience of enterprise deployment, silent installation, registry setting etc. These would also be welcomed.
Thanks

Foxit Reader itself doesn't include any embeddable components; they have Foxit Reader ActiveX for this purpose, which is a paid component distributed separately from the Reader. For example, the Standard ActiveX version can be embedded into a web page in the following way:
<script type="text/javascript"">
function openFile() {
document.getElementById("foxitReader").OpenFile("foo.pdf", "");
}
</script>
<body onload="openFile()">
<object id="foxitReader"
classid="clsid:DB2189DF-ABF4-445A-A4E5-BF32F2CEA4D9"
width="800" height="600">
<p>You must install Foxit Reader ActiveX to view this PDF file.</p>
</object>
</body>
(I'm not a web developer, so this code may be far from perfect, but it should help you get the idea.)
If using Foxit Reader ActiveX is not an option for you, take a look at this question which discusses other possible ways of displaying PDF content.

Related

Confused with pe:documentViewer rendering pdf file in web app

I have a web app that uses primefaces extensions.
If I use
<pe:documentViewer id="verPdf"
height="500"
name="/resources/pdf/#{utentesBean.nomeFile}" />
it does not render PDF in view.
if I use
<pe:documentViewer id="verPdf"
height="500"
name="/resources/pdf/441.pdf" />
it shows the PDF .
Can anyone give an idea ?
Thank you.
I am one of the developers of the document viewer component and I just tested it and it worked fine with both of the following:
<pe:documentViewer url="/sections/documentviewer/#{controller.bookFile}"/>
<pe:documentViewer library="books" name="#{controller.hoodFile}"/>
One thing I noticed above in your example is you were not using URL you were using "name" attribute and name is meant to be used with "library" as in my example above as a relative path to a resource folder called "books".
I think you want to change your code to...
<pe:documentViewer id="verPdf"
height="500"
library="pdf"
name="#{utentesBean.nomeFile}" />

cfchart not printing in PDF

I'm trying to print PDF from HTML using cfdocument. The code works fine when I access it through localhost, but when I use static IP to test it online on the same server it timeouts.
I tried cfhtmltopdf it didn't timeouts but it doesn't generate the chart and shows "image missing icon". nor charts get generated nor images. text gets printed fine. And it takes like 20 to 30 seconds to generated the PDF when an image or chart is used.
I tried this on CF11 32bit and 6bit both having same issue.
Even the simplest codes fails:
<cfhtmltopdf>
<!DOCTYPE html>
<html>
<body>
<div class="pdf_logo" style="margin-bottom: 20px;">
<img src="images/logo.png" width="180">
</div>
</body>
</html>
</cfhtmltopdf>
Your problem is probably with resolution of the path to the image. try an absolute path (http://) Or a file path (file:\) ... try resolving the image from the desktop of the server itself.
Remember that the server internally must resolve your images/logo.png into something like . If (for example) your pdf generating cfm is in a folder that is not the root, the server may resolve it to http://blah.com/some folder/images/logo.png - which naturally won't work because there's no "images" folder in there.
Other possibilities? Your server can't resolve an "internal" natted address, or is trying to use an external non-natted address through the firewall interface.
Fortunately almost all these problems can be easily tested or resolved. You will also save yourself headaches by simply using the file method to include any resources into your PDF file.
For more on resolution issues see my post on Network address resolution and Cfdocument.
Hope this helps! good luck.
I've encountered a similar issue with cfhtmltopdf. In my case, I was using a cfimage tag, and the images were being rendered in the PDF document very sporadically.
I suspect that the rendering of the cfhtmltopdf tag happens asynchronously, in a separate thread from any rendering that may happen inside that tag (for example, cfimage or cfchart). So the cfhtmltopdf tag will finish rendering, and it won't have the results from the rendering of cfimage or cfchart, so it displays the "broken image" icon because it can't find the source.
So this solution based on ColdFusion documentation† might help you:
<!--- 1. Generate the chart as a jpeg image. --->
<cfchart name="myChart" format="jpg">
<cfchartseries type="pie">
<cfchartdata item="New Vehicle Sales" value=500000>
<cfchartdata item="Used Vehicle Sales" value=250000>
<cfchartdata item="Leasing" value=300000>
<cfchartdata item="Service" value=400000>
</cfchartseries>
</cfchart>
<!--- 2. Write the jpeg image to a temporary directory. --->
<cffile
action="write"
file="#ExpandPath('/charts/vehicle.jpg')#"
output="#myChart#" />
<!--- 3. Generate the PDF file. --->
<cfhtmltopdf>
<!DOCTYPE html>
<cfoutput>
<html>
<body>
<div class="chart">
<!--- This image tag refers to the file created by cffile --->
<img src="/charts/vehicle.jpg" />
</div>
</body>
</html>
</cfoutput>
</cfhtmltopdf>
† Based on the example here: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7934.html

Openlaszlo html tag AIR issue

I just developed a sample openlaszlo application containing HTML tag loading openlaszlo site. And i developed a sample air application having another html tag and i loaded the openlaszlo application through the air application. For some reason i am not able to see the html content of the openlaszlo application.
Has anyone come across this kind of issues?
#karthick In your comments on your question you stated that "The html is behind the SWF": The solution to this problem is to set the Window Mode attribute of the SWF (Flash) object to "transparent":
Example:
a) Direct Flash embed syntax:
<object ...>
...
<param name="wmode" value="transparent"></param>
</object>
b) OpenLaszlo JavaScript embed syntax:
lz.embed.swf({
url: 'http://www.mysite.com/myapp.lzx.swf10.swf?lzr=swf10', wmode: 'transparent', ... });

How to refresh automatically on a PDF viewer?

I am editing LaTeX on my Windows Vista systems. Which I am using pdflatex to generate PDF file constantly.
My PDF viewer is Adobe Acrobat Professional 7, I have to close and open the same file each time to get the new look.
Is there any way to keep the PDF viewer refreshing the PDF pages once it changed?
From a question on super user
SumatraPDF is free, for Windows, and plays nicely with LaTeX. It will automatically refresh when the pdf is updated.
It's also portable, which is nice.
The viewer does not regularly check changes on disk, so short answer: no (unfortunately)
You could however, use your browser to see the pdf file, inside your own html 'webpage' that regularly refreshes the page using javascript.
this is how (including buttons for switching between manual and automatic refreshing):
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>my pdf</title>
<script type="text/javascript">
var timer = null;
function refresh(){
var d = document.getElementById("pdf"); // gets pdf-div
d.innerHTML = '<embed src="myPdfFile.pdf" width="700" height="575">';
}
function autoRefresh(){
timer = setTimeout("autoRefresh()", 2000);
refresh();
}
function manualRefresh(){
clearTimeout(timer);
refresh();
}
</script>
</head>
<body>
<button onclick="manualRefresh()">manual refresh</button>
<button onclick="autoRefresh()">auto refresh</button>
<div id="pdf"></div>
</body>
<script type="text/javascript">refresh();</script>
</html>
Just save this code as e.g. 'pdfrefresher.html' in the same folder as your pdf. As src of the embed object you use only the filename, e.g. 'myPdfFile.pdf' (not disk or directory).
In the code, you can adjust the width and height of the embedded object and the timeout (in milliseconds).
Evince pdf viewer auto-refreshes.
It is an extremely light and free (GNU) pdf viewer that is the default on most linux OS. There is a Windows version also. Although, I have used evince only in linux, I am sure it has the same features in Windows.
Adobe Reader and/or Adobe Acrobat are notorious for not supporting auto-refreshing the view of a PDF which changed on disk.
If you need that, you should switch your viewer.
SumatraPDF is available for Windows and does auto-refresh the view. Should it not work at times, you can simply type 'r' to force a refresh...
For Linux desktop systems, xreader does an excellent job in the "auto-refresh capable" category. Small number of dependencies; not heavily dependent on any particular desktop (ex: GNOME, KDE) either.
For user who are on MacOS you have LivePDFViewer that allows you live update of the view and other additional adds like highlighting changes or images zoom.

Open a PDF in a new browser window with ColdFusion cfpdfform

I'm using ColdFusion 8 to and the object to create an xml document and then write the data to fields in an existing PDF file on our intranet. The problem is that I need the PDF to open in a new browser window, not the same browser window, which is what is happening now.
Is there any additional info I can pass along with the 'destination=' tag to force the PDF form to open in a new browser window?
Thanks in advance for all replies
Providing code examples in the future would be greatly appreciated and should expedite resolution. However, if I am understanding you correctly, and depending on your preference, then one of the following solutions should suffice.
ColdFusion (Server-side)
If you are NOT writing the newly populated PDF to disk:
<cfpdf name="variableName" />
<cfheader name="Content-Disposition" value="attachment; filename=filename.pdf" />
<cfcontent type="application/pdf" variable="#toBinary(variableName)#" />
OR
If you ARE writing the newly populated PDF to disk:
<cfpdf action="write" destination="c:\full\path\to\filename.pdf" />
<cfheader name="Content-Disposition" value="attachment; filename=filename.pdf" />
<cfcontent type="application/pdf" file="c:\full\path\to\filename.pdf" />
OR
HTML (Client-side)
Anchor Text
OR
JavaScript (Client-side)
window.open("/relative/url/to/pdf/populate/template.cfm", "windowName");
I was looking for the answer and coworker steered me towards this easy solution. This will open a pdf in a new web browser window.
test.pdf
index.cfm (calling page)
<cfheader name="Content-disposition" value="inline;filename=test.pdf">
<CFCONTENT TYPE="application/pdf" FILE="#url.filePath#" DELETEFILE="No">
showPdf.cfm