Page 1 of 1

Trying to get started

Posted: Wed Jan 31, 2007 5:23 pm
by PeterGibson
Just trying to use docpdf36.app and it will not save the test.doc as a pdf...
I need to evaluate how to convert a bunch of different file types and thne make my own report presentation... office2pdf works fine for me but the client wants internal page number cross references.. so I am evaluating to see if I can do it......

Ok I loaded installed the printer and things got better.... : :shock:

How do I add a footer to each page and add continous "page of page " numbers?

Posted: Wed Jan 31, 2007 8:49 pm
by John - Tracker Supp
Hi Peter,

Assuming you are converting various MS Word doc's to PDF using the driver and merging them into one - the simplest thing is to complete this process - then after PDF creation and saving - re-open the file and apply a watermark to create the footers and page numbers as required - simply saving the incremental page number to a variable as you go.

Please see page 36 of the manual (PDFToolsCW36.pdf) for more detailed info on adding a watermark to a page.

HTH

Posted: Wed Jan 31, 2007 8:53 pm
by Tracker - Clarion Support
Hi Peter!

Amplification of what John said:

You would create a separate Text Watermark for each page, containing text like "Page 10 of 20".

Works a treat!

Posted: Thu Feb 01, 2007 5:01 pm
by PeterGibson
Thank you both for the direction... are there any example apps that could jumpstart my testing?

Posted: Thu Feb 01, 2007 7:12 pm
by Tracker - Clarion Support
Hi Peter!

Not right this second, but I'll try to create one today. :)

Posted: Thu Feb 01, 2007 9:38 pm
by Tracker - Clarion Support
Hi Peter!

Attached is a small program demonstrating multiple PDF merging with "Page of Pages" watermarking. You will notice a "Page of Pages Watermark" has been added to the screen. Check that and the Page of Pages Text Watermarks will be generated in the lower left corner of each page.

The interesting bits are in the MergeFiles ROUTINE, lines 80-84. It's a simple loop counting from 1 to the total number of pages in the merged PDF file. Line 82 is where the really interesting stuff happens:
  • 1. PDF1.AddWatermarkAsText(
    2. 'Page '&I&' of '&PDF1.PagesNumber()
    3. 'Arial'
    4. 12
    5. TextRenderingMode_Fill
    6. 0.0
    7. 0
    8. 0
    9. PlaceType_Range
    10. PlaceOrder_Background
    11. TextAlign_Left+TextAlign_Bottom
    12. 18
    13. -18
    14. 255
    15. I
    16. )
I've taken the liberty of splitting it into separate lines for each of the parts and numbering them.

1. Method call

2. The Text String for the Watermark. This is where "Page x of y" is generated; in this case x is I (the page number) and y is the total number of pages in the PDF file.

3. Font name. I chose 'Arial' as it's a common font.

4. Font size, in points - I chose 12-point.

5. Text Rendering Mode - this is from a table in the pxclib35.chm.

6. Font Line Width - only applies to Stroke type Text Rendering Mode.

7. Color - standard COLOREF value, 0 = black.

8. Angle - Text WM can be placed at angles across the page - I chose 0 so it's just standard.

9. Placement Type - PlaceType_Range lets you select page number for Watermarks. Other Placement Types cause other effects, such as all pages, odd pages, even pages, etc.

10. Placement Order - PlaceOrder_Background makes the page text overwrite the watermark is they "collide". PlaceOrder_Foreground puts the watermark "over" the page text.

11. Text Alignment - where the watermark text appears on the page. TextAlign_Left+TextAlign_Bottom means lower left corner.

12-13. Horizontal and Vertical offsets in points (72 points/inch) from the Text Alignment position. I "indented" 18 points (.25 inch) from the left and -18 points from the bottom.

The combination of Text Alignment and Horizontal and Vertical offsets allows you to be quite creative in placing the watermarks as desired.

14. Opacity - runs from 0 (completely transparent=invisible) to 255 (completely opaque).

15. Page Number - only applies when PlaceType_Range is in effect. I is the value from the loop, of course.

16. Closing parenthesis.

Hope this gives you a "leg up" on your application!

