Alfresco PDF thumbnail previews unreadable - thumbnails

Not sure this is the right stackexchange site but seems to be the place with the most question about Alfresco I can find so here goes.
Have Alfresco Community Edition 4.2.d installed on a RHEL5 64bit box (mainly default install bar using MySQL as a database locally). Uploading PDFs to the documentLibrary is fine and thumbnail previews and flash previews are generating. If the PDF has been processed by ABBYY OCR (which we have running on a separate server and is used to OCR scanned PDFs) then the flash preview generates fine but the thumbnail is incredibly dark and looks as if it has been attacked by a can of spray paint.
I initially thought it could be a ghostscript issue but have updated that to 9.14 and still getting this issue. I have also tried playing around with ImageMagik but I can't get a nice clear thumbnail to generate. I am guessing it is a switch in the convert command that Alfresco is using but I am struggling to work out a combination of switches that will work and then where Alfresco would store these parameters. Or indeed what switches are currently being used.
I was wondering if anyone had seen this behaviour before with ImageMagik previews in Alfresco 4.2.d? It seems something unique to PDFs that have been through the OCR process so I am guessing I will need to create a separate transformation for them at a later stage.
EDIT: So it was suggested that a later version of ImageMagick and GS should resolve it. I have therefore installed GS 9.14 and IM 6.8.9-0 (both compiled form source). Running the following from a command line:
convert /root/test1.pdf[0] /root/test1.png
results in a crystal clear image thumbnail preview. Thinking I was on to a winner I have amended the following lines in alfresco-global.properties to point to the system location of GS and IM:
img.root=/usr
img.dyn=${img.root}/lib
img.exe=${img.root}/bin/convert
img.gslib = /usr/local/share/ghostscript/9.14/lib/
and alfresco loads. However the thumbnail preview generated by Alfresco using the new version of IM and GS does not result in nice clean previews.
I am guessing that Alfresco is passing some command line switch during the conversion that is undoing the good work of the later versions of these programs. Does anyone know where the switches for thumbnail creation might be stored in Alfresco?

I guess it's related to transparency and default background black. I didn't find an easy way to add the required parameters to the script except to register a new transformer supporting more parameters like:
-fill white -opaque none

Related

Unity - Saving an image from a WebGL app to the users machine

