ABCPDF version 8 HTML to PDF images not displaying - abcpdf

I have an aspx page with a calendar control on it. When I try to print this page to PDF none of my images or calendar gridlines are showing up. However when I go directly to the page everything is fine. Also I had this working on our dev server but once it was moved to a new server all the images and the gridlines stopped appearing. I have tried a few suggestions on here such as using full file paths for images with no success. Has anyone run into a similar issue? I put my code for creating the PDF below though I don't think that's the issue since I had it working on a different server before.
string url = HttpContext.Current.Request.Url.AbsoluteUri;
int lastDash = url.LastIndexOf('/');
url = url.Remove(lastDash + 1);
url += "print.aspx";
theDoc.AddImageUrl(url, true, width , true);
theDoc.Flatten();
theDoc.Clear();

I added the line of code below and the images and lines are now appearing. Though this answered my question the printed pages is very screwed now and needs to be fixed.
Doc theDoc = new Doc();
theDoc.HtmlOptions.Engine = EngineType.Gecko;

Related

Angular 2 image not refreshing with Zone run

I'm creating an image from an external source (a qrcode on a java ee server). When my Angular2 app updates the data for the image, everything gets updated on the server but the resulting image is not refreshed in the angular app. I'm currently doing a zone.run but it doesn't seem to refresh the image, Everything is fine if the entire page gets refreshed (eg. if I place a location.reload). Anybody no how to properly refresh an image from an external source?
template has this:
<img [src]=url />
component has this:
this.zone.run(()=>{
this.url = QRURL + this.selectedProduct.id;
});
QRURL is a constant that contains the server's url that executes the generation of the image.
The quotes didn't fix it, but Maxime's 2nd comment did. My constant alread y had a query string, so I just added the date stuff as another parameter on it, and that did the trick and I was able to strip off the zone.run. The final variable looked like this:
this.url = QRURL + this.selectedProduct.id + '&date=' + new Date().getTime();
Thanks!

Magento Javascript issue with image resizing