Posted: Fri Feb 02, 2007 3:03 am
by PeterGibson
The help has been great... Thanks so very much...

New Problem...using docpdf36.app and an excel workbook with several sheets/tabs. the application only prints the first sheet?

How do I print the entire workbook to a single PDF?

Posted: Fri Feb 02, 2007 11:02 am
by Tracker - Clarion Support
Hi Peter!

This is really an "Excel problem" not a "PDF-XChange problem" as such.

I'm not that familiar with the inner workings of Excel, but I suspect that you'd have to somehow set the default print for the workbook to be "select all pages" and then it would print that way. Or perhaps load an add-in....

I've put in a request to see if another of our developers might be able to help.

Posted: Fri Feb 02, 2007 12:31 pm
by John - Tracker Supp
Hi Peter,

the way we achieve this as I recall is to simply 'loop' around until all sheets have been printed - but to be honest we are a long way from experts in office - the best place to look is on the MSDN Office developers web site - it offers a great deal of info - heres the link.

http://msdn2.microsoft.com/en-gb/office/default.aspx

Of course if you really want to push the boat out - you might want to consider Capesofts Office Inside templates with which we are compatible and we do work with Capesoft when issues are reported or found.

Sorry could not help more.

Posted: Fri Feb 02, 2007 4:21 pm
by PeterGibson
Your "Office2PDf" product works fine. Can you tell me the trick used there?

Posted: Fri Feb 02, 2007 9:10 pm
by John - Tracker Supp
Hi Peter,

as I recall we created a simple loop to select and print each sheet in turn - however I cannot be more specific until Monday when our Project DEV for Office2PDF is back in the office I am afraid.

Also I believe to achieve this he used the MS Office COM object - which will provide much greater versatility and control - but we provide no means ourselves to do the same Peter within our PDF SDK's - which is why I suggested you take a look at Capesofts Office Inside product which will give you this and interface with our products to give you the complete solution - though I do appreciate this means two 3rdparty purchases rather than just one and cost/budget for each project is always an issue I accept.

However I will ask him to give me the outline of what he did and pass that on just as soon as he is back in the office.

thanks.

Posted: Fri Feb 02, 2007 10:11 pm
by PeterGibson
Thank you. I can wait until Monday...

Infact the excel part is the guts of the project. I need to merge many
files, find "bookmarks" and add their page references to the excel sheet then print that excel workbook (many sheets) to PDF and included it in the report package! I am using EasyExcel for the excel interface.

Posted: Sat Feb 03, 2007 11:06 am
by John - Tracker Supp
Hi Peter,

Sounds pretty involved - I dont know EasyExcel - but hopefully our man can at least give you some pointers.

cheers

Posted: Tue Feb 13, 2007 4:27 pm
by PeterGibson
1) Any new thoughts on printing an excel workbook?

2) The Demo of Office2PDf doesn't seem to do the "automatic watch this folder and convert at will" thing that I expected it to do.

3) Can you drive Office2PDF with command line prompts?

Posted: Tue Feb 13, 2007 9:11 pm
by John - Tracker Supp
Hi Peter,

Apologies - I forgot to follow this up and will chase the responsible project dev tomorrow for the requested info - however to answer you other questions - :

2: It should do if set up correctly - saved new files to the watched folder in a compatible office format will convert automatically to PDF - provided always Office exists on the client PC as well.

3: No - sorry - this is no accident and is done in an effort to ensure single licenses are used for single users and it would be all to easy to script a commmand line to be used outside of the license parameters.

However V4 will have a server version and license and a command line option when available.

HTH

Posted: Tue Feb 13, 2007 9:42 pm
by PeterGibson
2) ok. so a watched folder cannot be a novel network drive?

Posted: Wed Feb 14, 2007 9:16 pm
by John - Tracker Supp
Hi Peter,

2: All network drives must be mapped to a local drive with full read/write access.

Regarding the general point - this is how our Project dev explains the process used in OFFice2PDF:
Excel naturally prints every sheet of a document as a separate task/print job.

Therefore it is possible that pages will be in a random order based on the time taken to print.

To resolve this and other potential problems, all workbooks must be enumerated and printed one after another.