I`m building a character creator webGL app and want to enable people to "save" their avatar as a 500x500 PNG file on their desktop.
So far I have been using the exact code from the following source, which works for the Unity Editor:
https://www.reddit.com/r/Unity3D/comments/48hreq/saving_an_image_from_a_webgl_application_to_the/
However, in that topic they never got around to providing a solid answer on how to prompt the user to either download the generated image, or to open the image in a new tab so that they may download it themselves.
I have been testing multiple scripts, but at the end of the day i havent been able to come closer to a solution by myself.
Any pointers, tips or advice would be greatly helpful!

Powershell method of downloading file from a website with a changing URL?

I have been given a task that involves downloading a single file every day from a website. Let's call it "https://test.example.com". I have credentials that allow me to login to the site, where a Flash interface then presents the files that are available for download. After the file is downloaded, it is then processed in a variety of ways. I have already put together the Powershell that handles all that, I am just having a hard time with automating the actual download of the file.
I used the Flash interface to download a few files while watching the network activity, and found that it is actually pulling the file from this URL:
https://test.example.com/link/EBDB7F67EF3B28XX99NCAD9920160423/file.zip
Therefore, I was able to put this together in order to automatically get the file via my PS script:
$url = 'https://test.example.com/link/EBDB7F67EF3B28XX99NCAD9920160423/file.zip'
$output = "C:\Downloads\file.zip"
Invoke-WebRequest -Uri $url -OutFile $output
However, the long string of numbers in the URL changes every day. The only discernible pattern I can find is that the last eight digits are always the date on which that particular file is posted.
Is there a good way to approach this? I've been experimenting with wildcards and patterns, as well as checking the HTML for elements that I can filter, but I am having a hard time finding the correct solution.
This is very hard to automate. You can't drive Flash from the script unless it is specifically designed for that. As I see it now your only options are:
Contact site devs if possible, maybe they can give you a details on function that generates link. This gives me an idea - perhaps you can reverse engineer Flash code to find that function details yourself. Use flash decompiler for this.
Simulate the user browsing the flash site. This can be done in one of the following ways:
Autohotkey - you can record mouse clicking relative to the browser window and execute the script again. Unless flash interface is too dynamic and unpredictive it will work.
Sikuli - another automation language which relies on picture segment recognition.
All above 2.* methods produce fragile automation code as they depend on browser settings (zoom, theme) and even OS settings. For this reason you need to dedicate one machine for that in all probability (virtual machine ofc). Decompiling flash code and re-implementing the url generting code in powershell will make it a reliable 100%.
As somebody said in comments this is not a powershell queestion but browser automation question.

Change in Google Earth Collada Support with Version 7.1

I have an application that creates Collada Models in Google Earth that worked fine in version 7.0 but with 7.1 the colors stored in a 24bit PNG texture are no longer displayed. The model displays but no colors. I tried switching to a jpg (supposed to be allowed in Collada) but that didn't work either. Anyone know what the problem might be?
Additional: I just discovered that if you unzip the KMZ file my model will display with the colors from my texture. However if I rezip with a different zip program (7zip) the problem returns.
Google has acknowledged that its a bug in 7.1:
"We can confirm the loss of textures in GE 7.1.1.1580 (beta) for images embedded in the kmz. If 7.1 is required, workarounds include reference to a network, web or local path outside the kmz (as you have found). We think this is a glitch in the beta, relating to extraction of the textures from a zip archive, and expect to see a fix in a later update.
For example, change the in your to access an alternate image outside of the kmz:
c:/test/sample.png
sample.png
When you Save Place As (*.kmz), GE 7.1 still copies the image into the zip archive and writes sample.png to doc.kml, which is a good sign.
-wxazygy"

Using image resizer in crystal reports

Anyone know how or why the ImageResizer will not work in crystal reports?
If you paste the URL
xxxx.jpg.ashx?width=50 into a browser, works great.
The exact same path shows nothing when used as a image location in crystal reports (Remove the .ashx?width=50 and it immediately works again). So it's as if the image resizer is unable to execute when called from the crystal reports viewer? (I do not understand why since we have verified that any user, even without being authenticated, can reach the path through a browser)
Crystal Reports 2008, Version 12.2.0.290
In terms of diagnosing the issue, in short involving the image resizer process (by including the .ashx?width=50 on the end of the URL) is the only thing that prevents the image from showing. And this only occurs in crystal. Browsers handle the URL just fine.
UPDATE : Testing without the .ashx also proved to not work. The ?width=50 after .jpg is enough for crystal to just display a blank. (No errors, just no image)
UPDATE : Testing using &format=png or &format=jpg also did not work (Blank in crystal, works perfect in browser)
FINAL UPDATE : We ended up placing the image re-sizer software on a stand alone (what used to be a file manager box) away from our web.config, permissions, and web server and then crystal started rendering the images just fine. So we never really figured out WHY crystal could not render the images when the re-sizer software was loaded on our IIS web server\intranet.....(possibly due to integrated windows authentication turned on even though we granted access to the folder the images were in) ......but it did start working just fine when we bypassed all of that stuff.
I suggest trying an alternate URL syntax to determine if Crystal Reports is simply allergic to query strings.
Try the FolderResizeSyntax plugin "folder/resize(50,50)/image.jpg
Try the CloudFront plugin: "folder/image.jpg;width=50"
FINAL UPDATE : We ended up placing the image re-sizer software on a stand alone (what used to be a file manager box) away from our web.config, permissions, and web server and then crystal started rendering the images just fine. So we never really figured out WHY crystal could not render the images when the re-sizer software was loaded on our IIS web server\intranet.....(possibly due to integrated windows authentication turned on even though we granted access to the folder the images were in) ......but it did start working just fine when we bypassed all of that stuff.

Is there a way to programmatically download a web page, for offline viewing, using WebKit?

What I'd like to be able to do is download any web page, and be able to view it offline.
It seems like html WebKit views cannot be converted to PDFs (on the Mac, you could 'print' a PDF, but that isn't possible on iPhone?).
So, the only way is to save the actual resources - save the html, the step thru each image, css, js file and save it locally. Then maybe alter the urls within the code so they point to the right place...etc ...etc...
Is there a standard way to do this?
Or, is there an open source project (in any programming lang) which does this kind of thing?
There's an excellent webkit html to pdf converter appropriately called wkhtmltopdf. Given the reources available on the iphone and its toolkits, I think it'd be easy to compile a version for the i-Phone ('think' being the operative word). We've managed to use the tool in a Windows, Linux and Solaris environment with absolutely no bugs. Here's the link:
http://code.google.com/p/wkhtmltopdf/