On Sunday, July 18, 2004, at 05:34 AM, Robert Purves wrote: > > Robert Covington wrote: >>>> The client now wants to expand the program to process >>>> the data files in a batch mode, so I need a way to save >>>> the report as a PDF file without any user intervention. >>> >>> In OS X, you just call PMSessionSetDestination at the appropriate >>> stage in the print setup, to indicate that you want to save to a >>> specified file. Your printing code is exactly the same as if you >>> were printing via the print dialog. >>> >>> SetupPrintToPDF in the demo below takes care of some unpleasant >>> details involving CFURLs and CFStrings, and passes the required >>> parameters to PMSessionSetDestination. >> >> What's the non-mangling way to set a corresponding printRect so that >> the whole image shows up if it is larger than a default page? > > toolbox fn PMSetScale( PMPageFormat pageFormat, double scalePercent ) > = OSStatus > > Insert additional code immediately after FBBeginSession in the > previously-posted demo > > ... > // added stuff to set scale > dim as double scale > // calculate required value of scale > scale = 50.0 // 50% for demo > err = fn PMSetScale( gFBPageFormat, scale ) > // must validate, otherwise PageFormat changes have no effect > err = fn PMSessionValidatePageFormat( gFBPrintSession, ¬ > gFBPageFormat, #_kPMDontWantBoolean ) > ... > > Your calculation of scale will be based on the dimensions of your > image Rect, and the page Rect which you can obtain like this: > > dim as PMRect pageRect > err = fn PMGetAdjustedPageRect( gFBPageFormat, @pageRect ) > > Robert P. Thanks RP...but...I meant whole image as in full size, not scaling. I need to be more clear... My hopes were that this would allow me to save my Full Size images in a Full Size PDF file. This appears to be illusion... one can only scale it to fit, or not. I do not want to scale the image, that's only helpful if wanting to print it, and I already have autosizing/auto-cropping code in place, per user choice. I need the exported image to remain its full size, so when somebody opens it up in Preview of my app afterward, they have the whole image again, not a scaled-to-page size new thing....if setting scale, then one just gets a larger or smaller image..if smaller, you see the whole thing...but you've lost all the pixels. If you scale larger, you get a portion of the image. I guess to save an image as a PDF in full size, and to use the format for such, one has to avoid the print manager which operates in PageRect land (and no way to set that to the actual image size?) and write the raw format per Adobe specifications, there doesn't seem to be a Quicktime route for this yet? I need whatever Apple is doing when it saves a screenshot at full size, to PDF, and I guess you can't take an image like that, and re-export it out as PDF and still have it be the same size via print manager. Robert