PDFInclude - pdf_new_page2 problems

rairch

New Member
Progress v9.1D
PDFInclude v3.3.3

Hi All,

I'm being driven up the wall by a problem with pdf generation. I have a WebSpeed app which creates an expenses claim. The Finance department require that I can print a nice form out from it after the claim has been submitted so that receipts can be attached and posted to them & want hte form to look as much as possible like the orignal excel spreadsheet they currently use (so that rules html out)

Hence I have used adobe distiller to create a 3 page pdf document from the original spreadsheet & have spent many an enjoyable hour mapping form fields onto it.

I have then written print functionality using PDFInclude & Streamfile in order to output it to a javascript opened window from my print button (never having used PDFInclude or Streamfile until last thursday this has also been fun.....)

In my program I use the standard functionality to create the new pdf & find the template as follows:

/* Set Export path & filename */
lcfilename = "PDF/" + ttExpnExpenseHeader.claimref + ".pdf".

/* create new pdf document */
RUN pdf_new ("expnpdf", lcfilename).

/* open expenses pdf template */
RUN pdf_open_PDF("expnpdf","expn/pdf_templates/HomeExp.pdf",ttExpnExpenseHeader.claimref).

/* set standard font for output to pdf */
RUN pdf_set_font("expnpdf", "Helvetica", "8").

Then I create the first page & output lots of pdf_fill_text to map to the form fields on my template:

/* create first page */
RUN pdf_new_page("expnpdf").
RUN pdf_use_PDF_page("expnpdf",ttExpnExpenseHeader.claimref,1).

<pdf_fill_text>

/* create second page */
RUN pdf_new_page("expnpdf").
RUN pdf_use_PDF_page("expnpdf",ttExpnExpenseHeader.claimref,2).

This works fine for the first & second pages of the pdf. However the third page is in landscape format & it doesn't display properly.

Having fiddled about with it for a the last day I have discovered the following:

1. Using pdf_new_page("expnpdf") - page generates as landscape but field mapping is incorrect (seems to be trying to map to portrait)

2. Using pdf_new_page2("expnpdf","landscape") - page generates as portrait?!? but with chopped off landscape layout + field mapping still incorrect

3. Using pdf_new_page2 ("expnpdf","portrait") - page generates same as using pdf_new_page...

4. Using pdf_set_orientation("expnpdf","landscape").
pdf_new_page2("expnpdf","landscape"). -page generates as landscape but field mapping is incorrect (seems to be trying to map to portrait)

5. Using pdf_set_orientation("expnpdf","landscape").
pdf_new_page2("expnpdf","portrait"). - page generates as landscape but field mapping is incorrect (seems to be trying to map to portrait)

I've tried pretty much every combination I can think off & nothing seems to work. As the fields don't map correctly I wonder if it could be anythign to do with the pdf template. I distilled the two portrait pages seperately fro mthe landscape them merged the two pdf's as they were on seperate worksheets in the excel.

Anyone have any ideas as this is driving me crazy?

Cheers,

Simon.
 

rairch

New Member
Thanks for the suggestions guys,

I've worked around the issue now by using pdf_text_xy for every field on the landscape page (hours of mapping coordinates fun.....:( ) as it just doesn't seem to want to work with a landscape template.

From the emails I received from PEG is seems that other people have found this problem too but if anyone has a way round it please tell me (I don't want to have to maintain this page hence I've left the form fields on in the hope someone knows what's wrong :confused:

Cheers!
 

Biga

New Member
Landscape form field solution:

Open pdf_inc.p and find ProcessFillText procedure.

a) case otherwise, tt_object.rotate = 90

when calling OutputTextContent: replace entry(4,.. to entry(2 and replace entry(3,... to entry(1

b) all occurences of OutputTextContent in this procedure:

replace DEC(ENTRY... TO string2dec(entry...

The first problem is a light positioning problem but the second is fatal on Progress installations with European numeric format because DEC will convert numeric point to thousands and results incorrect coordinates when positioning form fields.

If you haven't string2dec function in your release, use Peter Kiss's function:

FUNCTION string2dec RETURNS DECIMAL (INPUT stringvalue AS CHARACTER): /* PRIVATE */
IF SESSION:NUMERIC-FORMAT = "EUROPEAN" THEN
RETURN DEC(REPLACE(stringvalue,".",",")).
ELSE
RETURN DEC(stringvalue).
END. /* string2dec */

Finally, don't use pdf_new_page2 but call pdf_set_Orientation with Landscape before using the template.

cheers
Biga, SzDA
 
Top