[futurebasic] Re: [FB] Saving File as PDF

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2004 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Mon, 19 Jul 2004 18:55:22 +1200
Robert Covington wrote:

>>>>>  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
>>>
>>> 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
>
> Thanks RP...but...I meant whole image as in full size, not scaling.
>
> 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.

Well, I don't think scaling actually loses anything.  You can Zoom In, 
in Preview, and all the pixels are there, not squished or blurred. But 
I see that the image is embedded in a printer-page-sized area.

> I need whatever Apple is doing when it saves a screenshot at full 
> size, to PDF

Ah, now I understand.  This seems to do what you want (it gives a pdf 
with properties identical to what you get from capture-screen-to-file 
Cmd-Shift-3).

toolbox fn PMSetUnadjustedPaperRect( ¬
    PMPageFormat  pageFormat, ¬
    const PMRect *paperRect ) = OSStatus

Insert additional code immediately after
  CFRelease( destCFURL )
in the originally-posted demo:

dim as PMRect    pageRect
pageRect.left   = 0
pageRect.top    = 0
pageRect.right  = system( _scrnWidth ) // 1900 // whatever
pageRect.bottom = system( _scrnHeight ) // 840 // whatever
err = fn PMSetUnadjustedPaperRect( gFBPageFormat, pageRect )

Robert P.