Operating System - OpenVMS
1829275 Members
9706 Online
109988 Solutions
New Discussion

"Printing" reports to PDF file

 
SOLVED
Go to solution

Re: "Printing" reports to PDF file

Thanks for that Hoff... I was just working with that application.

I'm also pushing FTPing the files to our file server since many of these are printed to be archived anyway. As soon as I can convince him it was his idea, I think it will done. :)

Re: "Printing" reports to PDF file

Reopening to try and see if someone (Craig???) can help with a small problem I see with the text2pdf.c program that Craig provided earlier in this thread. I have tried contacting the original author using several different email addresses I have found, but they all appear to be bouncing. If you have an alternate contact for Phil (or can point him here), that would work as well.

BTW, I am currently having the converted files FTP'd to the file server and things are working quite well.

Now the problem... If there are more than 1861 pages to be converted, the PDF file can not be read beyond that page. The data is there with no problem, but the pdf formatting at the footer of the file is not wrapping correctly after the second line. If I wrap the /Kids section by hand, the file will work properly. It appears the first line wraps fine almost by accident because of the spaces but the secont line breaks in the middle of a number (5586 for the first failure). If there were a way to wrap if within x characters of the page width or (less elegantly) to wrap after each entry, that would work. Currently the characters seem to wrap around 10000 (did not count them beyond 1000) characters.

The section of code is in the
void WriteRest() section:

writestr("/Kids [ ");
for (i = 1; i <= pageNo; i++) {sprintf(buf, "%d 0 R ", pageObs[i]); writestr(buf);}
writestr("]\n");


Any ideas?
Hoff
Honored Contributor

Re: "Printing" reports to PDF file

Here, you can fix the C code to wrap the section correctly, run some tests with your existing test suite of files, and contribute it back out to the community.

Or you could run some post-processing DCL that fixes this formatting error.

Or you can pay somebody to tweak the code. You're almost certainly making commercial use of this code, so toss a couple of hundred bucks into a bounty for a fix, for instance.

As for the official specs and the approach involving fixing the code, the Adobe PDF specs (aka ISO 32000) are available.

http://www.adobe.com/devnet/pdf/pdf_reference.html

http://www.adobe.com/devnet/acrobat/pdfs/adobe_supplement_iso32000.pdf

Or use this as an opportunity to add to your own existing C coding skills and to add to your own resume; to do a little C coding -- you've apparently localized this error down to the particular source code involved, after all. Switch this over to a "how do I do [line-wrapping?] using [printf?] for [desired outcome?] question, for instance.

Re: "Printing" reports to PDF file

Hoff: Thanks to your first link, I saw that those /Kids entries could each be on a separate line (in fact that is how they are all shown in the documentation for 1.3).

I placed a "/n" on the line after 0 R and now that part should work for any sized file. Anything beyond that small change would have meant getting someone else involved. I was able to track down the code segment only because of all the fixed text and following the program through. Still don't understand how lots of it works.

As far as getting the change pushed out to the rest of the community, I would like to let Phil Smith, the original author, know but have been unable to contact him and I don't even see the version Craig provided in this thread published anywhere else. V1.2 was provided here, all I find is v1.1 on the web.

Re: "Printing" reports to PDF file

Correction... that should be a \n to make the line:

writestr("/Kids [ ");
for (i = 1; i <= pageNo; i++) {sprintf(buf, "%d 0 R \n", pageObs[i]); writestr(buf);}
writestr("]\n");