Page 1 of 1

Printing from Code

Posted: Thu Feb 16, 2012 7:59 am
by fiscal
Hi Craig,

I had been printing a RTF letter from a Clarion RTF control, but the RTF print methods do not recognise margins, so instead of using the RTF control to do the printing I though I could print the page from the PDF document that I create when I add the letter as a page to an existing PDF file. I create a docunment from RTF and merge it. The PDF page DOES recognise the margins, but how do I code the print? PrintDocument has docId and a group. However, I cannot find the group, or do not know what it is called to pass it to the printdocument method.

I am a bit tiered today, so all help gladly received :wink:

Re: Printing from Code

Posted: Thu Feb 16, 2012 4:07 pm
by Tracker - Clarion Support
Hi!

Please check PDF-XViewerAx20_CW.pdf, pp. 66 and onward for a description of the PrintSettings GROUP and its fields. PrintSettings is defined in PDFXCviewAx_class.inc. That should be all the information you require to get PrintDocument to work.

What you can do is to create an instance of PrintSettings:

Code: Select all

MyPrintSettings  GROUP(PrintSettings).
Then do the following:

Code: Select all

PCXVAX1.GetPrintSettings(MyPrintSettings) ! preloads MyPrintSettings with default settings
!*** Make changes to MyPrintSettings here
PXCVAX1.PrintDocument(DocID, MyPrintSettings)
Change the names to match your own app's values.

Re: Printing from Code

Posted: Thu Feb 16, 2012 10:21 pm
by fiscal
Thanks Craig,

I was dead on my feet yesterday and could not think straight.

Tony

Re: Printing from Code

Posted: Thu Feb 16, 2012 10:46 pm
by Paul - Tracker Supp
:)

All is good then?

Re: Printing from Code

Posted: Fri Feb 17, 2012 3:51 am
by fiscal
"What you can do is to create an instance of PrintSettings:" - This is what I missed. Once shown it all came back.....

I do not have a copy of the pdf file quoted above only the help file. Where can I get it?

Thanks

Tony

Re: Printing from Code

Posted: Fri Feb 17, 2012 9:30 am
by Tracker Supp-Stefan
Hello Tony,

Looking at the name - this is a clarion specific manual so it should be in the latest builds of the clarion installation packages on our website.

Best,
Stefan

Re: Printing from Code

Posted: Fri Feb 17, 2012 12:14 pm
by Tracker - Clarion Support
Hi Tony!

My bad! Look for PDF-XViewerAx20_CW.chm instead, topic PrintDocument and related.

Re: Printing from Code

Posted: Fri Feb 17, 2012 2:32 pm
by fiscal
Yep, I did not think version 3 had come out yet :wink:

Re: Printing from Code

Posted: Fri Feb 17, 2012 2:33 pm
by Tracker Supp-Stefan
Not yet Tony,

The end user version will be released on 31 May, and the SDK will follow in June.

Best,
Stefan

Re: Printing from Code

Posted: Sun Jun 24, 2012 1:44 am
by Tracker - Clarion Support
Hi Tony!

Thanks to Rocky Phelps, we have a solid workaround for the PDF-to-paper problem, using silent printing.

The key is to use the End-User Viewer capability in its Free mode.

Please look for the following manual: C:\Program Files\Tracker Software\PDF Viewer\Help\PDFVManual.pdf. It may be in a different folder but should be there.

Look at 1.8. Command Line option on page 18, which will show how to format a command line that will work through Clarion RUN() command.

Rocky generated the following code which he says works fine in his program:

Code: Select all

PrintFiles    ROUTINE
  DATA
P           LONG
DocID       LONG
 
  CODE
  LOOP P = 1 TO RECORDS(List1:Queue)
    GET(List1:Queue,P)

    RunCmd = '"' & OPT:PathToPDFReader &'" /printto ' & '"' & clip(SelectedPrinter) & '" ' &             clip(List1:Queue.PdfFileName)

    RUN(RunCmd,1)
  END !LOOP
  Post(Event:CloseWindow)  ! To end the program

Printing from Code

Posted: Tue Aug 13, 2019 2:14 pm
by MariaUnerb
yes, actually im trying the aproach suggested by the admin create a windows service that listen a port where the web app sends the files folder and name, the service does the printing job and then notifies the web app when its done. Now im wondering if im using the global settings file for my printing job, when varios users connects, the pdf printer puts the job in queue? or does it need to use the runonce settings file im trying to avoid the use of impersonation in my win service.

Image:)

Re: Printing from Code

Posted: Fri Aug 16, 2019 9:25 am
by Tracker Supp-Stefan
Hello Maria,

You have posted in a topic from 2012, and I am afraid that our Clarion versions are no longer supported:
viewtopic.php?f=38&t=26297

Regards,
Stefan
Tracker