App design help needed

The thing I find most useful about Interfaces is that they become a new datatype. Given your Serialization interface, you might have a generic routine that sends an object through a socket using some special protocol. You don’t want to have to write special code for each type of object, so you make each object implement the Serialization interface and write one routine to handle the funky protocol.

sub BeamMeUp(theObject as Serialization)
   dim theData as String = theObject.getValue
   // do the magic dance here to send the data
end

You can pass any object that implements the interface to the method, regardless of its real Super.

Well, if you are trying to do any advanced vector graphics cross platform that needs to be rendered to the screen, saved to PDF and saved to and image (multiple output devices ) you will need consistency across the vector drawing APIs. Core graphics has a built-in tech for drawing to multiple output devices that DynaPDF lacks. Using abstract class on stop of both core graphics and DynaPDF will allow faster future development because you will mostly write to the common API you built sitting on top. I said to use core graphics on the Mac because Sam said he would drawing to multiple output devices because of this it would rule out most benefits of using DynaPDF on the Mac but windows would be fine. The dynaPDF route will not work on iOS either. If he’s using abstract class he will be able modify it when iOS target arrives for Xojo.

[quote=51756:@Sam Rowlands]Getting PDF on a Mac is actually very easy, even in Xojo. This is first gen code, so it’s a little rough around the edges. The function returns a string, if it’s empty, the function worked, otherwise it returns the error message.

With this code, you do all the drawing in your canvas using Xojo’s Graphics functions (no need for CG) and it handles the rest for you. If you want more control, then you need to look at NSPrintOperation.

[code] Shared Function exportCanvasAsPDF(inCanvas as canvas, inFile as folderitem) As string
Dim errorMessage as string

#if TargetCocoa then
// - To create a PDF on OS X from a Xojo canvas, we’re sending the “dataWithPDFInsideRect” message to the underlying NSView.
// In order to do that, we also need to figure out the ‘bounds’ of the NSView, which is different to the ‘frame’ or the Xojo dimensions.
// Then once we have the PDF data, it comes in the form of a NSData object, so we extract that data into a memoryBlock and then dump it to disk. …
[/code][/quote]

Why is the exported PDF bigger than the original? (OSX 10.10.2)

Is Preview showing at 100% (sometimes it scales up and down to fill the window). Otherwise, I’m not sure.

I’ve figured it out, I must set - 1 pixel is 1 screen pixel in Preview