winnovative html to pdf converter not finding CSS when base url is a network share - winnovative

I am having an issue using Winnovatives HTML to pdf converter.
When the base url is a local path e.g C:\path\to\base, the converter resolves the files just fine.
however, in scenarios where the base url points to a server e.g
\\server\share\path\to\base, winnovative fails to find the css and generates a non formatted file.

Looks like it always needs a Drive:\ format path, and not a \server\share UNC path.
for remote files, you have to use File://server/share/path/to/file

Related

How to access html file inside iframe in production

I am creating a web app where, this app will generate a .html file in public/ directory. And after that i want to show that generated html file on a page using iframe .
I am using NextJS for this task. I have configured next.config.js for rewrites but getting 404 error. I am using Railway for hosting. Since in Vercel we can not access filesystem here.
Instead of generating html dynamically, if I upload that .html file, then i can access that file using iframe in production.
I think we can not access those files which were not available during build process. (this is my guess , maybe wrong)
How can I solve this problem or should I use another framework ?
Thanks
Since I was accessing .html files (i.e <iframe src="path-to-file"></iframe>) which were not available during build process, that's why i was getting 404 error.
So I did the following thing:
suppose I want to do this <iframe src="/pdf/page01.xhtml"></iframe> where file location is in public/pdf/page01.xhtml.
so this src is sending a GET request to localhost:3000/pdf/page01.xhtml.
To manipulate this request I created a pages/api/pdf/[...slug].js. In this file you can use process.cwd() to access the file inside your public dir. You read file content using fs.readFile and send the response res.status(200).send(data) like this.
By doing this I was getting the desired result.
Suggestions are always welcome.

Ask in a web form for the path of a file accessed from a user's computer

In a web form (aspx) I want to ask the user for the path of a file that needs to be used by one of our team.
At first it was a simple textbox but a lot of people send us wrong path (copy/paste seemed too hard for them).
So I tried to use an input file to be sure the path exists but noticed that the file is then send with the form. As the files can weight hundreds of Mb that was not acceptable.
Then I found a way with Jquery to use the input file to get the path of the file without sending it : it works fine on IE but Chrome translate the path in "fakepath". I understand that it is for security reasons.
So I am again looking for a solution, working on all browser, to get from the user the path of a file (with a specific extension) without him being able to write a wrong path.
I hope someone will have the brillant idea I am unable to find :-).
How about receiving only a few kilobytes of the file data from stream instead of the whole file to ensure the path points to a valid file.

Force file download in a browser using ASP.Net MVC when the file is located on a different server without downloading it on my server first

Here's what I would like to accomplish:
I have a file stored in Windows Azure Blob Storage (or for that matter any file which is not on my web server but accessible via a URL).
I want to force download a file without actually downloading the file on my web server first i.e. browser should automatically fetch the file from this external URL and prompts the user to download it.
Possible Solutions Explored:
Here's what I have explored so far (and why they won't work):
Using something like FileContentResult as described here Returning a file to View/Download in ASP.NET MVC to download the file. This solution would require me to fetch the contents on my server and then stream from my server to the browser. For this reason this solution won't work.
Using HTML 5 download attribute: HTML 5 download attribute would have worked perfectly fine however the problem is that while it is really a very neat solution, it is not supported in all browsers.
Changing the file's content type: Another thing I could do (at least for the files that I own) to change the content type property of the file to something that the browser wouldn't understand and thus would be forced to download the file. This might work in some browsers however not in all as IE is smart enough to go beyond the content type and sees the file's content to determine the content type. Furthermore if I don't own the files, then I won't have access to changing the content type of the file.
Simply put, in my controller action I should be able to specify the URL of the file and somehow browser should force download the file.
Is this something which can be accomplished? If yes, then any ideas how I could accomplish this?
Simply put, in my controller action I should be able to specify the URL of the file and somehow browser should force download the file [without exposing the URL of the file to the client].
You can't. If the final URL is to remain hidden, your server must serve the data, so your server must download the file from the URL.
Your client can't download a file it can't get the URL to.
You can create file transfer WCF service (REST) which will stream your content from blob storage or from other sources through your file managers to client browser directly by URL.
https://{service}/FileTransfer/DownloadFile/{id, synonym, filename etc}
Blob path won't be exposed, web application will be free from file transfer issues.

Get file path & filename with asp:FileUpload, don't want file... just path and name

I am developing a .NET intranet site which will enable the user to see a list of files (file details stored in DB) and link to the actual PDF/XML/XLS and open it... kind of like a table of contents for the network.
During data entry, the user enters various data about a document, then browses to the file on the network and selects it using the asp:FileUpload. The codebehind then saves the network path to the DB. There is alot of overhead here because i'm sending the file to the server but never use it.
Everything has been working fine until someone tries to use a large PDF file then I get the dreaded MAXIMUM REQUEST LENGTH EXCEEDED error... So I'm trying to find a solution here... I do not need the actual file.. just the path and filename.
I know not all browsers send the full path but our systems have older browsers so everything is working fine now, but will probably break soon.. which is another reason to find a different solution.
I've looked into Javascript to pull the path but that won't work...
Any other ideas? Other ways to just grab the path and filename? (besides manually typing it in to a Text field)
Thanks,
Todd.
This may help too
How to get the full path of a file from asp: file upload?
string filename = Path.GetFileName(FileUpload1.FileName);//file name
string path= Server.MapPath(filename);//path

Using Server.MapPath() to generate img src, not working

This seems like a basic question, but I am looking for a proper way of doing this. I am displaying a series of images and their source in view looks like this:
src="#Server.MapPath(Path.Combine("~/App_Data/",photo.ClientId.ToString(),photo.PhotoId.ToString())+photo.FileExt.ToString())"
Which compiles to:
"c:\users\architect\documents\visual studio 2012\Projects\PhotoManagement\PhotoManagement\App_Data\5\62.jpg"
I triple checked that the files do exist at this location. Why does the browser refuse to display this image? Is there a workaround so that the code still works on the server when I upload it.
Thanks.
APP_Data is a restricted folder intended for Datasources such as Database only. ASP.Net will not deliver a file in here - try it by going to the URL for that image directly (I.E www.mysite/App_Data/5/62.jpg ) and you will see the error message HTTP Error 403 - Forbidden.
Put your images in a folder outside of this and you will be fine, such as a folder in the root Called Images
Server.MapPath returns the path of the image on the server. Unless the client happens to have an image in exactly the same path on their computer, this will not work.
Try using Url.Content instead:
src="#Url.Content(Path.Combine("~/App_Data/", photo.ClientId.ToString(), photo.PhotoId.ToString()) + photo.FileExt.ToString())"

Resources