How to generate thumbnail for some pages of a PDF file? - c

I want a C library for generating image snapshots of PDF files. Then I would use this to generate the thumbnail of the first page. Is there a library for this?

You could probably use one of the general-purpose PDF libraries:
Ghostscript - C, available under the GPL
Poppler - C++, available under the GPL
Adobe PDF Library SDK - expensive
Google reveals quite a few PDF-to-image converters which you may be able to incorporate if one of the above options doesn't work.

Check out Poppler --- a PDF rendering library based on the xpdf-3.0 code base. It comes with a tool to create images from PDF pages as well.

Related

Using custom icon assets with DesktopAppConverter UWP

I'm using DesktopAppConverter to convert my WPF application into a windows store compatible app. Right now I'm able to get the AppX built but the problem is to do with my application assets.
At the moment, DesktopAppConverter is taking my existing Icon (which looks great in WPF) and using it to somehow create all the different Assets at different resolutions for the UWP app. The icons it creates are coming out looking terrible, really blocky and clearly upscaled.
The way I'm looking at it is that there's 2 options.
1 - I specify a really large Icon file in my WPF app that might somehow end up being scaled better inside DesktopAppConverter. The problem here is that with a large resolution Ico file, I end up with a crazy large file (Ico's don't compress very well from what I understand).
2 - I specify a folder of correctly scaled assets (created using UWP Tile Generator) when building through DesktopAppConverter. This is what I'd like to do. I don't really want to be tweaking my Assets every time.
The 3rd choice is the one I'm heading towards, but don't really want to do. It involves building with AppX, then replacing the assets, then using MakeAppX, then re-signing with the SignTool. All of that seems really unnecessary, so I'm hoping someone from MSFT can let me know I'm missing something fundamental.
Thanks.
The easiest way to handle the visual assets for your app package is to use the package manifest editor in Visual Studio 2017.
To use it for your converted app, create an empty UWP project and add the output of the conversion (incl. your appx manifest) in this project. Now you can use the editor to manage the visual assets, build your packages for store submission and much more.
Here is a document that describes the process:
https://learn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net
Thanks,
Stefan Wick - Windows Developer Platform

Native PNG library on MacOSX (mavericks)

I need to build an application which can read PNG files. On MacOSX mavericks the libpng is not available anymore (see).
Is there any other way to read PNG file on MacOSX (Cocoa / Carbon Framework...). I'd rather stay with the native framework than download and compile a local libpng. I also need to read TIFF and JPEG files, so ideally the native framework would also allow me to read those ? I am using C programming.
I would expect that to be handled by the (aptly named) Image I/O framework. This page has example code on how to set up an "image source" and load an image from it. I don't think you need to care at the application level whether the image is PNG or not, the framework abstracts that out.

which files are need to be packaged with cefsharp winforms application

By using CefSharp version 37.0.0 my winforms application is ready to submit in college but I am not getting which files (DLL,exe,pak) are need to be packaged along with project references. I already gone through this article https://github.com/cefsharp/cef-binary/blob/master/README.txt#L104-L106 but still confused in :
Is all .pak files (cef.pak,cef_100_percent.pak,cef_200_percent.pak,devtools_resources.pak and all files from locales folder) are used for developer option?
Can I make separate folder cefSharp reference files?
It's hard to give a definitive complete answer, so: "It depends" on what your application uses. For .pak files e.g. if you are not using the DevTools in your application you can skip devtools_ressources.pak etc. similarly with languages and e.g. WebGL and other of the CEF .dll files.
See https://github.com/cefsharp/CefSharp/issues/527 for a discussion already marked faq-able! it also contains info on setting path for .pak files. You can inspect the binaries etc. of the resulting WinForms application at https://github.com/rfgamaral/SlackUI/releases.
Moving .dll files around is not recommended/supported.
Also see this related SO entry: What is the purpose of the cef.pak file in cefsharp?
In theory, you can see a rundown of all the files here:
https://bitbucket.org/chromiumembedded/cef/src/aefb5ccce879f308f0bcc3ac719c86defe2f9715/tools/distrib/win/README.redistrib.txt?at=master
However, one thing they don't note about not including cef.pak (or disabling pak loading altogether) is that it will cause things like red scrollbars (at least on windows). I've found I need to include cef_100_percent.pak to avoid this.

Updating DotNetNuke image library

Have written simple file picker control for my dotnetnuke site, because the one that ships with dnn doesn't really do what I need. The file picker uses System.IO for collecting directory information and uploading files to the portals root and subfolders. These images can then be inserted where ever I need them. The problem is images uploaded in this manner don't seem appear appear in the file manager or image manager used by the html/text module.
Is there anyway I can register these files with dnn when I upload them so they will also appear in the html/text image manager?
What would be even better is if there is a way to use the image manager that is built in the html module, outside the module although am not looking to buy a pre-made module.
Any thoughts?
You would want to use the DNN API for uploading files.
As for using the built in Image Manager that you find in the HTML module, that is part of the Telerik Rad Editor. You might be able to dig through the source for the Rad Editor Provider and figure out how to include just that portion into an outside module, though that might technically require a valid Telerik license to do.

How to Convert TIFF to JPG Inside Silverlight, client side, using a control or a class/function?

We are creating a client in Silverlight that will show a lot of TIFF images. Silverlight natively do not support TIFF. I need a control/class to convert tiff to jpg in runtime inside the Silverlight client. Any idea?
In Silverlight forum last friday I received this post:
Re: How to Convert TIFF to JPG Inside Silverlight, client side, using a control or a class/function?
12-18-2009 5:38 PM |
If you're willing to use a third-party library, check out ImageGear for Silverlight provided by Accusoft Pegasus. It's a 100% managed Silverlight toolkit (http://www.accusoft.com/ig-silverlight.htm), and runs entirely on the client. TIFF support is included (among lots of other formats).
Hope this helps,
Casey
I was successful displaying TIFFs in Silverlight. It's easy to port the free LibTiff.NET library to Silverlight, just 3-4 minor tweaks required.
The library itself is quite legacy-like and raw to use and one still needs to have some knowledge about the inner workings of the TIFF format in order to be able to extract the image data the way one needs it.
But it's doable and the bits and pieces can then be chiseled into a WriteableBitmap.
Not sure you are interested in solution by now, but we've just released LibTiff.Net 2.0 with Silverlight support, improved documentation and samples.
There is Silverlight Test Application in source package that shows how to create WriteableBitmap from TIFF images in Silverlight. Maybe it will help you or others.

Resources