How can I use pdf.js with CefSharp? - cefsharp

I am trying to integrate CefSharp and pdf.js into a C# application.
I got CefSharp working easily, but am having trouble using pdf.js to load PDFs. It works if I load pdf.js using the bundled viewer.html, but only if it is hosted in the same place as my PDF.
Is it possible to load the Chrome extension into CefSharp within my application?
I tried loading it with the command line parameters but it didn't seem to do anything:
settings.CefCommandLineArgs["--user-data-dir"] = "C:\\...\\chromium";
settings.CefCommandLineArgs["--load-extension"] = "C:\\...\\PDF-Viewer_v1.5.294";
Am I missing something or is this not possible?

I couldn't get pdf.js to load through CefSharp and in the end decided to host it on the same server that is hosting my PDFs.

Related

My node.js webapp (with bootsrap) works locally but not on my express server

I'm trying to develop a real estate web app. I downloaded html/css theme from envato and they look great locally... not so much on my express server (running on my host machine).
I get this error
As soon as I take out
"var bootstrap = require('bootstrap');"
my website loads but website layout is off. Anyone else experience this problem before?
Require is a built-in function for Node.js to load modules. See What is this Javascript "require"? for more info about require.
But in short when you remove var bootstrap = require('bootstrap'), you are not allowing your code to access the bootstrap module thus removing the bootstrap styling for the app.

Images won't display for leaflet-measure plugin in R powered custom visual for PowerBI

We are trying to create a custom visual using leaflet for PowerBI to use in our application. The visual works perfectly on the PowerBI desktop, however, when the visual is uploaded to PowerBI embedded, the images for plugins such as leaflet-measure are not loaded. The functions in the plugin such as measurements etc., however, works as intended.
Originally, the images for the leaflet-measure plugin did not show on the PowerBI desktop as well. We reached out to the custom visual team at Microsoft and they suggested to use the 'base64' encoding of the images in the file 'leaflet-measure.css'. This made the plugins to start working on PBI desktop, but, publishing online on PowerBI embedded still has the issue with the images like 'rulers.png' etc. not being able to render correctly.
Here's how the Leaflet measure looks on PBI desktop
The leaflet measure when published on PowerBI.com or embedded
Can you please help so that the images are rendered properly when the custoembedded?s uploaded to PowerBI.com or embedded ?
So, we got back to Microsoft tech support and they said that while they do support custom interactive visuals based on R, any networking on server side (from R) is blocked due to security and privacy reasons.
Hence, if it tried to load an image from R via net, it will not work.
Since the images from the plugins are plain image files rendered onto the leaflet map, it might not display when creating an leaflet based R custom visual.

Using CDN with ember-cli

In my app, developed using ember-cli, I need also some external resources like bootstrap;
now I'm importing it through the Brocfile:
app.import('bower_components/bootstrap/dist/css/bootstrap.css');
app.import('bower_components/bootstrap/dist/js/bootstrap.js');
Is it possible to use a CDN instead of local file, defining also a callback to local file in case the CDN is offline?
Ember-cli-cdn sounds like a partial solution to the problem to me. Here is a quote from the Readme:
This addon allows to work with local copies of libraries during development, and then automate switching to your CDN version when you deploy your application.
But it doesn't solve the "fallback to local file if CDN is offline" problem. The only pattern I am aware of (also used in ember) is to put the script loading at the end of the html allowing page rendering even if the CDN isn't responding.

Convert Multiple SWF files to Single EXE

Hi I have an application in flash, I build in ActionScript 3.0 Flash IDE, my application loads some external swfs which mentioned via XML file. Its working fine at the moment. But I need to compile all these external SWFs and xml file into single exe file. How can I compile like this. or how can I code like this?
EDIT: 1
from here : http://page-flip.com/products/pdf-publisher/
You can see an example, the application is build in .net and it import pdf and publish it as flash projector or web based(swf). How is it compiling all the external SWF files.
If you have Flash CS4 you can make use of the mxmlc compiler which has some additional tricks up it's sleeve.
Using the embed tag like this will allow you to embed an entire swf "inside" your swf:
[Embed(source = '../assets/items/9.swf')] public static const ITEM_9:Class;
Then, to instantiate it you simply go:
var mySprite:Sprite = new ITEM_9() as Sprite;
Using this and some clever overloading of your current classes for external loading should allow you to get a single swf (xml files can be embedded in a similar fashion).
Then it's just a matter of using the Publish settings to make Flash spit out an .exe
On an unrelated note, please go back and accept some answers to your questions. It's not very nice not to.
You can try mdm Zinc.
Zinc is really powerful. It lets you package your Flash or Flex in different ways, with lots of native platform hooks.
you can build an AIR application. if you don`t want it to be cross platform, you can build an AIR application with a windows native installer.
Flash > File > Project settings > Windows Projector.
For MAC, choose a MAC projector.
If you are burning to a disc and you need both platforms to work...a good option is to use Toast (if you are on a MAC)...it will hide the files you don't need the user to see, and also hide windows files from MACs and vice versa.
There is an application for Windows called SWFKit, which allows you to package your SWF and external files into one exe file. I had the same problem as you, and this worked a treat for me. Unfortunately you do need to pay for it :( http://www.swfkit.com
Hope this helps,
Will
I would go about it with these steps
create a flex application
embed all of the SWF's and the XML into that application
create a release of the application you just created
open the SWF application with the stand-alone flash player and not with the browser
from the file menu select the option create projector
All of this will result a single EXE file that contains all of the SWF's and the XML file.
You can use a projector or make an windows only AIR project.
Use flajector and forget about your problems

AIR - Making use of air.swf file in an internal network

Hello StackOverflow community,
The air.swf file referenced here:
http://livedocs.adobe.com/flex/3/html/help.html?content=distributing_apps_3.html
used to launch AIR applications from Flex applications requires the use of an air.swf file located here:
http://airdownload.adobe.com/air/browserapi/air.swf
We have tried to download this SWF and use it in our internal network, but it is not working, we depend on using the one located in the Adobe site.
Is there anyway to use this air.swf file without having to access the Adobe site?
Thanks!
Mauricio
No, this swf will not work if it's not loaded from adobe.com domain.
You can download the air.swf from the Adobe website (which the docs say you are free to do) and load it locally. Then the first call correctly gives the status of the AIR installation - "installed" or "available". However, if AIR is installed, the next call to getApplicationVersion always fails with "null" no matter the AIR app is installed or not. If I run the Adobe hosted version of air.swf everything works fine.
I am trying with AIR 2.0 and Actionscript 3.0.
i know this is rather a partial answer, but if I figure out more I will edit it!

Resources