×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

XFRX

XFRX

(OP)
XFRX allows appending one PDF after another one, however this only seems to be catered for by having a different report for each time. I need to generate a whole bunch of PDF files appended to one in a loop using the same form. Is this possible? TIA, John

RE: XFRX

Hello John,

The way to do this is to add NOPAGEEJECT to your REPORT FROM command. Do that for for all the individual reports except the last.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: XFRX

(OP)
Hi Mike, thanks but I get that. The problem is that it is based on the report form not the PDF file name, so to generate hundreds of pdf's to append I would have to have a different report form for each PDF generated.
REPORT FORM report1 OBJECT m.loSession NOPAGEEJECT
REPORT FORM report2 OBJECT m.loSession
So I would have to create reports forms Report3, Report4, Report5 and so on. Even in a loop and adding a numbered extension by copying each report form from the first one and adding the number to the JustFName I think it would likely break it.
Cheers, John

RE: XFRX

Can you not do it by setting a printjob/endprintjob?

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: XFRX

(OP)
Not sure how that works Griff

RE: XFRX

From the help...

Quote:


PRINTJOB ... ENDPRINTJOB initializes the printer and certain system variables that affect printed output. It can send control codes to the printer, eject a page from the printer before and/or after a print job, initialize the printer column number, and control the number of copies printed.

PRINTJOB performs these tasks:

Sends starting printer control codes, stored in the system variable _PSCODE, to the printer. For more information on printer control codes, see the System Variables Overview topic and your printer manual.

Ejects a page if the system variable _PEJECT is set to BEFORE or to BOTH.

Sets the system variable _PCOLNO to 0. _PCOLNO stores the printer column number.

ENDPRINTJOB performs these tasks:

Sends ending printer control codes, stored in the system variable _PECODE, to the printer. You can reset the printer to the configuration it had before PRINTJOB was issued.

Ejects a page if the system variable _PEJECT is set to AFTER or to BOTH.

Loops back to PRINTJOB to print another copy of the report if the _PCOPIES system variable is set to a value higher than 1 (the default). The value of the system variable _PCOPIES determines the number of copies. When the number of copies printed equals the value of _PCOPIES, Visual FoxPro exits the loop. Program control then begins with the command immediately following ENDPRINTJOB.

PRINTJOB and ENDPRINTJOB may be executed only from within a program. You may not nest PRINTJOB ... ENDPRINTJOB commands.

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: XFRX

(OP)
Thank you but I am not sure how this has anything to do with XFRX appending a PDF on to another PDF

RE: XFRX

I was thinking you could put your report form commands within a printjob/endprintjob section
thus string them all together.

I don't understand why you need to use a different name for each one, unless they have different criteria or layout

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: XFRX

John, can you explain in a little more detail why you "would have to create reports forms Report3, Report4, Report5 and so on."

Put another way, what is different between these different reports? Are they in fact all the same report - that is, the same layout, etc. and based on the same FRX - but with different data each time? If so, I don't understand why you need to have Reprt3, Report4, etc.

I am just now looking at some code I wrote a few years ago. The code generates a PDF which consits of a bunch of invoices which are all addressed to the same customer. The code looks roughly like this:

CODE -->

SCAN <the customer table>
  SCAN <the invoice table> FOR <the current customer>
    *Prepare a cursor for the current invoice
    ...
    IF <this is the last invoice for this customer>
      REPORT FORM Invoice OBJECT loXFRX
    ELSE
      REPORT FROM Invoice NOPAGEEJECT OBJECT loXFRX
    ENDIF
  ENDSCAN
ENDSCAN 

Is this anything like your scenario?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: XFRX

(OP)
Because apparently XFRX uses different report forms
to activate the append see the forms 1 and 2 below. So the forms have to have different names. The code below allows one append, I am just trying to figure out how to make this many appends on the one PDF

CODE -->

loListener=XFRX("XFRX#LISTENER") 

USE demoreps\invoices ORDER customer
LOCAL m.loSession, m.lnRetval
m.loSession = XFRX("XFRX#LISTENER")
m.lnRetval = loSession.SetParams("output.pdf",,,,,,"PDF")
IF m.lnRetval = 0
   REPORT FORM report1 OBJECT m.loSession NOPAGEEJECT
   REPORT FORM report2 OBJECT m.loSession
ELSE
   ? m.lnRetval, m.loSession.ErrorMessage(m.lnRetVal)
ENDIF 

RE: XFRX

Hello,

maybe not exactly what you are looking for, but maybe it helps.

