Why are images not showing up with Carbon's HTML rendering library - macos

I have an old program that shows an embedded browser using the HTML Rendering library from Carbon. I am migrating it from codewarrior to Xcode, using the 10.4 SDK. While the HTML is displayed correctly, including links, the images just don't show up. I can see the alt content, and dimensions are properly set with the width and height fields.
I am doing the initialization with:
OSErr err = HRNewReference(m_HRRef, kHRRendererHTML32Type,
GetWindowPort((WindowRef) m_pWindow));
And then I open my local HTML file with:
err = HRGoToFSRef(m_HRRef, &f, false, false);
My images are also stored locally but just do not appear, it was working fine previously on my ppc-only codewarrior compilation.
I tried with web pages on Internet with HRGoToURL, and I tried replacing my pictures src fields with http:// or file:// links to images, in jpg, gif and png, always with the same result.
Are you aware of any issue like this? I know I could, and probably should, migrate to WebKit but that would me more involved.
Sylvain

This is a shot in the dark (I am completely unfamiliar with HTMLRenderingLib), but it reminds me of this. Maybe here too it doesn't load images, even local ones, asynchronously; have you tried letting the run loop loop (whichever way is most appropriate to your app: WaitNextEvent, return back to the main runloop, spin a sub event loop, …) and see if the images load?

Related

Website displays image that is not associated with img src

I have an iOS app that contains a UIWebView, which display a webpage. Sometimes the page displays a different image than the one associated with the src link.
A user sent me a screenshot where it was clear that one of the icon images had been replaced with a completely different image. The same wrong image was displayed in each of the instances where this icon was supposed to be displayed. Refreshing did not solve the issue, but closing and opening the app did. (Or maybe she actually deleted and reinstalled the app.)
The html for the icon is just an img:
<img src = "/the_icon_source">
The img src is hardcoded directly into the HTML file. I therefore don't see that the HTML itself could have been wrong or said anything besides "/the_icon_source".
So how can the wrong image be associated with an image src? Could the server be sending the wrong image when it's asked for "/the_icon_source"? Could the iOS app be caching incorrectly, mixing up images? How to test and fix?
I myself cannot reproduce this issue. I'm not sure how often it occurs, but several users have mentioned it, also for other images on the page. They have only mentioned it occurring in the app, not on the website. This may just be because the app is used more than the website.
My host is Webfaction and the images are served using WebFaction server’s static-only front-end nginx process. The app displays the website in a UIWebView. (Webfaction suppprt merely told me that they served the right images.)
Is the problem not that you have it like this:
img src = "/the_icon_source"
rather than like this:
img src = ".the_icon_source"
If this is sat on a linux server the / will be pointing to the root directory whereas the . or simply the_icon_source would simply point to the directory in which the website is sat which i assume is where the image is also located.

Firefox pdf form displays a "4" in checkbox (instead of a checkmark); Works fine in IE & Chrome

