Working with PDF: Load it and put it in the Clipboard

Hi,

I originally wanted to ask about how to place a pdf file into the clipboard and once I finished the question, I got the idea of the answer, watch the code below:

To use it, add a Canvas in a window and name it ClipPDF

[code] // Copy the loaded pdf into the clipboard…
// … and place a copy in a Canvas !
Dim ClipPDF As New Clipboard

Dim OpenDlg As New OpenDialog
Dim OpenFI as FolderItem

OpenDlg.Title = “Select a PDF file”
OpenDlg.Filter = FTImages.PDF
OpenFI = OpenDlg.ShowModal()
If OpenFI = Nil then
// User Cancelled, stop here
Return False
End if

// Fills the Clipboard with the PDF…
ClipPDF.Picture = Picture.Open(OpenFI)
// … and place a copy into cPDF (a Canvas)
cPDF.Backdrop = Picture.Open(OpenFI)

// This code store the PDF file contents into the Clipboard
Dim MB As MemoryBlock
Dim MBLen As Integer
Dim OpenBS As BinaryStream

// Get a BinaryStream reference
OpenBS = BinaryStream.Open(OpenFI)

// Store the PDF inside the MemoryBlock
MBLen = OpenBS.Length
MB = New MemoryBlock(MBLen)
MB.StringValue(0,MBLen) = OpenBS.Read(MBLen)

// Store the PDF file contents into the Clipboard
ClipPDF.AddRawData(MB.StringValue(0,mb.Size),“com.adobe.pdf”) // UTI for PDF

// Close / Nil the Clipboard instance
ClipPDF.Close
ClipPDF = Nil

// Close / Nil the FolderItem/BinaryStream instances
OpenFI = Nil
OpenBS = Nil

// Handled !
Return True[/code]

Now, what I have to do is to get the objects from the PDF contents… with Xojo.

I have not the start of an idea on how to do it, but I know it is possible to do that. I have a website who allows that; it is possible to do that with Adobe Illustrator, EasyDraw allows that too and of course (not tested) Acrobat Pro (from Adobe).

The idea (on Illustrator and EasyDraw) is to unlock the drawers and get the one you want.

Any idea on how to do that in pure Xojo is welcome.

BTW: I forgot the original idea (why I wanted to do that; the idea behind the code !).