i have this code for convert website to exe file using electon js but i have problem
inside the website there are .swf files and i search alot about how i can run .swf files but it's not work
i was traing by plugin it's name "Pepper Flash Plugin"
this is the url for this plugin
https://electron.atom.io/docs/tutorial/using-pepper-flash-plugin/
and i was searsh about "pepflashplayer.dll"
and put it on the root on prject directory and also not work
any help please
file:main.js
'use strict';
const electron = require('electron');
const path = require('path');
const app = electron.app; // Module to control application life.
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.
// Specify flash path, supposing it is placed in the same directory with main.js.
let pluginName
switch (process.platform) {
case 'win32':
pluginName = 'pepflashplayer.dll'
break
case 'darwin':
pluginName = 'PepperFlashPlayer.plugin'
break
case 'linux':
pluginName = 'libpepflashplayer.so'
break
}
app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname, pluginName))
var mainWindow = null;
app.on('ready', function() {
mainWindow = new BrowserWindow({width: 1100, height: 900, webPreferences: {
plugins: true
}});
// and load the index.html of the app.
mainWindow.loadURL('file://' + __dirname + '/cd/cd/START.html');
});
case 'win32':
pluginName = 'pepflashplayer.dll'
You simply need to put in the directory to where your dll file is located
Currently (June 2017) it is stored at:
C:\Users\USER\AppData\Local\Google\Chrome\User Data\PepperFlash\26.0.0.126
case 'win32':
pluginName = 'C:\Users\USER\AppData\Local\Google\Chrome\User Data\PepperFlash\26.0.0.126\pepflashplayer.dll'
OR
copy the dll to your app's directory and point it to there
case 'win32':
pluginName = './pepflashplayer.dll'
Related
I have the #pdftron node module installed in a test Node (Hapi) application on my Mac. I'm trying to generate a PDF file from a HTML string but the saved file is 0 KB. I've tried this two ways:
By implementing the example code in the GET handler for a route
configured in index.js
By running the sample scripts that are
installed at
node_modules/#pdftron/pdfnet-node/samples/HTML2PDFTest/NODEJS/HTML2PDFTest.js
In both cases, any new PDFs that are saved have a size of 0KB and any existing PDFs that are supposed to be modified by the process remain unchanged.
I've checked that the html2pdf module library path is being set correctly.
The route handler code is as follows, which is in accordance with example code provided by PDFTRon.
server.route({
method: 'GET',
path: '/pdftron/html',
handler: (request, h) => {
const { PDFNet } = require('#pdftron/pdfnet-node/lib/pdfnet.js')
const main = async () => {
await PDFNet.initialize()
await PDFNet.HTML2PDF.setModulePath('node_modules/#pdftron/pdfnet-node/lib')
const output_path = '/tmp/'
try {
const html2pdf = await PDFNet.HTML2PDF.create();
const doc = await PDFNet.PDFDoc.create();
const html = '<html><body><h1>Heading</h1><p>Paragraph.</p></body></html>'
html2pdf.insertFromHtmlString(html);
await html2pdf.convert(doc);
doc.save(output_path.concat('pdf2html.pdf'), PDFNet.SDFDoc.SaveOptions.e_linearized);
} catch (err) {
console.log(err)
}
}
PDFNet.runWithCleanup(main, 0).then(function () { PDFNet.shutdown(); })
return 'PDF2HTML Test'
}
})
Any thoughts/suggestions would be much appreciated.
Update on this - I had feedback from PDFTron to say that there is currently an issue with the current stable release of the Mac OS build and that they are addressing it.
In the meantime, they pointed me to the nightly experimental builds here. I downloaded and installed a recent experimental build and the PDF files now save OK using that.
I am using Angular-cli for this build and it compiles all folders under the src folder into the build.
I was storing images in the assets folder under src:
src
|-app
|-assets
|-img_library
I access them dynamically like this:
<img src="assets/img_library/{{imgId}}"
Unfortunately this folder gets compiled into the build by angular-cli, so I would have to rebuild the app every time an image is added for the client to be able to access it.
I built the server as well so I can store the images anywhere I want but I don't know how to access folders above the src via a img tag.
Is there a way to access a public/assets folder above the src folder with an image tag in Angular?
#jonrsharpe You're right this doesn't make any sense. The assets folder is for images/media that will be used often by most users. I don't know what I was thinking, my brain was stuck in Angular mode when I needed to approach it from the backend.
I used an express api:
router.get('/some/api/:id/img.png', function( req, res, next){
var id = req.params.id,
filePath = 'img.png',
root = __dirname + '/some/location/' + id +'/';
var options = {
root: root,
dotfiles: 'deny',
headers: {
'x-timestamp': Date.now(),
'x-sent': true
}
};
res.sendFile(filePath, options, (err) => {
if (err) {
next(err);
} else {
console.log('Sent:', filePath);
}
});
})
to respond to a get request from <img src='some/api/{{imageId}}/img.png'>.
Hope this helps some other sleep deprived developer.
i am trying to post an image to a a backend server that is an Express Server.
I am using cordova file transfer(installed through cordova plugin add cordova-plugin-file-transfer )
I have imported the file transfer like this:
import {Transfer} from 'ionic-native';
here is my component that posts the file to the server
save() {
base64Image = open("/Users/user1/1.jpg");
let ft = new Transfer();
let filename = "example" + ".jpg";
let options = {
fileKey: 'file',
fileName: filename,
mimeType: 'image/jpeg',
chunkedMode: false,
headers: {
'Content-Type' : undefined
},
params: {
fileName: filename
}
};
ft.upload(base64Image, "http://localhost:3500/api/v1/file", options, false);
}
the error i get whenever i call the save function is:
FileTransfer is not defined
help will be appreciated
Install with ionic since you are using ionic-native.
ionic plugin add cordova-plugin-file-transfer --save.
The save option is to ensure there is an entry in config.xml.
Also call any plugin within
platform.ready().then(()=>{})
Plugins are loaded after the app is loaded.
UPDATE:
Cordova is not supported and most plugins will not load with ionic serve command.
You need to run it in an emulator or a device.
I'am trying to run a web server and open an HTML file via gulp-connect and gulp-open.
The server is running, the html is opened correctly but not through the server but as a file from the HDD.
On the URL address bar I can see: "file:///Users/...." instead of "http://localhost:9000/"
Does anyone know what could be the issue ?
Thanks for your help
"use strict";
var gulp = require('gulp');
var gulpConnect = require('gulp-connect'); // run a local dev server
var gulpOpen = require('gulp-open'); // open a URL in the browser
var config ={
port:'9000',
baseDevUrl:'http://localhost',
paths: {
html: './src/*.html',
dist:'./dist'
}
};
// start a local development server
gulp.task('connect',function(){
gulpConnect.server({
root:['dist'],
port: config.port,
base: config.baseDevUrl,
livereload:true
});
});
gulp.task('open',['connect'],function(){
gulp.src('dist/index.html')
.pipe(gulpOpen('',{ url: config.baseDevUrl +':'+ config.port +'/', app:'google chrome'}));
});
gulp.task('html',function(){
gulp.src(config.paths.html)
.pipe(gulp.dest(config.paths.dist))
.pipe(gulpConnect.reload());
});
gulp.task('watch',function(){
gulp.watch(config.paths.html,['html']);
});
gulp.task('default',['html','open','watch']);
OK here is how you open things:
gulp.src('./index.html').pipe(gulpOpen({uri: 'http://localhost:8888', app: 'Google Chrome'}));
You've got an extra first parameter in gulpOpen and url should be uri
Good luck!
I'm working on a project where the back end is composed of a AspNet Web Api application. I have a link to download the video archive, but I don't know how to integrate this with the setup of jwplayer. It doesn't work if I just write this link to the File parameter like:
jwplayer("myElement").setup({
//file: "big_buck_bunny.mp4",
file: "http://localhost:52272/api/donwloadfile/1",
primary: 'flash',
});
If I have a local file like in the commented line, it works fine, but not with the link.
This is my back end code:
result = Request.CreateResponse(HttpStatusCode.OK);
result.Content = new StreamContent(new FileStream(localFilePath, FileMode.Open, FileAccess.Read));
result.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
result.Content.Headers.ContentDisposition.FileName = midia.Titulo;
Use this, and it will work:
jwplayer("myElement").setup({
//file: "big_buck_bunny.mp4",
file: "http://localhost:52272/api/donwloadfile/1",
primary: 'flash',
type: 'mp4'
});