NetTalk Central

Author Topic: Hand coded report to PDF?  (Read 5320 times)

bekeland

  • Newbie
  • *
  • Posts: 37
    • View Profile
Hand coded report to PDF?
« on: June 14, 2011, 09:38:39 AM »
I have a need for a hand coded report that I want to go to a PDF, then serve and allow the user to view/download/save the PDF.  I can make the Clarion report procedure and the steps with NetWebReportABC work as a test.  But the report is not suited to the report procedure as I have a lot of extra pages of text and images, and many formats of detail lines that are conditionally used.  I also need a footer from page 2 on that shows Page XX of XX, and I don't want the user to be able to edit the PDF.

Can this be done?  Is there another tool that I can use that will convert a hand code Clarion report to a non editable PDF that I can then use standard NetTalk stuff to serve back? 

This is currently an end user app that generates an RTF file that gets loaded into a VB TX Text Control app.  It handled all the images, page footers and some protected fields.  I've tried a few rtf to pdf converters, but none of them have worked well, and I'll need the images embedded now.  They are just links in the RTF.  Now we are trying to make this a web based app and I still need to produce the same complicated report, but in PDF.  I can do everything with a hand code report easily enough, except for the Page XX of XX, and then making the PDF from it. 

Any ideas, or if you can point me to some tools that can do this, would be greatly appreciated.

Brian Ekeland

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Hand coded report to PDF?
« Reply #1 on: June 14, 2011, 10:26:26 PM »
Hi Brian,

as you've identified, this problem breaks down into 3 parts;

a) is there anything you need to add to your hand-code?

Basically no, if the report is quick to to generate. If it can take a while then adding a
p_web.NoOp()
into the loop inside the report is recommended.

You do then of course need to pass in p_web as a parameter (but you'll need to do that anyway.)

b) how to convert a report to PDF in hand-code?

I don't have the code to hand to do this, but it's a relatively simple bit of code, either using Clarion EE's PDF stuff, or the stuff from Tracker (or indeed the one from Klarisoft). Examining a generated report will show what sort of code is required. You can apply this code to _any_ Clarion report (ie any collection of WMF files).

c) how you you serve the PDF?

Again, the best option here is to look at a generated report, search for p_web, and have a look at the included code. It's very little, and you'll use the same code in your hand-coded procedure.

Cheers
Bruce


bekeland

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Hand coded report to PDF?
« Reply #2 on: June 30, 2011, 09:49:48 AM »
I'm stuck on b, converting the hand code report to PDF.  I've looked at a generated report that can be saved to PDF.  The only code I can see puts in PDFReporter CLASS(PDFReportGenerator) and a Setup proc.  I can put that in and call it, but the code that sends the report to the pdf generator is buried in the print preview code, which I can't find to see how it does that.  It seems like I should be able to call the PDFReporter.Setup(), which I can, then there should be something to call and pass the previewq that contains the report pages that gen's the pdf.  That's what I can't nail down.  Any ideas on this or what PDFReporter.SOMETHING(previewq) to call?  I'll continue trying some of the stuff I do see, but what I've tried so far is getting nowhere.  Thanks much!

Brian

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Hand coded report to PDF?
« Reply #3 on: June 30, 2011, 12:57:09 PM »
Hi Brian,

Check this link, http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=2026.0

It's more about a report with parameters, but I attached an attachment to show the cofiguration for one of the standard PDF Tools there.

Hope it helps.

Cheers
Charl

bekeland

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Hand coded report to PDF?
« Reply #4 on: July 01, 2011, 11:57:22 AM »
I've worked a hack into a report procedure to do my report.  It works to make the report, produce a pdf, and serve it up in the browser.  However, the text in the pdf is all bold and should not be.  I worked up the report in a test app, used standard Clarion preview stuff and it looked fine there.  I copied all that code and the report structure into the web app and the generated pdf has all bold text.  Any idea on how to fix that? 

Also any idea on how to check the number of records in the previewqueue?  I've tried variations of records(Previewer.ImageQueue) and records(ThisReport.PreviewQueue), but none of it compiles.  How would I get that in a report procedure?

Thanks for the help.  Brian E.

rjolda

  • Sr. Member
  • ****
  • Posts: 329
    • View Profile
    • Email
Re: Hand coded report to PDF?
« Reply #5 on: July 18, 2011, 11:36:45 AM »
Hi Brian,
Reports RUN ON THE SERVER - they are basically server code so whatever clarion can do, you can get your report to do.
The SV PDF report extension leaves a lot to be desired.
I use the Tracker PDF extension and the reports are great.  They get queued up and a simple click by the end user downloads the PDF of the report. 
AFA complex stuff.   I have written several permutations - 1. I write everything to HTML  - includes tables pictures, etc.  Fair amount of hand coding.   Then I do HTML to PDF using Capesoft FE and Tracker PDF tools.  That way I get a nice report with all the goodies in it.
A second solution is to write an RTF report.  I basically use TABOGA RTF writer to generate my Text.  I then save that to a BLOB ( could save to a file).  I then have a Clarion Report which prints headers, etc and then I use RichReport ( Solid Software) to include the RTF text in my report.  I then Have other detail bands in the report which apply a Graphic image ( signature) and then add some pictures or graphs.  Clarion Report winds out this report for me to a Tracker PDF (API) printer and I have a robust PDF file which again can be downloaded.
So, there are many ways to skin the cat!
FWIW,
Ron Jolda

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Hand coded report to PDF?
« Reply #6 on: July 19, 2011, 10:03:38 PM »
There's something in the SV PDF Generator that makes stuff go bold. I _think_ (but I'm not sure) that Arnor had a "fix" published at some point. Google around for that a bit, or alternatively ask on the newsgroups, there may be a fix for the converter.

As Ron says this isn't a NetTalk issue as much as an SV PDF issue. It occurs in Clarion for Windows as well.

cheers
Bruce