For a monthly summary we have to combine several dozens of pds into a combined one.

We use http://www.a-pdf.com/merger/cmd.htm for that, the gui version is free.

Regards
tom

RE: XFRX

Sorry, John, but I still don't get it - especially the point about the forms (reports?) having to have different names. I don't see why that's required.

That said, the utility that Tom recommended looks like it could be a good solution for you. It has a command-line version, which means it can be run from within VFP without the user needing to be aware of it.

In addition, some PDF drivers have a facility for appending successive PDFs together. Some years ago I used a driver called Docucom which offered that feature and which worked very well. I don't know if it still exists, but it's likely other products have a similar feature.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: XFRX

I think it is because each has different criteria, different invoice numbers or some such.
John perhaps does not know which parameters to specify or how?

CODE

LOSESSION.PROCESSREPORT("TRANSMIT","MYTABLE.ISSUREF=M.ISSUREF") 

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: XFRX

(OP)
THanks for all the suggestions, sleeping on this I have a few ideas starting to gel. In any case thanks Tom for your suggestion which looks like a good alternative to trying to use the APPEND in XFRX if I can't make that work. Cheers, John

RE: XFRX

there is also an option in XFRX to append output to an existing PDF document.

Link

hth

n

RE: XFRX

(OP)

Thanks to all especially Nigel because appending to an existing PDF is simple. Here is an example which also gives options for inserting at page numbers

CODE -->

*// Options using SetParams()
 *AppendToFile (Logical)
 *Specifies whether the generated document will be appended to an existing file. This parameter can be either logical, numeric or a string, with the following meaning:
 * .F. An existing document will be overwritten 
 * .T. The generated report will be appended at the end of the existing document

 *Numeric
 * 0 An existing document will be overwritten
 * nnn (Page number) The generated report will be inserted to the existing document at the given page number.
 *String “R” The page will be replaced with the generated report.
 * “R:”  The page range will be replaced with the generated report.
 *“R4:8”  The generated report will be inserting between pages 3 and 9, replacing pages 4,5,6,7 and 8.

*// Example: The TEST.FRX report will be appended to the existing TEST.PDF document. If the TEST.PDF file does not exist, it will be created.
 Oxfrx = XFRX("XFRX#LISTENER")
 lnRetVal = Oxfrx.SetParams("test.pdf",,,,,,"PDF",,,,.T.)
 IF lnRetVal = 0
 REPORT FORM test object oxfrx
 ENDIF

REPORT FORM test object oxfrx NOPAGEEJECT
REPORT FORM Generic object oxfrx 

RE: XFRX

(OP)
Still can't make this work
I am trying to append a series of reports into one PDF using a loop. The code below scans through an invoice header file and selects an item cursor to produce each report on the report form Test. It runs but for some reason doesn’t add anything to the original PDF (Invoices.pdf). I couldn’t find an example using a loop like this. Could you please help

CODE -->

Oxfrx= xfrx("XFRX#INIT")
Oxfrx=oXFRX("XFRX#LISTENER")

SELECT Invhdr
SCAN
*// Get items from a child table here
*// Select the child table
lnRetVal = Oxfrx.SetParams("Invoices.pdf",,,,,,"PDF",,,,.T.)
IF lnRetVal = 0
REPORT FORM Test object oxfrx NOPAGEEJECT
ENDIF
SELECT Invhdr
ENDSCAN
Oxfrx.Finalize()
Oxfrx.Release 

RE: XFRX

John,

I'm not sure about this, but there are two possible issues.

First, normally when you use NOPAGEEJECT, you need to do so for each report except the last. So you would normally do your REPORT FORM within the loop, using NOPAGEEJECT, then do another REPORT FORM outside the loop, without the NOPAGEEJECT.

You might try doing that here. But, having said that, the XFRX docs indicate that you don't use NOPAGEEJECT at all when appending to PDFs. This is the sample code that the docs show:

CODE -->

LOCAL m.loXFRX, m.lnRetVal
m.loXFRX = XFRX("XFRX#LISTENER")
m.lnRetVal = m.loXFRX.SetParams("test.pdf",,,,,,"PDF",,,,.T.)
IF m.lnRetVal = 0
   REPORT FORM test OBJECT m.loXFRX
ENDIF 

Source: https://eqeuscom.atlassian.net/wiki/spaces/DOC/pag...

This looks similar to your own code, but without the NOPAGEEJECT. So that might be something to try first.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: XFRX

(OP)
No that didn't make any difference, but I will try doing one outside the loop
Thanks

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close