Author Topic: DBE/PmPDF report titles  (Read 380 times)

Per E. Johannessen

  • Full Member
  • ***
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 136
    • View Profile
DBE/PmPDF report titles
« on: September 20, 2019, 04:31:35 pm »
When printing a report in DBExpert to PMPDF, and PMPDF is set to create pdf's automatically, it creates a file like this;
20190920160910-InvoiceReport.PDF where InvoiceReport is the title of the report in DBE.

If the invoice number in this case is 12345, is there a method to automatically create a pdf named only 12345.pdf?
(Actually substitute the report title "InvoiceReport" with the invoice number from it's field in the report.)





roberto

  • Sr. Member
  • ****
  • Thank You
  • -Given: 16
  • -Receive: 10
  • Posts: 462
    • View Profile
Re: DBE/PmPDF report titles
« Reply #1 on: September 20, 2019, 11:55:40 pm »
I have thought about this many times, but I always leave it for later. And today looking at it a bit,
I thought it can be made easier. List the pdfs sorted by dates, and rename it and that's it.

dir "d:\pdf\20190920*.pdf" /O:DN /F >"d:\pdf\xxxxxxx.txt"
rename a b

Per E. Johannessen

  • Full Member
  • ***
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 136
    • View Profile
Re: DBE/PmPDF report titles
« Reply #2 on: September 21, 2019, 01:41:45 am »
If the name is not given when the report is printed to PMPDF it will always be yyyymmddhhmmss-InvoiceReport.pdf and this file name would have to renamed to 12345.pdf. Remember I use PMPDF's options set to "automatically create pdf" so in this case there is no way to see from the file name that it actually is invoice no. 12345.
Using PMPDF to automatically create pdf's from another application I have results in files named with this format;
yyyymmddhhmmss-Invoice_12345_Account_67890.pdf, so in this case renaming is an easy task.
However, I don't have the sources so I cannot see how it is taking the invoice number and account number from the record and uses them as parts of the file name.

André Heldoorn

  • Hero Member
  • *****
  • Thank You
  • -Given: 117
  • -Receive: 19
  • Posts: 781
    • View Profile
Re: DBE/PmPDF report titles
« Reply #3 on: September 21, 2019, 06:45:10 am »
Can the PDF file be parsed afterwards, with or without e.g. Xpdf's pdftotext.exe?

Per E. Johannessen

  • Full Member
  • ***
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 136
    • View Profile
Re: DBE/PmPDF report titles
« Reply #4 on: September 21, 2019, 02:09:47 pm »
Yes, the file can be parsed afterwards and pdftotxt.exe could be used. I do have another program using this approach for some other pdf files.

However, still I'd like to find out how to "automate" this task with DBE/PMPDF since it works fine with another program.

André Heldoorn

  • Hero Member
  • *****
  • Thank You
  • -Given: 117
  • -Receive: 19
  • Posts: 781
    • View Profile
Re: DBE/PmPDF report titles
« Reply #5 on: September 21, 2019, 06:14:30 pm »
I'm not using PMPDF, and the distributed files seem to be mixing versions of both important files, but it may be a missing feature of PMPDF to be able set an own name. To override the name generated by DBE and/or PMPDF.

AFAICT, according to "HELP WPSREF WPPRINTER" and without using PMPDF, JOBDIALOGBEFOREPRINT or OUTPUTTOFILE can only offer a dialog at best. Not the best solution when the number of invoices exceeds one or two.

FWIW: in a Windows environment, with several involved different "solutions", I'd probably expect a human interface, opening and checking each PDF file and saving it with a better file name. So even post-processing PDF files would be quite "innovative", if that's a normal standard.

Regarding PMPDF, is it clear which files are the right version(s)? Files sizes are different too. IIRC one file in the WPI archive is newer, and one file isn't.

roberto

  • Sr. Member
  • ****
  • Thank You
  • -Given: 16
  • -Receive: 10
  • Posts: 462
    • View Profile
Re: DBE/PmPDF report titles
« Reply #6 on: September 23, 2019, 07:49:02 pm »
I attached an example in dbesample2.zip that does what you want.
But it doesn't change the name of the file until you close the report.
 
I have added two macros MCAMBIADO2 and MOJO
In * Item List * report has two links to these two macros, where they are placed.
Also, a new field has been added to * Main Menu *, there will be an invoice number
that will put the report to print, and temporarily put it in that field.
You can make that field visible, hidden, or without a tab you decide.

It has no guarantee.

Put the example in the same Dbesample folder, to use the example tables.

Per E. Johannessen

  • Full Member
  • ***
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 136
    • View Profile
Re: DBE/PmPDF report titles
« Reply #7 on: September 24, 2019, 07:52:16 pm »
Thank you, Roberto.
A different approach which I'll look into for some other DBE stuff as well.