We use the MS Office COM object - "Excel.Application" to do this.

After the instance of the object is created and the source document is opened, to retrieve the workbooks object using the Workbooks property.

Then Launch the 'print' operation for every item in the 'workbooks' sequence with one caution - 'print' for the next workbook job must be started only after the previous printing job is complete

We use Windows messages from the PDF printer to detect the start and finish stages of the operation.

After every successful/unsuccessful operation - the counter for the workbooks must be reduced, and once the counter is equal to 0 then printing is finished and all objects are released.

You can read more on the specifics of using the MS Office COM object at the MSDN developers web site and there are copious notes and descriptions available - but it will take some time.
HTH

Posted: Wed Feb 14, 2007 10:26 pm
by PeterGibson
2) f:\convert works n:\convert goes thru the dialog but does not add a folder to the watched directory tree.. f: is an external drive.. n: is a novell 3.12 ( :cry: ) fully mapped/all rights... use it every day... drive...??

General... thedocpdf36.app doesn't seem point to any entry points where I could open the document , assign the printer, print the page(s)... where should I look?


Also, your support has been great just trying to figure out how to use the tools...

Posted: Wed Feb 14, 2007 10:44 pm
by John - Tracker Supp
Hi Peter,

I know Novell can be a bit tricky in this area - but to be honest my knowledge of Novell is getting on for 15 years old these days and somewhat faded - to be honest I think we are going to struggle to help you here as we just dont have the relevant expertise.

I'll ask Craig to get back to you ASAP on the issue below :
General... thedocpdf36.app doesn't seem point to any entry points where I could open the document , assign the printer, print the page(s)... where should I look?
Best

Posted: Fri Feb 16, 2007 3:10 pm
by Tracker - Clarion Support
Hi Peter!

Sorry for the delay, was digging out from under Wednesday's ice storm.
General... the docpdf36.app doesn't seem point to any entry points where I could open the document , assign the printer, print the page(s)... where should I look?
docpdf36.app probably won't do what you want. It demonstrates the "Print by File Association" version which only prints the first page of any workbook. To enumerate the pages within the workbook you will need something that allows you more control than File Associations allow you to.

As this demo was developed to illustrate the simplest form of hands-OFF document-to-PDF using the PDF-XChange Driver, there was no need to delve deeper into the File Association. Opening the file is handled inside Word, as is printing it. Printer selection to the PDF-XChange Driver is also handled internally.

As our Project Team Manager pointed out: "We use the MS Office COM object - "Excel.Application" to do this."

The PxcWOI36.app uses Capesoft's Office Inside to demonstrate printing of Word documents using the Microsoft Word COM object within a Clarion wrapper. OI also supports Microsoft Excel and I MOST STRONGLY recommend that you consider this. I have been quite pleased with interfacing to it from the PDF-XChange Driver. We added special template code to handle OI interfacing and PxcWOI36.app demonstrates this.

For example, just referring to the OI docs for Excel, I think the following code would probably work well for you:

Code: Select all

MyWorkBookName  STRING(FILE:MaxFilePath)  ! Use fully-qualified file name here
I               LONG                      ! Loop counter
rtn             LONG                      ! Return code

  CODE

  MyExcel.Init(0, 1)
  IF MyExcel.OpenWorkbook( MyWorkBookName ) THEN
    MySheetCount = MyExcel.CountSheets()
    LOOP I = 1 TO  MySheetCount
      IF MyExcel.SelectWorksheet ('', I) THEN
        MyExcel.PrintMe()
      END
    END
    MyExcel.CloseWorkbook(2)
  END
  MyExcel.Kill()

Posted: Sun Feb 18, 2007 11:37 pm
by PeterGibson
Since I don't have the addon, could you let me see a copy of PxcWOI36.clw to trace the commands to envoke the printer... I know how to cycle thru the sheets.

Posted: Mon Feb 19, 2007 12:18 am
by Tracker - Clarion Support
Hi Peter!

See attached.

A word of explanation for you: if you remember what our Project Manager said, you have to wait for the driver to send an event to let you know that one sheet has been printed before starting the next sheet. You might want to consider using the PDFMergeClass to store the PDF generated by each Print and then merge them at the end.