I am creating a pdf document (via ColdFusion), but when I preview the rendered pdf in Firefox, I get the number "4" where my checkmarks are supposed to be (see photo below). When I preview the exact same pdf in Chrome or IE, I see the checkmark, and it all works perfectly!
I am pre-populating the pdf form fields (via ColdFusion session variables), and then rendering the pdf using the following markup:
<cfpdfform source="82040.pdf" action="populate">
<cfpdfformparam name="org" value="">
</cfpdfform>
Here is the resulting pdf form in Internet Explorer:
Note how the checkmark is rendered properly:
Here is the same form previewed in FireFox:
Note how the the checkbox has a "4" instead of a checkmark:
Any help would be greatly appreciated!
It is a bug with Firefox's PDF Viewer. Currently, there is no fix. As radiovisual's post points out, the bug in the underlying library (pdf.js) was supposedly fixed. However, there is still the issue of Mozilla updating the older version baked into Firefox (which is what most folks are using). Currently, that bug is still outstanding.
Probably the best you can do is to return the pdf as an "attachment", rather than "inline", so the browser prompts them to "open/save" the file. If the user opts to "open" the pdf, it should open with their default program instead. (Adobe Reader is the default for most users).
<cfheader name="Content-Disposition" value="attachment; filename=fileName.pdf">
<cfcontent type="application/pdf" .../>
Update:
This bug was apparently addressed already, as pointed out via the project's github repo: the bug was supposedly fixed during this commit. So if you are still experiencing problems, it either means:
You are using an outdated version of the pdf.js library,
Or, the problem has been re-introduced into the library.
So to start things off, you will want to make sure that you are using the most up-to-date version of the pdf.js library. If you are still experiencing problems, even with the most up-to-date version, then the problem is still within the embedded pdf document viewer, and there aren't too many things you can do to fix this until the project maintainer's finally fix the problem.
The issue you are experiencing (the reason why you are seeing a "4" where there should be a checkmark, is because the pdf.js library is using a special symbol font to render the checkmarks, but in problematic versions of firefox's embedded pdf-viewer the symbol font isn't rendering the checkmark correctly, so it shows a "4" instead of a checkmark -- because the checkmark symbol they are using in the custom font just so happens to be mapped to the number "4".
Similarly, for the same reasons cited above, if you assign the checkbox to render squares (instead of checks), the letter "N" will appear in the checkbox instead of a square, because the square shape symbol is mapped to the letter "N".
This problem only exists in the embedded pdf document viewer in Firefox but will look perfectly normal when viewed in Adobe Acrobat Reader, or other offline pdf readers (and other browser pdf readers, which is why it looks fine in Chrome and IE), so when users download the form, it will appear like you would expect it to.
Some workarounds / optimizations you could try:
Try one of these, or all of these, they are in no particular order (or guaranteed to work)
Don't rely on the built-in pdf.js browser extension in firefox, instead, make your own updated version based on the latest pdf.js source or target another pdf library and use it's browser-agnostic API to render and display your pdfs.
Create an HTML form for the user to fill and verify all the information, then render the pdf based on the data supplied by the HTML form, for download only (no previewing in the browser). This will force them to open the pdf in their default pdf viewer where the issue is not present, because, again, the problem you describe only happens in Firefox's embedded pdf viewer and not in other pdf viewers like Adobe Acrobat).
Make sure you have the ZapfDingBats Font installed on your server. I haven't confirmed this, but that commit that was supposed to have solved this issue seems to have added support for this font, so it is worth a try to make sure this font is accessible on your ColdFusion server, then try previewing the rendered pdf in Firefox.
Detect that the user is accessing your form via Firefox, and if so, warn the users of the issue, but assure them that downloading the form and viewing in their default pdf viewer will work as expected.
Convert the page to HTML5 (if you aren't already), then add in an HTML5 shiv (so HTML5 features can be used on older browsers), and a CSS normalizer, and test if the problem persists using these optimal settings. It's worth a shot to make sure that the problem is somehow treated differently under the HTML5 standard, since not everyone is having the same issues as you.
Lastly, make sure that your HTML is being rendered as valid markup via your ColdFusion output by using an HTML validator.
Other than that, there isn't a whole lot you can do until the mozilla team updates their embedded pdf viewer. But since the problem is only in the firefox viewer, and not in the pdf itself, it it up to you to decide if this is a deal-breaker or not, and search for alternatives.
Note: PDF.js is built into version 19+ of Firefox.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Update: You can use this pdf (which represents the character mapping of the ZapDingbats symbol font) as a way of testing your browser's interpretation of embedded fonts in the pdf rendered via pdf.js. Note that at the time of this writing, the above pdf does not display the Zapf Dingbats properly in Firefox (via pdf.js), but other browsers render them just fine (notice the "4" next to a20[x2714] in firefox, and the checkmark next to the same entry (a20[x2714]) in Chrome.

Replace image in bitmap image object without opening document in word 2007 (any language)

I have a word 2007 document that is being used here as a template. In this template there are some bitmap image objects that are currently blank. The task is to write some text on these images.
The manual way is to edit the document and using paint I write the text on each of these images. But I am looking for a more dynamic way. Anything that can help me achieve my purpose.
I tried to do it using PHP but failed. PHPWord: Replaced image doesn't gets actually replaced
You can try DocxTemplater, which is a Javascript Library I maintain:
http://javascript-ninja.fr/docxgenjs/examples/demo.html#images
You can do that in the browser, but it works only in modern browsers (Chrome, FF, Safari latest versions). I recommend you to use nodejs.
Github Repository: https://github.com/edi9999/docxtemplater

Displaying a map in Quicklook preview

I'm writing a Quicklook generator plugin for a GPS logging file format (.fit files). I've shoved something together which loads the file and plots the path using the NSGraphics/NSBezier stuff:
(the horrible code for the above can be found here)
This is fine, but it would be much nicer to display this over Google Maps data or similar (the recorded tracks cover a fairly small distance - e.g the above covers about 20km by 10km - too small to display on a single map of the earth, so the map needs to be dynamically loaded somehow)
Things I've tried so far:
Returning HTML which shows a Javascript GMap instance. Doesn't work as the Quicklook HTML rendering doesn't allow Javascript (or Flash, Java etc)
Returning HTML containing a static Google Maps image. Quicklook wont load remote images.
Getting a NSGraphicsContext and displaying a standard WebKitView into this, modified from some thumbnailing code - this errors because you cannot initialise WebKit from a secondary thread (which seems to work fine for thumbnails, but not previews?)
With 2. I could possibly download the static Google Map image in ObjC, then display that with HTML, but the static map isn't ideal (fixed size so no zooming, and potentially slow to initially load)
I came across MacMapKit which I've not tried yet, but since it's WebKit based, I suspect it will have the same issue as 3.
Is there some way of displaying a map in a Quicklook that I am overlooking?
trying to get Google data directly in your generator (whatever way you try to do it) is not possible as the host of your plug-in is sandboxed and denies any connection to the network
trying to return HTML data and some clever javascript won't work either as the Quick Look panel also protects against network access for security reason and there is no public way to work that around
I am afraid you won't find a real solution to your problem, except by using your own map data.
Still, your use case is interesting and you should file a bug to Apple's Bug Report website.

images not loading in Internet Explorer. why?

ive been finally polishing off a website i was building but to my dismay i recently checked the website in Internet Explorer and found the images weren't loading fully.. you can see can the borders for the image but nothing loads in between. i thought it might something i altered on wordpress, but the main page has images from from non wordpress html files and they don't load either.. everything works fine on every other browser except Internet Explorer.. any ideas why? probably a simple fix
here's the website.. . all the code and css is viewable there, if you want my wordpress code let me know
maybe the code just needs to rearranged to make window browsers happy?
any help would be great
Looking at the source for the shop.html, it looks like you are specifying the height of the images, but not the width. Opera, and Firefox are ignoring the width="" and using the default width, but IE is setting it to width="1." I don't know how to change this in Wordpress but if you remove the width="" or add a value it will show correct.
You can see this if you r-click the image line in IE and select properties: it shows as 1X290px.
img src="images/shop/julianduron.jpg" width="" height="290"
hope this helps

Resources