Printing a PDF using Brainy Data PDFDevice

malkishtini at gmail.com malkishtini at gmail.com
Thu Sep 2 20:03:16 UTC 2021


Hi Michael,

Thank you. You solved my issue..:)
This did trick, it changes the doc size to Legal regardless of the saved
report page setup.
Do lReportInst.$paper.$assign(kPaUsLegal)

Best regards,
Mayada

-----Original Message-----
From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of
Michael Mantkowski
Sent: Thursday, September 02, 2021 3:21 PM
To: 'OmnisDev List - English' <omnisdev-en at lists.omnis-dev.com>
Subject: RE: Printing a PDF using Brainy Data PDFDevice

Hi Mayada,

I use this...  This clears the Report Settings.  But you could use actual
values to set them up to the size you like.

cvReportName = Name of the report you are working with.

Calculate $reports.[cvReportName].$pagesetupdata as #NULL Calculate
$reports.[cvReportName].$orientation as kOrientDefault Calculate
$reports.[cvReportName].$paper as kPaDefault Calculate
$reports.[cvReportName].$paperlength as 0.0000 Calculate
$reports.[cvReportName].$paperwidth as 0.0000 Calculate
$reports.[cvReportName].$scale as 0 Calculate
$reports.[cvReportName].$copies as 0 Save class {[cvReportName]}

*********************************************************************
Michael Mantkowski
ClienTrax Software
1-614-875-2245
*********************************************************************


-----Original Message-----
From: omnisdev-en On Behalf Of malkishtini at gmail.com
Sent: Thursday, September 2, 2021 12:21 PM
To: 'OmnisDev List - English' <omnisdev-en at lists.omnis-dev.com>
Subject: RE: Printing a PDF using Brainy Data PDFDevice

Hi Michael,

Thank you very much for sharing your code..
I changed the paper size for my report class to be Legal and I added the
"Load page setup" to my code and that seems to do the trick.
But what I don't know yet if how I can change the paper on the fly? 
Say my API will expect a param to decide the paper size, so once it could be
letter and once legal, then in this case I need to know how I can change
this report property thru notation.

Below is the logic I'm using for printing to memory from the API:

  Begin reversible block
    Set report name rWorkOrder   
    If vPrinttoPDFFromAPI       
      Load page setup     ## added to load the page setting
    End If
  End reversible block

 If vPrinttoPDFFromAPI
    Set reference CurrentDevice to $cdevice
    Do $cdevice.$assign($devices.[kDevPdf])

    If vPDFDest='FILE'   ## Print to file using Omnis default print driver
      Calculate $cdevice as kDevOmnisPDF   ## Omnis pdf device
      Do Omnis PDF Device.$settemp(kTrue,10) Returns lID   ## save to temp
folder

    Else If vPDFDest='MEMORY'  ## print to memory using Brainy data printer
      Calculate vPrintToMemoryPath as
con($ctask().$fullname,'.$printToMemory(#)')
      Do $cdevice.$setparam(kDevPdfFileName,vPrintToMemoryPath)
    End If

    Do $clib.$reports.[vReportName].$open('*') Returns lReportInst  End If

  For each line in list from 1 to Lists.JobsList.$linecount step 1 
        Load from list 
          If vPrinttoPDFFromAPI 
            Do lReportInst.$printrecord()
          Else
            Print record 
          End If
   End For

I'm hoping that there is away to access the paper setting for the report
instance from > lReportInst, so I can change it on the fly.

Thank you,
Mayada
-----Original Message-----
From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of
Michael Mantkowski
Sent: Thursday, September 02, 2021 10:43 AM
To: 'OmnisDev List - English' <omnisdev-en at lists.omnis-dev.com>
Subject: RE: Printing a PDF using Brainy Data PDFDevice

Hi Mayada,

Normally your report would be set with a specific paper setting by default
and these settings would be saved with the report.

We normally print to memory and view the report in an Omnis Report Field on
a window before printing it or saving it as a PDF with PDF Device.  The
"Load Page setup" gets the saved paper settings from the report and sets
them up for this print.  I also have a whole set of generic report formats
setup to just store page settings for various categories of reports so that
I can use its printer and papers settings for 95% of my printing methods.
If I want my invoices to go to a specific printer with letter size for
example but want my daily reports to go to another printer and print in
landscape format.



;Print Report
Calculate $cdevice as kDevMemory
Set report name MyReport
Begin reversible block
    Load page setup
End reversible block
Print report
Open Preview Window


; Save to PDF
Do FileOps.$putfilename(ivPDFfile,'Save As',con('*','.pdf'),ivPDFfile)
Returns #F If flag false
    Quit method
End If
;  Get final location
Do FileOps.$splitpathname(ivPDFfile,lvDrv,lvDir,lvFile,lvExt) Returns
lvError Do code method CodeClass/SaveLastPDFPath (con(lvDrv,lvDir))

Begin reversible block
    Calculate $cdevice as kDevPdf
End reversible block
Do $cdevice.$setparam(kDevPdfConvLinks,kTrue)
Do $cdevice.$setparam(kDevPdfFileName,ivPDFfile)

Do $cinst.$objs.ReportField.$redirect(kFalse) Returns lvError


*********************************************************************
Michael Mantkowski
ClienTrax Software
1-614-875-2245
*********************************************************************


-----Original Message-----
From: omnisdev-en On Behalf Of malkishtini at gmail.com
Sent: Thursday, September 2, 2021 10:23 AM
To: 'OmnisDev List - English' <omnisdev-en at lists.omnis-dev.com>
Subject: RE: Printing a PDF using Brainy Data PDFDevice

Hi Phil,

Thank you for your response.
I found this page property on the report and on the $root of Omnis as well
and I figured that this might be what I need to change at runtime.
I have to play with it and see how to change it based on user pref.

Thank you and best regards,
Mayada

-----Original Message-----
From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of
Phil (OmnisList) via omnisdev-en
Sent: Thursday, September 02, 2021 9:41 AM
To: omnisdev-en at lists.omnis-dev.com
Cc: Phil (OmnisList) <phil at pgpotter.co.uk>
Subject: Re: Printing a PDF using Brainy Data PDFDevice

Hi Mayada,

For Omnis reports, you set the page setup to what you want on the individual
report...
in Property manager
So I guess paper would be set to kPaUsLegal ?

not forgetting to load page setup before printing.

You could probably set it via notation before the instance is generated, if
it changes...

I tend to use oWrite these days, so slightly different, but still you set
the page paper size within the report in oWrite as well.

regards
Phil Potter
Based in Chester in the UK.

On 02/09/2021 13:35, malkishtini at gmail.com wrote:
> Hello all,
> I'm using Brainy Data PDFDevice to print an Omnis report to a PDF in
memory in studio 10.
> The PDF document that gets created will always be in "letter" size, is
there a way to change the paper size of the created doc to "Legal" when
printing from an API?
>
> Thank you,
> Mayada
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com Start a 
> new message -> mailto:omnisdev-en at lists.omnis-dev.com

_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com Start a new
message -> mailto:omnisdev-en at lists.omnis-dev.com 

_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com Start a new
message -> mailto:omnisdev-en at lists.omnis-dev.com 

_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com Start a new
message -> mailto:omnisdev-en at lists.omnis-dev.com 

_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com Start a new
message -> mailto:omnisdev-en at lists.omnis-dev.com 

_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com Start a new
message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list