Use pdfkit to display a batch of pictures...

  • Hi everyone.
    I am wondering whether it is possible to use pdfkit to display lots of
    pictures?
    My application wants to show lots of CGImage to the users. After
    comparing several solutions including imagekit and so on, finally I
    chose the PDFKit to do that. (Maybe ImageKit browser view is a good
    choice, but it isn't fit for me.)

    Most of us have been used to use Mac OS X preview to open pictures and
    pdf files. So my exact goal is to create an application of the Preview-
    style to show my CGImage pictures, in other words, to replace the
    page(PDFKit page object) of a displayed pdf document with the CGImage
    object.

    There are the other questions plus:
    If we can use the PDFKit document model to display a batch of
    CGImages, then how to use the pdf built-in functions such as: Move
    \Select\Rotate\Scale\Zoom and so on? I have browsed the PDFKit
    programming document, however, the Select function( Which is very
    useful to focus on some special contents) seems to be without
    documented.

    Thank you very much for any suggestion or help.
    Best regards.
  • On Feb 21, 2008, at 1:30 PM, Leopard x86 wrote:
    > Most of us have been used to use Mac OS X preview to open pictures
    > and pdf files. So my exact goal is to create an application of the
    > Preview-style to show my CGImage pictures, in other words, to
    > replace the page(PDFKit page object) of a displayed pdf document
    > with the CGImage object.

    You can do this, but since you mention Preview, the Leopard version of
    Preview uses in fact the ImageKit view and ImageKit browser class
    (thumbnails)  for displaying images.

    > If we can use the PDFKit document model to display a batch of
    > CGImages, then how to use the pdf built-in functions such as: Move
    > \Select\Rotate\Scale\Zoom and so on?

    Zoom is built in to PDFView (-[PDFView setScaleFactor:].

    You can rotate a page by setting the rotation on the PDFPage and
    telling the PDFView to re-layout.

    Move is done by tracking the mouse in a PDFView subclass and calling
    scrollToPoint: on the clip view enclosing the PDFView's document view.

    Select is also done with a PDFView subclass.  Also handle the mouse as
    for tracking above, but in select mode you keep track of the selected
    area as a rectangle - in the PDFView subclass you can "post draw" on
    top of the PDF page in -[PDFPage drawPage:] and draw part of the page
    "darkended" or selected.

    The above is a little brief (no sample code) but is essentially what
    Preview does.

    There is sample code to show you how to subclass PDFView and handle
    your own mouse tracking, post-drawing, etc.

    John Calhoun—