Download the compiled ReadOnly FlexPaperViewer.swf
*Note: Limited Functionality – see http://www.vigrond.com/flexpaper for ‘what you get’ – See tutorial below for which parameters work
_____
Once Scribd made their switch to HTML5 for greater compatibility, it actually lost its great function to protect PDFs from being downloaded or printed.
On the search for some new technology, I found FlexPaper.
FlexPaper, in their own words, “… displays documents in your favorite browser using flash. Its way of reusing display containers makes it possible to view large documents and books.”
FlexPaper is programmed using a mix of Flash’s Flex & JavaScript, and is open-source under the GNU GPL license v3.
Natively, FlexPaper does not protect PDFs from being printed or copied. It actually lacks options for doing so on the JavaScript front-end. However in its Commercial License (to take the branding off for 1 domain) contains a ReadOnly parameter to disable printing & copying.
I am going to show you how to re-enable that ReadOnly parameter in the free GPL version using Flash Builder 4, disable the Flash container’s print option in the right-click context menu, and basically recompile the Flex build in the same original fashion as the Pre-compiled build of FlexPaper.
Note: This is not a hack. It is actually suggested by FlexPaper’s developer (Eric) as a solution, albeit undocumented.
- Download both the Flex 4.0 & Pre-compiled (Flash) versions of FlexPaper:
http://flexpaper.devaldi.com/download/ - Create a new Flex Project in Flash Builder 4 with default options (application type: Web)
- Once you get to the Library Path in the creation wizard, add the SWC file you got from FlexPaper’s Flex 4.0 build.
- Set “Framework linkage” to Merged into Code
This will compile everything into a compacted SWF file, instead of having many different library files. - Hit Finish
- Now you should be seeing your mxml file that looks something like this:
<!--?xml version="1.0" encoding="utf-8"?--> <!-- Place non-visual elements (e.g., services, value objects) here -->
- First we need to add the FlexPaperViewer component. With your mxml file open, go into “Design” mode. Then at the bottom left open up the Components tab. Under the “Custom” folder drag the FlexPaperView component into the project.
- Go back into “Source” mode. You will now see your tag.
Go ahead and set the following attributes:id:
our id variable we can reference later to set parameters
ReadOnly:
Set to “true” to disable Printing & Copying. Note: It is not recommended to set this parameter in the JavaScript as it presents a security hole on the client side. If you have PDF files you want people to be able to print as well, create two versions – one with and one without ReadOnly
width:
Set to 100% to fill our HTML Element container
height:
Set to 100% to fill our HTML Element container
x:
set x-coordinate position to zero
y:
set y-coordinate position to zero
- Next we will create an Event Handler to read in flashvars from the JavaScript
- In our Application tag, add a creationComplete event handler:
- Now add a <fx:Script> tag, import the flashvars, and create the init() function for our event handler:
<![CDATA[ //import flashvars import mx.core.FlexGlobals; //set our viewer parameters to the flashvars (not all included) private function init():void{ } ]]>
- Inside this init() function is where the magic happens. We will set all the parameters for our FlexPaperViewer depending on the flashvars. We will also disable the Print option in the Flash context menu.Set the FlashPaperViewer parameters in this style:
viewer.SwfFile = FlexGlobals.topLevelApplication.parameters.SwfFile; viewer.Scale = FlexGlobals.topLevelApplication.parameters.Scale; viewer.ZoomTransition = FlexGlobals.topLevelApplication.parameters.ZoomTransition; viewer.ZoomTime = FlexGlobals.topLevelApplication.parameters.ZoomTime; viewer.ZoomInterval = FlexGlobals.topLevelApplication.parameters.ZoomInterval; viewer.FitPageOnLoad = FlexGlobals.topLevelApplication.parameters.FitPageOnLoad; viewer.FitWidthOnLoad = FlexGlobals.topLevelApplication.parameters.FitWidthOnLoad; viewer.FullScreenAsMaxWindow = FlexGlobals.topLevelApplication.parameters.FullScreenAsMaxWindow; viewer.ProgressiveLoading = FlexGlobals.topLevelApplication.parameters.ProgressiveLoading; viewer.switchMode(FlexGlobals.topLevelApplication.parameters.InitViewMode);
This format will work for the following parameters:
- SwfFile
- Scale
- ZoomTransition
- ZoomTime
- ZoomInterval
- FitPageOnLoad
- FitWidthOnLoad
- FullScreenAsMaxWindow
- ProgressiveLoading
Non-native parameters (will have to be programmed into JavaScript flexpaper_flash.js library):
- ReadOnly *Not recommended due to security hole presented by giving the client control
- width / height *Setting to anything other than 100% will break Fullscreen mode
Note: Other parameters and Event Handler methods for the Pre-Compiled Flash Build’s javascript functions are NOT provided here. These are undocumented and will have to be additionally discovered. It should not be hard given a look at the function list for the FlexPaperViewer component. Connecting Flex applications to Javascript is also well-documented on Adobe’s site.
- To disable the Print option in the Flash container’s right-click Context menu is pretty easy:
var customContextMenu:ContextMenu = new ContextMenu(); //disable the default options customContextMenu.hideBuiltInItems(); this.contextMenu = customContextMenu;
- Go to Project->Export Release Build, and now you got your project SWF in the bin-release folder, all-inclusive. Flash Builder also includes a playerProductInstall.swf & an unneeded html container file to test with.
- Remember the Pre-Compiled Flash Build of FlexPaper we downloaded? Go ahead and extract that. Replace FlexPaperViewer.swf with the new one.
- Congratulations, now you have a read-only flash PDF viewer. Full Code:
<!--?xml version="1.0" encoding="utf-8"?--> <!--?xml version="1.0" encoding="utf-8"?--> <!-- Place non-visual elements (e.g., services, value objects) here --> <![CDATA[ //import flashvars import mx.core.FlexGlobals; //set our viewer parameters to the flashvars (not all included) private function init():void{ viewer.SwfFile = FlexGlobals.topLevelApplication.parameters.SwfFile; viewer.Scale = FlexGlobals.topLevelApplication.parameters.Scale; viewer.ZoomTransition = FlexGlobals.topLevelApplication.parameters.ZoomTransition; viewer.ZoomTime = FlexGlobals.topLevelApplication.parameters.ZoomTime; viewer.ZoomInterval = FlexGlobals.topLevelApplication.parameters.ZoomInterval; viewer.FitPageOnLoad = FlexGlobals.topLevelApplication.parameters.FitPageOnLoad; viewer.FitWidthOnLoad = FlexGlobals.topLevelApplication.parameters.FitWidthOnLoad; viewer.FullScreenAsMaxWindow = FlexGlobals.topLevelApplication.parameters.FullScreenAsMaxWindow; viewer.ProgressiveLoading = FlexGlobals.topLevelApplication.parameters.ProgressiveLoading; viewer.switchMode(FlexGlobals.topLevelApplication.parameters.InitViewMode); //disable Print option in Flash Context Menu var customContextMenu:ContextMenu = new ContextMenu(); //disable the default menu options customContextMenu.hideBuiltInItems(); this.contextMenu = customContextMenu; } ]]>
- If there’s anyone out there who would just like the readonly SWF, just comment below and I’ll update the article
If your pet is feeling bad, you should try the Best cbd oil for dogs, with this medicine your dog will feel more calm.
If you think you cannot provide your pet with good treatments for a fear of getting aggressive, then check out a range of different therapies available in the UK. Find out what other pet care products can cure any medical condition you or your pet is experiencing.
Hi,
Great post but I can get it to work. I have followed the guide step by step but when I replace FlexPaperViewer.swf and view in browser all I see is a loading bar in the center of the swf. I have imported the SWC file from http://flexpaper.googlecode.com/files/FlexPaper_1.4.5-rc1_swc.zip.
Could you please upload the edited FlexPaperViewer.swf for download?
Thanks
Hi Rob,
I haven’t tested these steps with the Flex 3 version you’re using. Are you able to try it with the Flex 4 version here: http://flexpaper.googlecode.com/files/FlexPaper_1.4.1_SDK_4.0_beta_swc.zip ?
I’ll go ahead and try it with the Flex 3 version, and I’ll also update the article with an SWF
Thanks for reading
Vigrond
I use Flash’. What does that mean? Does he use Flash pro or does he have some SWF files on his web page, or does he mean Flash related tools usage in gnaerel?As I’ve said this may seem obvious to some. It may even be considered trivial but I won’t agree with that.For effective communication, and less confusion, meaning of terms must be agreed on.I’m no Flash newbie, but until some hours ago, Flash’ by itself, first meant Flash Pro’ to me.Best,Burak
I wasn’t able to get this to work with the Flex 3 swc. I experienced the same issue you had, and even after fixing it by switching the compiler to Flex 3.5, I wasn’t able to get FlexPaper to load the Paper.swf
Anyway. I have updated the article with a ReadOnly FlexPaperViewer.swf. (See top)
This one is limited in the respect that it doesn’t support the Javascript functions and control, as I didn’t program in the event handlers.
I just came across flexpaper yesterday, found it a good idea but got a little upset that the only feature why I wanted to use it, is only supported for “commercial clients”. Thanks for sharing this, it really helped me out!
hi,
Thanks vigrond, its work perfectly in my internal website.
but can you help me how to implement it in “split_document.php”?
coz i want to load the swf file from different folder (not in flexpaper folder e.g. “C:\swf” )
thanks for your help. GBU
Hi ric, this should work regardless. Just make sure you follow the instructions on the site:
http://flexpaper.devaldi.com/docs_largedocs.jsp
Take note of the value for SwfFile (which must be accessible in your public html folder, C:\swf wouldn’t be accessible alone)
Hi Vigrond,
Thank you for the Read-Only viewer. Some questions here.
1. So if I want to have the option of enable/disable Print or Copy, I need to create different versions of the viewer? I am not familiar with software programming. It would be great if there are parameters available for enabling/disabling them.
2. I wonder what other ways a user can ‘steal’ the swf document.
a. In Firefox, I have tried using Tools > Page Info > Media, but the swf document is not shown there, which is good.
b. User can press PrtSc button to capture the page one by one and OCR them later. Tedious but it works.
Hi Afatac,
To have the option of enabling/disabling is a security issue, as this is being set in Javascript. Javascript runs client-side, so, anyone with a little bit of programming knowledge could ‘copy’ the page, and alter the javascript to ‘enable’ print & copy, hit your server with their false page and download / print the document.
So I recommend just having two versions of the SWF for that purpose.
Also a security issue is having the actual SWF available to the public. In the above demo, by viewing the flashvars in the flash object html, you can see that the file is located here http://vigrond.com/flexpaper/Paper.swf
As you can see, you can view it there and print each page as it slides by. In order to fix this, you would need to have a PHP script to serve the file. For example, in your javascript instead of pointing to /flexpaper/Paper.swf, you would point to /flexpaper/getFile.php. This script would have access to private directories given the proper credentials, while the public would not. Credentials would need to be obscured, random and generated under certain circumstances in order to prevent the public from mimicking them.
But yes, all this is defeated by the print screen button. For that, unfortunately, we cannot control the user’s environment.
Vigrond
Hi Vigrond,
Thanks for the reply. I have a better understanding of securing the swf file now.
But how about the browser cache? Is the swf file cached in the browser and can be located by user easily?
Or is there a SWF capture software that can capture the swf file?
Any other way that will be used by an expert to ‘steal’ the swf file?
Pardon me if my questions are too dump…. trying to have an idea of how safe is this method of protecting the document.
Hi Afatac,
In server side languages such as PHP, you may send headers that tell the browser not to cache the SWF file the script returns.
As for protecting a document against experts, it’s nill impossible. The best way to protect a document is to not show it in the first place. Any data transferred to a user’s computer is available in one way or another.
Adobe offers Encrypted PDFs, which may be a helpful solution worth looking into, but even then there are hackers working day and night to break them.
These methods are to deter casual users.
Great article! Thanks a lot!
Will you keep it up to date with newer versions of FlexPaper?
Noticed your file doesn’t work with the “Conversion on the fly” demo pages. Any idea why?
Vigrond,
Excellent of you to post this, many thanks. I’ve got an issue though, I’ve followed your tutorial using the Builder 4.5 from adobe, and on compilation I get a much smaller (100kb) file that just seems to get stuck on loading the doc, giving up on that I just tried your own read only version as it was going to suit, but no luck either (just loads the doc still). Does this method support split page docs:
e.g: SwfFile :”{thesis/thesis[*,0].swf,200}”
I can even add to the above, it complains with the following:
Error #2044: Unhandled onDocumentLoadedError:. text=Error #2032: Stream Error. URL: http://www.zerocarbonbritain.co.uk/flex/%7Bthesis/thesis%5B*,0%5D.swf,200%7D
Hi, vigrond!
It’s so nice of you to explain how read only version is done. I really need your help, so please if you have a couple of minutes…
I used your instructions to build print free version of flexpaperviewer.swf. But unfortuntely it won’t load any document.
http://fsf.tsu.ru/docs/delete/index_fsf.html
Could you please, provide a correct swf or any guidelines on how to compile it correctly?
Hi meister. You can find a complied SWF at the top of the article. Thanks!
Hi!
I used the precompiled version but it still did not load properly like the guy above!
Hi, vigrond!
Nice blog, I’ve tried the compiled SWF at the top of the article, it works fine with simple documents; but when triying with split documents, it does not load the document. I’ve also tried compiling following your instructions and the same happens.
any help would be much appreciated, thanks in advance.
… I forgot to say than when testing with the FlexPaperVewer.swf file downloaded from http://flexpaper.devaldi.com/… insted of read only version, split documents loads perfectly, so it’s sure the params are right.
thanks for your help again!
Hi Elmer. You are correct, your params are right. The SWF I compiled doesn’t contain the code necessary for split documents.
Unfortunately FlexPaper is not completely open-source, so I cannot see the code necessary to support split documents when I am recompiling the SWF.
To add this support I would have to dig into the code deeper and figure it out myself. While I would love to do this to support those like you, I do not have time at the moment!
However this guide is kind of psuedo-meant to provide a starting hold of FlexPaper so that people with programming skills might be able to compile it themselves with the features that they need.
Thanks for stopping by and I hope this answers your question.
Thanks vigrond.
Hello Vigrond,
This is just what I was looking for. But I installed your swf, and copied the source from your html page (with no print button) of your sample page.
I still have a print button though 🙁
http://benstrawbridge.com/FlexPaper_1.4.7_flash/
Any help is appreciated, thanks.
Hi Ben. I went to your link and I cannot see a print button. Perhaps try clearing your cache! Thanks for visiting my blog.
hey look at that, it was the cache.
silly me.
thanks for providing this!
wow! i could download your FlexPaperViewer.swf.Thanks..
Hello Vigrond,
Firstly, thanks for your artical!
If I want to allow user to copy the content and disable the print function at the same time, how to do?
And how about just print, no copy.
Hi!
This post is looking nice!.But i have a problem with downloading the file you provided on the top.please
can you give a link which downloads the FlexPaperViewer.swf file.
thanks!
wow! i could download it.Thanks for your great work!!
No problem! Thanks to you!
This is great. Solves a problem I’ve been trying to figure out for a while. Thanks. 🙂 The only question I have about this is that it seems to ignore all the JS params I send now. Specifically I can’t get the viewing modes and the search box to go away as I had them before. Any idea why it won’t accept these anymore? Thanks again.
hi,
I am using FlexPaper to view docs online. I am facing issues when trying the same for accessing .swf files from shared folder on the network. On this scenario, the swf does not get loaded. Can some help me with a solution for shared file access in FlexPaper…. thank you in advance….
hi vigrod can u give me alink on your FlexPaperViewer version with readonly, because i can’t download it 🙁
😀
Pingback: Course project for Telerik academy
Τhis esѕentіal deep-cleaning stеp of your natuгal acne treatment will ensure the remoνаl of аnу reѕіdual impuritieѕ
the Cleanseг mіght hаve misseԁ.
Thе preventative measurеs of thе Ѕkin – B5 acnе tгeatmеnt аre ρrovideԁ by the hоlistic formulаtions of theiг Aсnе
Cοntrοl Timе Releаse Tаblets anԁ Acne Contrоl Ϲаρѕules – those highly acclаimed Skіn – B5
acne trеаtment ρгoduсts.
The ԁеrmаtologist can preѕсrіbe аntibiotics like erythromуcin,clinԁamycin οr minocylіnе
for supeгfiсial aсne anԁ ѕtrongеr mеԁicines foг deеp аcne.
If you try to find goοd acnе treatment on your oωn this may be veгy hard.
So that you cаn gіѵe the appropriate treatment and finԁ the ideal гemеԁy, it
ωill likelу bе imperatiνe that
уoulеarn about the nature of thіs іllnеѕѕ
аnd what сauses суѕtіc acne too.
Hi,
I’m trying to follow the tutorial with no success! 😥
I’m using an old read-only version but I need the version with rotation function that is present already in the free version.
can someone share the FlexPaperViewer.swf? thanks a lot.
zk
I like this post, enjoyed this one regards for putting up.
Thanks for the auspicious writeup. It actually was
once a enjoyment account it. Glance advanced
to far brought agreeable from you! However, how could we
keep in touch?
Pingback: 仿百度文库、遇到的一些问题? - 开发者问答
thanks, you save my time. thanks.
😛 😛 Funciona Excelentemente 😛 😛
Mil Gracias Amigo.
Hey, might seem like a stupid comment, but in case someone’s looking for some codeless solution…
FlexPaper will:
1. Feed PDF to FlexPaper (standalone app or web server)
2. FlexPaper gives you SWF
3. You use the above to display the SWF (your “PDF”)
A little misleading as it is NOT the same as
1. Use some addins with SWF front end to load PDF docs.
I’d like to thank you for the efforts you’ve put in writing this site.
I am hoping to check out the same high-grade content by
you in the future as well. In truth, your creative
writing abilities has inspired me to get my very own site now 😉
I will right away take hold of your rss feed as I can not to find your email subscription link or newsletter service.
Do you have any? Please allow me understand so that I may just
subscribe. Thanks.
Hi there to all, how is all, I think every one is getting more from this web site,
and your views are good in favor of new viewers.
Please let me know if you’re looking for a article author for your site. You have some really good articles and I believe I would be a good asset. If you ever want to take some of the load off, I’d love to write some articles for your blog in exchange for a link back to mine.
Please blast me an e-mail if interested. Kudos!
Hi i Want to disable print button i am downloading web server package i could not understand how to install that one please anybody helps me
Thank you all
My coder is trying to convince me to move to .
net from PHP. I have always disliked the idea because of the expenses.
But he’s tryiong none the less. I’ve been using WordPress on various websites for about a year and am worried about switching to another platform.
I have heard great things about blogengine.
net. Is there a way I can transfer all my wordpress posts into it?
Any kind of help would be really appreciated!
in the 2 page mode when we zoom the page after that we cannot drag the page . what can be done for it?
This is particularly true if your breasts are heavy if though
you are over weight. It is a communion of two bodies in one physical act.
I did feel a slight momentary boost in overall sex drive, but not enough to match the advertised results or the cost
in comparison to some other supplements I tried.
There’s certainly a lot to learn about this issue.
I really like all the points you’ve made.
Hi everybody. I have problem in flexpaper viewer: I want to create break page line in “ReadOnly FlexPaperViewer.swf” the same to FlexPaperViewer. who can help me? Thanks a lot!
Hello, is there any way that someone could compile the updated FlexPaperViewer.swf with the latest version of Flex Paper? I would greatly appreciate this.
Biologia dla gimnazjum sprawdziany do pobrania gimnazjum
Hi,
Im a bit week in programming, can u please help me in implementing this.
My requirement is…
I have pdfs in my website which im displaying dynamically n i dont want users to download or copy those pdfs..
i tried by downloading flexreader for php but i could not implement..so please could u send me an example of pages with opening pdfs dyanamically with flex reader
I see a lot of interesting articles on your blog. You have to spend a lot of time writing, i know how to save
you a lot of time, there is a tool that creates unique,
SEO friendly posts in couple of minutes, just type in google – laranita’s free content source
We are a group of volunteers and starting a new scheme in our community.
Your site provided us with valuable info to work
on. You’ve done an impressive job and our entire community will be grateful to
you.
It’s appropriate time to make some plans for the future and it’s time to be happy.
I have read this post and if I could I desire to suggest you few interesting things or advice.
Maybe you could write next articles referring to this article.
I want to read even more things about it!
Hello, after reading this awesome paragraph
i am too happy to share my experience here with friends.
Hai Vigrod i tried a lot to remove the print option and make swf as readonly, but failed. Can u give me alink on your FlexPaperViewer version with readonly, to download it.
With regards,
K Vijay
Do you mind if I quote a couple of your posts as long as
I provide credit and sources back to your blog?
My blog site is in the very same niche as yours and my users would really benefit from a lot of the information you provide here.
Please let me know if this alright with you. Thank you!
I’m now not sure where you’re getting your info,
however good topic. I needs to spend a while finding out much more or working out more.
Thank you for great information I used to be searching for this info for my mission.
I love your blog.. very nice colors & theme.
Did you design this website yourself or did you hire someone
to do it for you? Plz reply as I’m looking to construct my
own blog and would like to know where u got this from.
kudos
Aw, this was a really nice post. Finding the time and actual effort
to produce a top notch article… but what can I say… I put
things off a lot and never manage to get nearly anything done.
They can be happening for a number of reasons, but the
most common ones are software bugs. Hoje em dia, podemos optar entre
muitos tipos de suporte. First of all, you need to understand that if your computer
is really low on RAM to run certain programs, then you will constantly be having issues and freeze-ups.
Attractive part of content. I just stumbled upon your
site and in accession capital to assert that I
acquire in fact enjoyed account your weblog posts. Any way I’ll be subscribing to your
augment or even I achievement you get right of entry to constantly quickly.
Lots of consider that pajamas are just for young children and
not for grown ups. Your child’s changeover from a crib to a toddler bed lets you make a
choice not only regarding cost but also regarding a layout
or favourite character from your child’s selection of toys.
It is one of the most sought after cots in Australia.
Everyone loves what you guys are usually up too. Such brilliant work and
coverage! Carry on with the great works guys I’ve incorporated you guys
to bookmark.
At this time I am going to do my breakfast, later than having my breakfast coming again to read other news.
Every weekend i used to pay a quick visit this website, for
the reason that i wish for enjoyment, as this this website conations in fact fastidious funny stuff too.
I like reading through a post that will make people think.
Also, thanks for allowing for me to comment!
This design is spectacular! You definitely know how to keep a reader amused.
Between your wit and your videos, I was almost moved
to start my own blog (well, almost…HaHa!) Wonderful job.
I really enjoyed what you had to say, and more than that, how you presented it.
Too cool!
Wow, that’s what I was exploring for, what a data! present here at this website, thanks
admin of this site.
Nice blog here! Also your website loads up fast! What host are you using?
Can I get your affiliate link to your host?
I wish my website loaded up as fast as yours lol
You ought to be a part of a contest for one of the highest quality blogs on the internet.
I most certainly will recommend this website!
Great goods from you, man. I have bear in mind your
stuff prior to and you are simply too excellent. I actually like
what you’ve obtained right here, really like what you are stating and the way in which in which you are saying it.
You are making it entertaining and you still care for to stay it sensible.
I can’t wait to read much more from you. That is actually a
terrific website.