The event that signals document completion is EVENT:PDF3DRV_DocSaved - see pxcwo001.clw for where we add this. If you use the driver templates, it will be populated automatically. Note that it is not in PrintProc but in Main! This is important. Our Project Manager recommends starting a new thread for the driver execution, but "catching" the event back in the calling routine.

Posted: Wed Feb 21, 2007 7:43 pm
by PeterGibson
1) I could not find CRWPXC30.app (report writer to pdf)? Is there one I can look at?

Posted: Wed Feb 21, 2007 8:06 pm
by Tracker - Clarion Support
Hi Peter!

There is a new version for 3.6 due to be released soon.

See attached.

Posted: Fri Mar 02, 2007 3:48 am
by PeterGibson
I got the new (2/28 version) and am looking for help on how to impliment: AddWatermarkAsImage. I want to put a logo on the bottom left corner. TIA

Posted: Fri Mar 02, 2007 2:14 pm
by Tracker - Clarion Support
Hi Peter!

The AddWatermarkAsImage works much the same as AddWatermarkAsText (See Feb 1 message in this thread). In particular, the method to place an image in the lower left corner is exactly the same.

Code: Select all

 1. PDF1.AddWatermarkAsImage PROCEDURE(
 2. STRING FileName
 3. LONG pn
 4. LONG im_width
 5. LONG im_height
 6. BOOL KeepAspect
 7. LONG angl
 8. LONG PlaceType
 9. LONG PlaceOrder
10. LONG Align
11. REAL XOffset
12. REAL YOffset
13. LONG Opacity
14. LONG Pageno
15. )
  • 1. Procedure call
    2. Fully-qualified Filename of the image file to use
    3. Image number in the image file. Should be 1, unless using a different image in a multi-image file.
    4. Desired Image Width, in points (72 points = 1 inch)
    5. Desired Image Height, in points
    6. If set to True, will "fit" the image into the desired size, but maintain aspect ratio (so there may be "white space" around it). If False, will stretch the image to fit the rectangle, but may distort it.
    7. Angle of rotation of the image. Suggest 0 = no rotation.
    8. Placement Type - suggest PlaceType_AllPages to mark all pages
    9. Placement Order - suggest PlaceOrder_Background so that the original page info will not be obscured by it.
    10. Align - the "Big One" - Determines the gross position on the page. For bottom left use BOR(TextAlign_Left ,TextAlign_Bottom ).
    11. Set to 0.0
    12. Set to 0.0
    13. Opacity - 0 = totally transparent; 255 = totally opaque. This is best set using "cut and try".
    14. Pageno - Must be set if using PlaceType_Range; Otherwise zero (0).

Posted: Fri Mar 02, 2007 4:40 pm
by PeterGibson
Again, Thank You... the diligence of your responses and support is greatly appreciated!

1) this is a much better prototype than on page 112/PDFToolsCW36.pdf...!

2) on a thread Posted: Wed Dec 06, 2006 10:00 pm to DonSchwirtlch:
"After examining the Clarion class files, I found that the original programmer did have code where he set and then reset the default printer driver. "
Those calls might help me with my excel book printing since can't figure out how to print a sheet after I open excel and put it in focus other than to the active printer.

Posted: Fri Mar 02, 2007 6:51 pm
by Tracker - Clarion Support
PeterGibson wrote:Again, Thank You... the diligence of your responses and support is greatly appreciated!
Glad to help! :)
PeterGibson wrote:1) this is a much better prototype than on page 112/PDFToolsCW36.pdf...!
We are in the process of revamping our documentation.
PeterGibson wrote:2) on a thread Posted: Wed Dec 06, 2006 10:00 pm to DonSchwirtlch:
"After examining the Clarion class files, I found that the original programmer did have code where he set and then reset the default printer driver. "
Those calls might help me with my excel book printing since can't figure out how to print a sheet after I open excel and put it in focus other than to the active printer.
We removed them and rewrote the code that had used them. Changing the default printer was a very bad way of handling the problem. I'll have to see what I can dig up.