Generate fails - where to start?

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software, Andrew - Tracker Support, Tracker - Clarion Support, John - Tracker Supp, Support Staff, moderators

Post Reply
ARandallRBS
User
Posts: 41
Joined: Mon Oct 11, 2004 8:01 pm

Generate fails - where to start?

Post by ARandallRBS » Fri May 06, 2011 1:55 pm

Using Clarion 5b; PDF-Tools V3.6.

I have a client where the PDF Generate fails on her PC.

As far as I can tell all looks OK. Where should I start looking to diagnose the problem? Other users generate PDFs fine and it works fine in my office so I assume it's specific to her PC.

FWIW, seems to me the return code would be far more useful if you "inverted" the logic and returned 0 for success and a non-zero for an error. That way you could provide "hints" on what failed (e.g. 1=This error; 2=That error; 3=Another problem; etc). As it is a zero is "an error" and a non-zero is OK.

Al

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

Re: Generate fails - where to start?

Post by Tracker Supp-Stefan » Fri May 06, 2011 3:58 pm

Hello Al,

Is that problematic user using Win7? As the ver3 was designed long time before even vista was released so on a Win7 it could be causing problems.

Best,
Stefan

ARandallRBS
User
Posts: 41
Joined: Mon Oct 11, 2004 8:01 pm

Re: Generate fails - where to start?

Post by ARandallRBS » Fri May 06, 2011 7:20 pm

Further information: I can duplicate this at will on either WinXP or Win7 so it's not a Win7 issue.

If you generate a PDF document and then *immediately* attempt to generate the same document without waiting for a few seconds, the generate fails. If you generate a PDF document, wait say 10 or 15 seconds and then generate the document again, it works correctly. It *APPEARS* that there is some background process (Windows? Clarion? or PDFTools?) that must finish before you can generate the same document again. Does this make any sense to you?

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

Re: Generate fails - where to start?

Post by Tracker Supp-Stefan » Fri May 06, 2011 7:41 pm

Hello Al,

I am not sure whether this is available in ver3 of the SDK, but in version 4 you have an OnFileSaved event, which you could be listening for, and only once you get that notification start a new print job - this should resolve the problem you have now.

Best,
Stefan

ARandallRBS
User
Posts: 41
Joined: Mon Oct 11, 2004 8:01 pm

Re: Generate fails - where to start?

Post by ARandallRBS » Fri May 06, 2011 8:24 pm

Thanks for the suggestion.

This is a "self-inflicted" problem I'm afraid. The process first generates the PDF and then prints it asynchronously. The user pushes the "print" button twice in rapid succession to get multiple copies of the same document. The first "push" works fine; the 2nd "push" attempts to recreate the file which fails because it's still being printed from the first iteration. If they wait a few seconds for the first print to finish, they can then regenerate and print again.

Just need to add a "number of copies" option to the process to avoid the need to regenerate the document just to get multiple copies and problem is solved.

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

Re: Generate fails - where to start?

Post by Tracker Supp-Stefan » Fri May 06, 2011 8:33 pm

Hello Al,

Yep I guess that would be a better option. Even though getting more than once copy of a "PDF" print is a bit strange ;)

Please let us know how fixing this issue goes!

Best,
Stefan

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

Re: Generate fails - where to start?

Post by Tracker - Clarion Support » Sat May 07, 2011 12:21 am

Hi Al!
The process first generates the PDF and then prints it asynchronously.
I interpret that to mean that you are generating a PDF once, but then printing the PDF to hardcopy one or more times?

Do I understand this correctly?
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

ARandallRBS
User
Posts: 41
Joined: Mon Oct 11, 2004 8:01 pm

Re: Generate fails - where to start?

Post by ARandallRBS » Sun May 08, 2011 1:31 pm

No. Right now it generates once and prints once. If the user wants multiple copies for whatever reason, they generate and print repeatedly. The print occurs in a background task that is started when the application starts. This presents a problem when the 2nd generate attempts to run when the print has the PDF open. The 2nd generate fails of course since the PDF file is "in use".

