CefSharp not displaying PDF files in the builtin viewer - cefsharp

I'm writing a custom webbrowser based on CefSharp 90.6.7. I have a problem with opening PDF files. I'd like these files to be opened in the Chromium built in PDF viewer. Instead of this I just get a white screen with an error "The PDF cannot be loaded" message. There I have the possibility do download the PDF file and after downloading this gets displayed in the default PDF viewer.
Unfortunately I don't know how the web application is serving the PDF files (it's a SAP UI5 ABAP something), but when I try this in latest nightly Chromium, MS Edge or other Chromium based browsers, these correctly display the PDF file in the build in viewer.
Can you point me what do I miss? Is it somehow necessary to handle these PDF files? I tried to google for an example, but haven't found anything.
Thanks in advance!

Related

PDF files not fully loading on nginx server

I currently have a web application that generates fairly large PDF files (100 - 200 MB per file). The application is currently configured to display the PDF in a new window. When the PDF file size is low (50mb or so), I can successfully use "save as" in Chrome and Firefox to download the file. But, if the file size is larger than that, I'm able to see the output of the PDF in the browser, but unable to use "save as" (nothing happens).
The server is running on nginx / PHP-FPM. I've tried upping the memory limit for the script, disabling the script execution time and a few other random tweaks to try and diagnose the issue, but I'm unable to make any progress. My logs aren't showing anything of use (at least, not that I can tell).
I suspect this issue is due to the PDFs not fully downloading during the script execution, but the data all seems to be there...
Any advice on how I can get the file downloads working for larger PDF data?
The configuration of the server limits the size of your data,you have to change configuration---upload_max_filesize which is in directory---client_max_body_size.

Programmatically creating PDF from webpage

I have my resume online in an html page (www.mysite.com/resume.html). Every time I need a PDF version of it, I use Google Chrome's print dialog to save it as a PDF, which uses my print CSS stylesheet.
I want to be able to navigate to www.mysite.com/resume.pdf to always have an up to date PDF version without having to go through Google Chrome manually. Is there a way to programmatically and automatically create a resume.pdf from resume html? If I can write a script that runs once every 24 hours or something like that, that would be good.
PhantomJS is perfect for this. It invokes an instance of WebKit from the command line which can then be used to output to file such as PDF.
PhantomJS:
http://phantomjs.org/
Specific instructions for exporting screen output to a file:
http://phantomjs.org/screen-capture.html
e.g.:
phantomjs rasterize.js 'http://www.example.com/resume.html' resume.pdf
Chrome has started headless program.
With that, we can create a pdf. e.g. for windows navigate your commandline to
C:\Users\{{your_username}}\AppData\Local\Google\Chrome SxS\Application>
Then hit the command:
chrome --headless --print-to-pdf="d:\\{{path and file name}}.pdf" https://google.com
If you are looking to do this server-side via PHP might I recommend the Browsershot library which leverages the Puppeteer (NodeJS package) and Chrome / Chromium headless browser?
It works really well. Way easier to install and get going than wkhtmltopdf (which is another option that doesn't rely on a NodeJS package nor the Chrome/Chromium headless browser. Personally, I recommend Browsershot solution since wkhtmltopdf has some issues depending on the type of server (Linux distro and version) you're running. That is, the only reliable way to install wkhtmltopdf that I've found is to download and compile from source on the server that you're running and not through a package manager).
Also, if you happen to be needing a solution specifically while working on a Laravel project then there's a wrapper library for Browsershot available.
Check out this tutorial to get started.

How do I add support for a proprietary image format in Windows Photo Viewer / Picasa Viewer

I am working on developing a lossless compression algorithm using MATLAB.
I would like to see some of my compressed images on windows photo viewer. Could anyone direct me on how to go about doing this? Where may I find specifications to create a codec that would work with windows photo viewer?
I am guessing that I could create a codec as a .ddl file and place it in some windows directory and Photo Viewer could decode my file format. I have seen some softwares from Nikon imaging that, once installed, allowed photo viewer to display the .NEF (Nikon's RAW) files.
I am also willing to consider developing the codec for picasa.
I think I discovered what I was looking for - It is called Windows Imaging Component.
The MSDN docs appear to be here and an example of an implemented coded is webP.

SSRS PDF Corrupted on Export

I have a problem with export to PDF from a report server. When exporting to PDF from the report viewer control in a ASP.Net web site written in VS2010 and C# for a certain report in the general case it works fine. However, with certain parameters passed to this same report it outputs a corrupted PDF file.
One peculiarity is that this parameter combination that corrupts the PDF file is the one that outputs the most amount of data. All other render formats work fine in all scenarios.
Thanks so much for your help.
I was using Adobe PDF Viewer - latest version. Turns out the issue is fixed in Cumulative Update 6 of SSRS 2008 R2. Installing Service Pack 2 fixed the problem.

Flex 3 + AlivePDF - How to display pdf in the browser

I'm testing alivePDF 0.1.5 and till now everything's been fine.
I'm super interested in the new function writeFlashHTMLText() cause it makes my life so much easier! xD
I'm now trying to display the generated pdf in a browser tab/window instead of just saving the file (using the filereference class' save function). I saw that there was a PDF.save() function that allowed that specifying the argument Download.INLINE.
However I don't want to use the save function of the pdf class cause I don't want to use a script.
Is there any other way to achieve what I want?
Thanks a lot for your answers.
Regards,
BS_C3
Because of the way Flash works security-wise you have two options:
Generate and save the PDF to the local machine - this can be done entirely client-side using FlashPlayer 10+ (see the FileReference class).
The user can then navigate to, and launch, the generated PDF file.
Save the PDF to a server and link to the PDF from your Flash application. This will let you open the PDF in the browser.
Obviously this requires a server of some sort.
Build your app as an AIR application - this will let you save the file and, as far as I'm aware, launch it from the local machine.
The current state of things: you cannot generate a PDF and open it in the browser completely client-side (i.e. FlashPlayer in a browser) unless you are using AIR.

Resources