Printing from Code

PDF-XChange Viewer SDK
Simple DLL and ActiveX

Moderators: Tracker Support, TrackerSupp-Daniel, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker Supp-Stefan

Post Reply
fiscal
User
Posts: 138
Joined: Fri Aug 06, 2004 12:09 am
Contact:

Printing from Code

Post by fiscal » Thu Feb 16, 2012 7:59 am

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:

Tracker - Clarion Support
Site Admin
Posts: 1412
Joined: Wed Jun 30, 2004 4:45 pm
Location: Maryland, USA
Contact:

Re: Printing from Code

Post by Tracker - Clarion Support » Thu Feb 16, 2012 4:07 pm

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.
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

fiscal
User
Posts: 138
Joined: Fri Aug 06, 2004 12:09 am
Contact:

Re: Printing from Code

Post by fiscal » Thu Feb 16, 2012 10:21 pm

Thanks Craig,

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

Tony

User avatar
Paul - Tracker Supp
Site Admin
Posts: 4906
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Printing from Code

Post by Paul - Tracker Supp » Thu Feb 16, 2012 10:46 pm

:)

All is good then?
_________________
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com

fiscal
User
Posts: 138
Joined: Fri Aug 06, 2004 12:09 am
Contact:

Re: Printing from Code

Post by fiscal » Fri Feb 17, 2012 3:51 am

"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

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13376
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Printing from Code

Post by Tracker Supp-Stefan » Fri Feb 17, 2012 9:30 am

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

Tracker - Clarion Support
Site Admin
Posts: 1412
Joined: Wed Jun 30, 2004 4:45 pm
Location: Maryland, USA
Contact:

Re: Printing from Code

Post by Tracker - Clarion Support » Fri Feb 17, 2012 12:14 pm

Hi Tony!

My bad! Look for PDF-XViewerAx20_CW.chm instead, topic PrintDocument and related.
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

fiscal
User
Posts: 138
Joined: Fri Aug 06, 2004 12:09 am
Contact:

Re: Printing from Code

Post by fiscal » Fri Feb 17, 2012 2:32 pm

Yep, I did not think version 3 had come out yet :wink:

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13376
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Printing from Code

Post by Tracker Supp-Stefan » Fri Feb 17, 2012 2:33 pm

Not yet Tony,

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

Best,
Stefan

Tracker - Clarion Support
Site Admin
Posts: 1412
Joined: Wed Jun 30, 2004 4:45 pm
Location: Maryland, USA
Contact:

Re: Printing from Code

Post by Tracker - Clarion Support » Sun Jun 24, 2012 1:44 am

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
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

MariaUnerb
User
Posts: 1
Joined: Tue Aug 13, 2019 12:27 am
Location: Greece
Contact:

Printing from Code

Post by MariaUnerb » Tue Aug 13, 2019 2:14 pm

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:)

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13376
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Printing from Code

Post by Tracker Supp-Stefan » Fri Aug 16, 2019 9:25 am

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

Post Reply