I'm using a Magento 1.4.1.1 install that I'm having issues with the javascript on a custom themed store.
For example, going to any product page (e.g. http://www.papakuraeducation.co.nz/index.php/teachers/magic-caterpillar-handwriting-casey-caterpillar-small-book.html) loads a Javascript file, which contains code which is supposed to scale down the .jpg file to fit the 'product-image' container it sits inside.
The relevent code seems to be around line #10279, which is causing a exception that $(imageEl).parentNode = null
Product.Zoom.prototype = {
initialize: function(imageEl, trackEl, handleEl, zoomInEl, zoomOutEl, hintEl){
this.containerEl = $(imageEl).parentNode;
this.imageEl = $(imageEl);
this.handleEl = $(handleEl);
this.trackEl = $(trackEl);
this.hintEl = $(hintEl);
(snipped...)
I've tried debugging it in Chrome and adding breakpoints, but tbh I'm not actually sure how to use this information to find the solution.
Any help in pointing me in the right direction would be greatly appreciated.
You have to add an ID to the <IMG> in question. This ID should than be fed into the following code-space:
product_zoom = new Product.Zoom('IMAGE_ID', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');

MIME Type Warning Causing Broken Image on Website

Here is a sample page having an issue:
http://estorkdelivery.com/template/view/69
Our website serves up a template preview. Once you enter text information and tab out of a field, the website serves up an updated preview of the image with the text added to the field.
When the server returns this image:
http://estorkdelivery.com/file/preview/verify_token:149505eb811f8856a12ec6e71e2932f082a97edf
It shows up broken with the following message in my console:
Resource interpreted as Image but transferred with MIME type text/html: http://estorkdelivery.com/file/preview/verify_token:149505eb811f8856a12ec6e71e2932f082a97edf
Trying to cover all bases, I've verified the server has the following MIME types set:
application/x-javascript .js
image/jpeg jpeg jpg jpe
image/png png
I'm not sure why this is happening. I was wondering if someone could help me troubleshoot. Any ideas?
Thanks!
Update 04/27/2012 - My question was marked down, but I have done research on this issue. If this question doesn't merit an answer, can someone at least point me in the direction I need to go in order to continue troubleshooting? I don't ask questions lightly and I have read plenty of similar issues on StackOverflow to find myself still with the same problem. It's discouraging to be marked down without a polite explanation. Thanks.
Honestly, I don't think it's a server setup problem; when your AJAX request comes back with a verify_token, I can use that to get an image from your server. Then, using JavaScript, I can get the new preview to display on the page.
This section looks odd:
new $._iframeUpload(form, {
success: function(response)
{
$('.preview').attr('src', 'http://estorkdelivery.com/file/preview/verify_token:'
+ response.verify_token);
var image = new Image();
image.src = 'http://estorkdelivery.com/file/preview/verify_token:'
+ response.verify_token;
image.onload = function()
{
$queue--;
if ($queue <= 0)
$('.updating').hide();
};
}
});
I don't really understand why an Image object is being created after editing the img tag. I would change your JavaScript to look like this (so that the onload callback works):
new $._iframeUpload(form, {
success: function(response)
{
var image = new Image();
image.onload = function()
{
$('.preview').attr('src', image.src);
$queue--;
if ($queue <= 0)
$('.updating').hide();
};
image.src = 'http://estorkdelivery.com/file/preview/verify_token:'
+ response.verify_token;
}
});
Try that and tell me if it helps.
Minor quirk
This isn't really in answer to your question, but it influences how this whole image loading process works. Your preview is 700 x 500, but the new previews that you're returning from your server are 2900 x 2100! That's making your AJAX load time much longer than your initial page load. You might consider sizing it down on the server side and then transfering it to the browser.

How to detect when AJAX-loaded images are fully downloaded?

I'm working on a website where the homepage has a rotating banner. When the page is loaded, an AJAX request is performed to retrieve the rest of the banners (each of which has a 960-pixel wide image). I toyed with the idea of loading the page normally with all the banner HTML loaded, but the target audience of the website are not always guaranteed to be on a blazing connection, and I wanted the homepage to load quickly. Plus, I didn't want conflicting H1 tags. The page in question is the landing page at http://www.gosihanoukville.com/
If you're on a slowish connection, the banners will load and start moving (rotating) before the background images are finished loading. I'm wondering if there is a way to detect if an image has fully downloaded before I have the script start moving the banners.
I'm not including code here, as it is best seen on the website mentioned above. The JS file used is 'landing.js'
Thanks for any help - this is driving me crazy.
I would normally do this:
var imagesToLoad = [];
var imagesLoaded = 0;
// Register this handler using whatever framework you like
var whenImageLoaded = function(){
if (++imagesLoaded == imagesToLoad.length){
// Start moving the banners.
}
}

image using .ashx

i am using .ashx to retrive image and i place the the image inside the ajax update panel it retrive the image when a new image is added to the form but when we change the image it is not updating the image it dont even call the .ashx file but when i refresh the browser it works properly
Sounds like a caching issue. Try adding some of the lines found here to your ashx file and it should hopefully force the browser to rerequest the image. (I know that the link is for ASP rather than ASP.NET, but things like Response.Expires = -1 should work)
Alternatively, can you change the path to the image in the updatepanel? If you just add a random parameter on to the end of it the browser will treat it as a fresh request (we use the current date/time as a parameter when we're doing this. The parameter is ignored by ASP.NET unless you explicitly reference it)
Do something like this:
var sPath = "../../handlers/ProcessSignature.ashx?type=View&UserID=" + userID + "&d=" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
That puts a 4 character alpha numeric string at the end of your query string. It's not needed, but it will force browsers to pick up the latest version of that image because the URL is different.
I tried the above and some browsers ignore the headers. I threw all of those in and Chrome/FireFox 3 didn't try to update.
IE7 worked sometimes
IE6 just twiddled it's thumbs and asked why it was still in existence.
Changing the path above will fix it in all browsers.

Resources