To solve this problem I intend to generate once and print the PDF "n" times. I'm using PDFTools to print the PDF as well as generate. Not quite sure how to accomplish this but my first thought is to use Clarion's PROPPRINT:Copies property to accomplish. I do this already for setting the printer to be used.

Al

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

Re: Generate fails - where to start?

Post by Tracker - Clarion Support » Sun May 08, 2011 2:27 pm

Hi Al!

The "Generate-once-print-many" is the model to use. It should work well for your client.

However PDF-Tools has no "Print PDF to hardcopy" method. That's a Viewer function.
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

ARandallRBS
User
Posts: 41
Joined: Mon Oct 11, 2004 8:01 pm

Re: Generate fails - where to start?

Post by ARandallRBS » Sun May 08, 2011 6:14 pm

I don't have the source in front of me but whatever it is, it's a Tracker product that I'm using to print the PDF!

Is setting the PROPPrint:Copies for the printer device the best approach or perhaps some "Viewer" property or perhaps worst case a "loop n times"?

Al

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

Re: Generate fails - where to start?

Post by Tracker - Clarion Support » Sun May 08, 2011 10:42 pm

Hi Al!

Please check on how you are printing the PDF to hardcopy. That would condition how to print one or more copies.
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

ARandallRBS
User
Posts: 41
Joined: Mon Oct 11, 2004 8:01 pm

Re: Generate fails - where to start?

Post by ARandallRBS » Tue May 10, 2011 2:07 pm

Craig,

This is somewhat abbreviated but it's about this:

PDFXCV1 PXCViewBaseClass ! Added by PDF-Xchange Viewer Templates v3.7
Code
! Init the viewer
?Region1{PROP:Hide} = FALSE
DISPLAY()
PDFXCV1.Init()
PDFXCV1.SetDisplay(window, ?Region1)

! Load the file to print
IF ~PDFXCV1.ReadDocument(LP:PDFFileName) THEN
MESSAGE('Cannot read document ' & CLIP(LP:PDFFileName),'Document Error')
END

?PrintTo{PROP:Text} = 'Loading ' & LP:PDFFileName
PDFXCV1.SetFitTo(PXCV_FIT_BEST)
PDFXCV1.Refresh()

! Set the printer to whatever the user selected
PRINTER{PROPPRINT:Device} = LP:PDFPrinterName
PRINTER{PROPPRINT:Copies} = LP:PDFCopies

! Print the pdf
PDFXCV1.PrintDocument(PrintFitMode, PrintRotate, PrintVector)

------------------------------------------------------------------------------
The variables LP:PDFPrinterName and LP:PDFCopies are set elsewhere in the module. The correct printer is selected but so far I have'nt got the COPIES to work correctly. For some reason it only prints a single copy.

Al

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

Re: Generate fails - where to start?

Post by Tracker - Clarion Support » Tue May 10, 2011 3:02 pm

Hi Al!

The PDFViewerBaseClass does NOT print using the Clarion PRINTER system variable directly.

The printing is handled by the TSPPrinterClass. This uses the Windows Printer system internally. The only two parameters that are used from the Clarion PRINTER system variable are PROPPRINT:Driver and PROPPRINT:Device; otherwise the default parameters for the selected printer are used, which would be 1 copy.

For right now, to get you going, I suggest simply putting a "LOOP Copies TIMES" around the PrintDocument call.

I'll try to see if I can expand the parameters copied from Clarion PRINTER to allow using the ones that are accessible using PROPPRINT values.
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

TimothyPer
User
Posts: 6
Joined: Fri Jan 25, 2019 3:23 am
Location: Denmark
Contact:

Generate fails where to start

Post by TimothyPer » Sun Feb 10, 2019 5:55 pm

For a better understanding on the logic behind the procedural quests:
What do exactly means and whats the difference in different cases for:
- Generate quest on start
- Max quests:

on the quest generator settings.

Thanks,

Post Reply