cocoa - Methods to render a PDF into a very high resolution NSImage bitmap file -
i have render pdf high resolution image (say , on 100,000 * 80,000 pixels).
i managed without going out of ram splitting render several slices , rendering each 1 using nsoperationqueue, drawing nsimage pdf representation new nsimage using drawinrect:fromrect:operation:fraction: , saving tiffrepresentation file.
all , multicore , fast , i'm happy. anyway i'd need join slices again after rendered them, obtain single tiff file.
i try merge files using nsinputstream , nsoutputstream since each file complete tiff representation, merging raw bytes result in unreadable picture file. there way merge image files without loading them ram, i.e. without using nsimage methods?
otherwise save raw pixel bytes instead of tiff representations , join them nsinputstream/nsoutputstream, how transform whole bytes file recognizable tiff without, again, loading huge thing ram?
this technique won't work extreme demands (see end of message more on that), other people higher res image pdf screenshot or snapshot acrobat tool. it's not particularly elegant, gets job done.
instructions based on acrobat 9 reader (earlier , later versions should work long have snapshot/"marquee select" tool) on windows xp. imagine applies on other platforms run adobe reader. (now think there alternative pdf display software can without tricks. maybe based on ghostscript?) in case, know works:
- zoom in on pdf until image on monitor has pixel resolution you're looking for. if you're trying capture image more pixels have on monitor (which reason use technique), be seeing portion of image on screen.
- scroll needed find corner of pdf want capture.
- select snapshot/"marquee select" tool.
- click corner, hold mouse button down (drag-select) , move mouse opposite corner of window.
- the screen start auto scrolling towards opposite corner of image. may take while, there.
- when opposite edge, take finger off mouse, , should have high-res image in clipboard.
now, depending on "size" of initial image (acrobat zoom 6400% of original size based on dpi information in pdf), technique theoretically allow 100k x 80k pixels. falls apart of today's pcs you'd need enough ram hold 22gb of image data in copy buffer...
Comments
Post a Comment