Best approach to load a PDF in canvas - pdf

Here, I have tried a various approach for loading a PDF to the canvas. First thing is I used the library PDF.JS to load the PDF in canvas. The problem I faced with PDF.JS is that when I try to zoom in to the PDF - [
I tried two approaches
Zooming in to the object and the canvas - which made browser crash in a certain point in scaling
Converting the image as a object and loading it to canvas using Fabric JS and zooming in to the object - which made the pixel to break while zooming in (scaling was not proper to a certain point while zooming in)]
So, suggest me some best way to upload a PDF in canvas with perfect scaling while zooming in without any crash to the browser when I upload some bigger size PDF.
Thanks In advance! :)

I don't know if you still need this, but I stumbled upon a tutorial a few days ago that exactly shows how to do your use case (if I understand it correctly and you're trying to zoom in). You can check it here:
tutorial

Related

Custom icons on google map not drawing correctly

I'm having problems with google maps, drawing icons was working fine few weeks ago in my project. At some time the icons are very frequently drawing in partly and I don't know what is causing it. It is both happening on my development machine and production server and on all machines.
I'm only using two different icons so I know the bitmap images are not corrupt.
Here below are two sample images.
You'll get more help if you post your outputted JSON. Your gmaps JSON must not have quotes around width or height, like so: "picture":"/assets/dayhome.png","width":32,"height":37,"lat":53.5402,"lng":-113.628
Another fix is to include optimized:false which disables the html5 canvas (the squares that are cutting off the markers).
My much more detailed analysis here: Canvas Tiles Cut Off Custom Markers
Set optimized:false in your Marker options.
If optimized is true (the default), then your marker images are incorporated into the tiles. Unfortunately where markers cross tile boundaries, they are not also used on the adjacent tile, so appear to be truncated at the edge of the tile. Using optimized:false forces the icons to be placed on the map as separate DOM objects.

iOS cropping and resizing ensuring rect stays visible

My app downloads images from a website. These images are all manner of sizes, from 800x600 up to 1800x1600. I analyze the image using facial recognition, and then want to resize and crop the image. However, it's important that the detected CGRect be visible on the cropped image.
I was using the excellent UIImage+Resize code and using UIViewContentModeScaleAspectFill, but it doesn't seem to have a programatic way of specifying an arbitrary location that needs to be visible in the final image. So if a face is located at the 1600px range of an 1800x1600 image, it'll get cut off.
Is there an easy solution to this, or do I need to dig around in the depths of UIImage+Resize? Any guidance would be appreciated!

Is there any best way to show pdf in iphone other than UIWebview in objective-c?

Can you please suggest me, best way to show pdf files in iphone since i had used UIWebview, it took 3 - 4 mins to render in webview. Also i faced _WebtryThreadLock error.
Srini
It sounds like you may have some large vector calculations going on in your PDF. You can try re-constructing your PDF with flat images instead of vectors.
Code-wise QLPreviewController should be able to do what you want with a PDF, however it may use a UIWebView underneath. UIDocumentInteractionController also has a preview mode, but I suspect that it is using a QLPreviewController itself for it's preview.
You can also use the low level PDF functions, though this will be more difficult to do. Look at CGPDFDocument and it's related APIs in apple's documentation for more here.

How to display two pages in one scrollview page with zooming from PDF?

I want show per page pdf in portait mode and display two pages when rotate to landscape mode on ipad . I had search on internet and can't find any solution. I thought two possible way.
1.Using webview but I don't know how to display two page in one webview in a webview.
2.Using CGPDF API read from two page and merge to one pdf file. But I think this may be very slow and not sure if this could do it .
or any other way could solve this problem? Thanks!!
I don't think you will have much success with using a UIWebView there. There's however nothing stopping you from putting two CATiledLayers into a UIView and display them next to each other. In fact, that's exactly what I did in my iOS PDF parsing framework.
Just set the contentView as the containerView, that includes both tiled layers, and they work perfectly together. Keep an eye on your memory though, I wouldn't allow them both rendering pdf at the same time, that most likely crashes your app due to low memory. (Drawing a PDF is really resource intensive)

How do I render the scrollable regions of a canvas with IViewObject::Draw?

I've been trying to render the entire canvas in an IWebBrowser2 control to a bitmap. IViewObject::Draw seems to be the most promising approach, but I can't get it to render anything that would requires a scroll to show. While I could automate the scrolling and stitch the images together, this would look weird with any fixed position elements. Is this even doable?
Additionally, I've tried to set the controller's size to one that would allow the entire contents to display without needing to scroll, but Windows caps the max size to the current screen resolution, so that only gets me partially there.
Any help would be much appreciated. I'm currently doing this in the context of Win7 and IE8, but I don't think that should matter much.
Sorry it took so long for me to follow up with the answer to this.
I wrote up an article detailing how to trick Windows into allowing you to resize a window larger than the virtual screen resolution, allowing functions like PrintWindow or IViewObject::Draw to capture the entire client area (i.e., the browser canvas).
http://nirvdrum.com/2010/03/25/how-to-take-full-page-or-full-canvas-screenshots-in-windows.html
An actual implementation of the technique can be found in my SnapsIE repository on GitHub (username: nirvdrum). Unfortunately I don't have enough karma to post two hyperlinks. The repository is linked from the article though.
It is very likely an IE optimisation that avoid to draw more than required. You might be able to scroll the window and call IViewObject::Draw in a loop without any animation occuring ?
I'm surprised that Windows caps the max size to the current screen resolution. Are you sure about that ?