BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

activePDF and ISAPI
Goto page 1, 2  Next
 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Isapi-WebBroker
View previous topic :: View next topic  
Author Message
Del Murray
Guest





PostPosted: Wed Sep 17, 2003 8:10 pm    Post subject: activePDF and ISAPI Reply with quote



Is anyone using activePDF in an ISAPI application ??


Back to top
Dan Ridenhour
Guest





PostPosted: Thu Sep 18, 2003 1:40 am    Post subject: Re: activePDF and ISAPI Reply with quote




"Del Murray" <delm (AT) mchsi (DOT) com> wrote:
Quote:
Is anyone using activePDF in an ISAPI application ??

Del,

Not yet, but its on my plate for the next few weeks now that ive gotten a handle on all of MySQLs limitations. ;-)

Dan

Quote:




Back to top
Del Murray
Guest





PostPosted: Thu Sep 18, 2003 2:20 am    Post subject: Re: activePDF and ISAPI Reply with quote



Dan,

Well good luck. We will have to swap help because Delphi and activePDF
programmers are scarce as hen's teeth. I have a working app but in test mode
it doesn't do so good. I think that it has someithing to do with IE being
used by my app while WebGrabber is trying to also use it and IE is *not*
multi-threaded ... or at least it appears not to be so. Adobe Acrobat is
also giving me fits while testing, but acts ok when running in "production"
environment. When you get ready , I'll tell you what I did to get started
and If you see any holes we can hash it out. It appears to be an ok, not
perfect, product but is also the only game in town to turn at html string
into pdf.

Regards,
Del


Back to top
Shiv Kumar
Guest





PostPosted: Thu Sep 18, 2003 4:53 pm    Post subject: Re: activePDF and ISAPI Reply with quote

Del,

What I use is ReportBuilder with Pragnaans PsRbuilder Export Device. It's
really cool since I have the same reports in a regular GUI application and
an ISAPI as well.

Pragnaan has a similar thing for other report writers as well.

There is a demo running on my website. You can find it here

http://www.matlus.com/scripts/rbexportpdf.dll

The project file is at

ftp://www.matlus.com/RBExportPDF.zip

--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com


Back to top
DaveH
Guest





PostPosted: Thu Sep 18, 2003 5:44 pm    Post subject: Re: activePDF and ISAPI Reply with quote

Yes. What would you like to know?

DaveH

"Del Murray" <delm (AT) mchsi (DOT) com> wrote

Quote:
Is anyone using activePDF in an ISAPI application ??





Back to top
Shawn Pfaff
Guest





PostPosted: Thu Sep 18, 2003 8:03 pm    Post subject: Re: activePDF and ISAPI Reply with quote

I am. Built a full PDF server/web service with RemObjects that does form
field substitution, flattening and sending. What ?'s do you have?


"Del Murray" <delm (AT) mchsi (DOT) com> wrote

Quote:
Is anyone using activePDF in an ISAPI application ??





Back to top
Del Murray
Guest





PostPosted: Thu Sep 18, 2003 8:19 pm    Post subject: Re: activePDF and ISAPI Reply with quote

Shiv,
My problem is a little more convoluted that just dumping out a report. My
users are not very computer literate. I have an app the already produces a
perfectly formated html document for them to print and use. The challenge
that I now face is that they must take that document and sever related
documents and file them together with the Federal Bankruptcy Court. The
court will only accept electronic filing and the only format they accept is
pdf. My currently produce the html docuement in their browser, then "print"
them to a pdf printer that is installed because they have Acrobat installed
on each machine. In order to file 5 related documents, the court system does
not accept an upload of 5 files.... no no... they must take each document
and assemble the separate PDF files into one larger PDF and submit the
larger PDF. Since they are processing as many as 400 law suites to gether,
this means that they have to keep track of these PDF's for each Defendant so
that they can put the right files together. Now most of these users are
little old ladies that have been working in these law firms for 40 years and
they just now swithed from DOS Wordperfect to MS products and MS Word so you
can imagine the hurdle I am having to jump over.

By using activePDF, i can take the response.content (my formatted html that
I already build) and under program control (not old lady control) convert it
to PDF then store it in a SQL Database and then again, under program
control, gather up the various stored PDF's and create a new PDF that is
ready to go to the courts. To ask a bunch of old biddys to do this for 400
defendants is like trying to herd cats ... it cant be done. The original
documents need to be formated as html because only html gives me the ability
to create documents , embed data and produce a formated documents acceptable
by the court systems. Active PDF is the only product I know of that will
take the generated html and turn it into a pdf and give the resultant pdf
back to me under program control so that I can process it further.

If you know of anything else that may solve this, I would be very glad to
entertain your suggestions.

Del


Back to top
Del Murray
Guest





PostPosted: Thu Sep 18, 2003 8:21 pm    Post subject: Re: activePDF and ISAPI Reply with quote

Dave,

I am haveing some stability problems. It is probably my fault. I am using
activePDF in an ISAPI. Here is what I did to get up and running (they have
virutally not documentation for Delphi).

I imported the WebGrabber and ActviePDFServer files to create _TLB files
which could be included in my 'uses' statements

To the best of my knowledge they are
wwwprintclientlib_tlb and prt2disklib_tlb which I created by importing
activex controls WGIEActiveX Ctrl Module and ActiveServer OLE Control Module
which were installed as part of the activePDF server installation.

I access them in my code by doing ....

wg := createoleobject('APWebgrabber.object');
ps := createoleobject('APServer.object');

where wg and ps are decalared as follows

wg, ps : olevariant;


my code is very simple. I want to take the contents of a tPageProducer and
turn it into a pdf ...

try
wg := createoleobject('APWebgrabber.object');
ps := createoleobject('APServer.object');

wg.url := 'http://www.dummyzzxxyy.com';
wg.createfromhtmltext := response.content;
wg.prt2disksettings := ps.ToString;

rv := wg.DoPrint('127.0.0.1', 64320);
rv := wg.Wait('127.0.0.1', 64320,30,'019');

if rv = 19 then begin
ps.FromString(WG.Prt2DiskSettings);
filename := ps.NewUniqueId + '.PDF';
PDFName := 'c:winntactivepdf' + Filename;
fs := tFileStream.Create(pdfName, fmShareDenyWrite);
fs.position := 0;
ts := tStringStream.create('');
ts.CopyFrom(fs,0);
end;
finally
wg.CleanUp('127.0.0.1', 64320);
end;


Sometimes it works fine 5 times in a row and then all of a sudden it causes
an addressing exception. All of this happens while running under control of
the debugger. It will never recover and act correctly again unless I reboot
the machine. I'm useing D5 ClientServer, SQL Server 2000, Win NT 4.0.
Occasionally the wg.wait command will return code 99 instead of crashing. I
think it may be because I am using IE while the server is also trying to use
IE to interpres the HTML. This would not occur in production since the
active server code will be running on an IIS server with no users acting
locally, whereas in my test environment I have every possible element
running on the same machine.
My real question is .. is my code correct, am I accessing the activeServer
controls properly (with CreateOleObject) ??? I am going to move the code to
a production like environment on Monday and test is in that mode. If it
proves stable, I am OK, if not I would appreciate your commenting on my
programming techniques here or advise me on what you did. Remember, my only
goal is to create a PDF from an existing html string which my program
already produces.

Thansk for the help,

Del


Back to top
Del Murray
Guest





PostPosted: Thu Sep 18, 2003 8:22 pm    Post subject: Re: activePDF and ISAPI Reply with quote

Shawn,
Please see my reply to DaveH above. Any help would be appreciated.

Del


Back to top
Shiv Kumar
Guest





PostPosted: Fri Sep 19, 2003 12:58 am    Post subject: Re: activePDF and ISAPI Reply with quote

Del,

Do you *have* to generate this first document in html? I mean if you
generated all the documents in PDF yourself, then you don't even need a
fancy product to do this. There is a free component written in Delphi that
allows you to write to the "Canvas". If you've ever used the Printer object
in Delphi ten you'll know that this is a no brainer.

However, if your documents are complex, then you simply have to build a
report (we build such reports to submit to federal government agencies and
they are *exactly* as they require) and use what I suggested. Pragnaans
component works with a TStream and you have complete control over it so
instead it streaming it to the web server you can save it in a blob. When I
say report, I don't mean a query result kind of thing. I mean a "form" that
looks like it has been filled in. These forms range from 3 -62 printed
pages, and it's all designed in a WYSIWYG designer.

I believe you can do what you need to with what I suggested. I've used it
extensively in production software without a hitch. Besides, everything is
in Delphi :)

--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com


Back to top
Shiv Kumar
Guest





PostPosted: Fri Sep 19, 2003 12:58 am    Post subject: Re: activePDF and ISAPI Reply with quote

Hey Shawn,

Good to see you here!

--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com


Back to top
Del Murray
Guest





PostPosted: Fri Sep 19, 2003 1:53 am    Post subject: Re: activePDF and ISAPI Reply with quote

Shiv,

Ok, let me take it one step further and you can evaluate suitablity. I dont
*have* to do it in html, but here is why I do. The data is very dynamic. For
instance, a law suit may involve 1 to 10 defendants. In a law suit the
pleading always has what we call a "style" at the top. It is 3 colums and
follows a certain format. If I have to list multiple defendants, in the left
hand column and after listing them I have to show something like court case
number in the right hand column but only on the line where the last
defendant is named. That is probably a simple trick with the report
generator. The rest of the law suit is about 2 or 3 pages long and 95 % of
it is boiler plate text which I get from an html file that was built by a
program I wrote that takes an rtf file and converts it to html (nasty
program). There are places in the file where I need to plug in text which
may consist of naming lets say a 3 collatera items. The required format is

item 1, item2 and item 3

notice the comma and placement of the word "and". I have to know several
thing when I build this programatically. Where to place the comma, and when
(or if) to place the word "and". I can accomplish this because as you know,
the tPageProducer calls my action item when he encounters the <#xx> data tag
that is the html template. This allows me of course the ability to return
any size block of text that is formated anyway that I want and insert it
into the template. Each paragraph in a law suit is numbered. I may insert
sometimes need to insert a new paragraph (requiring a number) into a
document and that means the the next printed number can not be done under
control of the report builder because he doesnt know of the paragraph number
that I just inserted. If I leave numbering up to the reportbuilder it may
generate an orphaned paragarph number on the report (number but no
associated next).

There are so many issues that I dont know anyway to handle it other than
with the combo of pageproducers and data tags.

Now, if this report writer allows me to layout the report and specify places
where I want to insert programatically built data of any format I may be
able to use it. The one issue that continually comes up though is how to
build table formated data. It is so easy in html. Some times I need
signatures split to the left and right on the pages, block of indented text,
numberd and bulleted items, etc. I can do this with tables but what about
the report writer ???

I hope this gives you a better idea of the issues I have to over come. If
you see a way to solve this it would be great .

How do you take to generated report and turn it into pdf ? is that part of
the package and does the pdf file come back to you in a tstream of somekind
or does it go to a file and you have to read the resultant file into a
tfilestream?
I hate to pick your brain so much but I have really had an uphill battle
with this pdf issue. I would rather use a pure Delphi solution as you
suggested. Does it work ok under D5, I have never upgraded because I haven't
found a reason to yet.
Last but not lease, can I force it generate page breaks any where I want and
page numbers that are entirely under my control, ie, dont number first page
but number every page from 2 to the end of the document and put them on the
bottom of the page, not right after the last line of text and dont make me
insert blank lines to get the number on the bottom of the page .. page
footers would be nice.

Thanks for the advise,
Del



Back to top
Dave Hackett
Guest





PostPosted: Fri Sep 19, 2003 3:07 am    Post subject: Re: activePDF and ISAPI Reply with quote

Hmmm. I've never used WebGrabber. I was drawing my own content and used
activePDF to convert it to PDF. It was the only product that allowed
multi-threading of the print process. A neccessaty since I too was using it
in an ISAPI app.

My first thought would be that WebGrabber is not as thread safe as their
ActiveSserver. Waiting for the document to render seems to be the area of
concern, especially if its the part that returns the 99 error code.
rv := wg.DoPrint('127.0.0.1', 64320);
rv := wg.Wait('127.0.0.1', 64320,30,'019');

Where do you declare your variants? In the procedure or in the WebModule?
It might help to free the variants so they can garbage collect by setting
them to nil (or is it null, I can't remember) in the finally section.

Also have you tried to throw multiple requests at it? I had a look at the
web site and nothing caught my eye about being thread safe - which was the
big promotional item for ActiveServer.

Now having said all that, I didn't end up using it very long Smile It didn't
render my transparent graphics properly (I think it inverted the colors or
something). For rendering HTML I remember using the TWebBrowser component
and having it just print to the ActiveServer (BTW, it has to be the default
printer - you don't get the opportyunity to choose the printer). Here is
the article that tells you how to make TWebBrowser print.

http://community.borland.com/article/0,1410,26402,00.html

D7's TWebBrowser now has a PrintToCanvas method. You could use that to
print to a MetaFileCanvas and then use that to "print" to many of the other
Delphi PDF libraries that don't install as printers. For example:
http://www.llion.net/ , http://www.synactis.com/products/pdf_delphi.htm ,
http://www.sedtech.com/isedquickpdf/

DaveH


"Del Murray" <delm (AT) mchsi (DOT) com> wrote

Quote:
Dave,

I am haveing some stability problems. It is probably my fault. I am using
activePDF in an ISAPI. Here is what I did to get up and running (they have
virutally not documentation for Delphi).

I imported the WebGrabber and ActviePDFServer files to create _TLB files
which could be included in my 'uses' statements

To the best of my knowledge they are
wwwprintclientlib_tlb and prt2disklib_tlb which I created by importing
activex controls WGIEActiveX Ctrl Module and ActiveServer OLE Control
Module
which were installed as part of the activePDF server installation.

I access them in my code by doing ....

wg := createoleobject('APWebgrabber.object');
ps := createoleobject('APServer.object');

where wg and ps are decalared as follows

wg, ps : olevariant;


my code is very simple. I want to take the contents of a tPageProducer and
turn it into a pdf ...

try
wg := createoleobject('APWebgrabber.object');
ps := createoleobject('APServer.object');

wg.url := 'http://www.dummyzzxxyy.com';
wg.createfromhtmltext := response.content;
wg.prt2disksettings := ps.ToString;

rv := wg.DoPrint('127.0.0.1', 64320);
rv := wg.Wait('127.0.0.1', 64320,30,'019');

if rv = 19 then begin
ps.FromString(WG.Prt2DiskSettings);
filename := ps.NewUniqueId + '.PDF';
PDFName := 'c:winntactivepdf' + Filename;
fs := tFileStream.Create(pdfName, fmShareDenyWrite);
fs.position := 0;
ts := tStringStream.create('');
ts.CopyFrom(fs,0);
end;
finally
wg.CleanUp('127.0.0.1', 64320);
end;


Sometimes it works fine 5 times in a row and then all of a sudden it
causes
an addressing exception. All of this happens while running under control
of
the debugger. It will never recover and act correctly again unless I
reboot
the machine. I'm useing D5 ClientServer, SQL Server 2000, Win NT 4.0.
Occasionally the wg.wait command will return code 99 instead of crashing.
I
think it may be because I am using IE while the server is also trying to
use
IE to interpres the HTML. This would not occur in production since the
active server code will be running on an IIS server with no users acting
locally, whereas in my test environment I have every possible element
running on the same machine.
My real question is .. is my code correct, am I accessing the activeServer
controls properly (with CreateOleObject) ??? I am going to move the code
to
a production like environment on Monday and test is in that mode. If it
proves stable, I am OK, if not I would appreciate your commenting on my
programming techniques here or advise me on what you did. Remember, my
only
goal is to create a PDF from an existing html string which my program
already produces.

Thansk for the help,

Del





Back to top
Shiv Kumar
Guest





PostPosted: Fri Sep 19, 2003 3:55 am    Post subject: Re: activePDF and ISAPI Reply with quote

Del,

I've read your description and I still feel this is doable using
ReportBuilder and the PDF device. I'll explain wherever applicable. I'm
assuming you use RB :)

Quote:
may consist of naming lets say a 3 collatera items. The required format is

item 1, item2 and item 3

notice the comma and placement of the word "and". I have to know several
thing when I build this programatically. Where to place the comma, and
when


These will just translate to "labels" in RB that you set captions/text to at
run time.

Quote:
document and that means the the next printed number can not be done under
control of the report builder because he doesnt know of the paragraph
number
that I just inserted. If I leave numbering up to the reportbuilder it may
generate an orphaned paragarph number on the report (number but no
associated next).


In RB, you can actually generate controls on the fly just like you would in
a regular TForm. In other words, you create an instance of an RB control,
position it and set it's values etc. Memos in RB automatically expand and
page break if required.

Quote:
Now, if this report writer allows me to layout the report and specify
places
where I want to insert programatically built data of any format I may be
able to use it. The one issue that continually comes up though is how to
build table formated data. It is so easy in html. Some times I need
signatures split to the left and right on the pages, block of indented
text,
numberd and bulleted items, etc. I can do this with tables but what about
the report writer ???

Yes, as I said above, you can build a whole report on the fly (from nothing
at design time). I actually do this in my case since I don't know the layout
of forms in my case. My customers design their forms using a custom form and
controls that I've made. They use the Delphi IDE to design forms and the
form generates xml. Using this xml I produce a web page that allows users to
fill in the "form". Then I parse the xml out and build my "report" on the
fly and generate a PDF. But you could have a partial "report" designed at
design time and then add to it at run time. I believe subforms in RB will
give you this control. In other words your paragraphs etc. can be sub forms
(they are like templates) and you can use then where you need them.

As regards bulleted lists, the bullets themselves are images (I use images
for checkboxes and radiobuttons myself).

Quote:
How do you take to generated report and turn it into pdf ? is that part of
the package and does the pdf file come back to you in a tstream of
somekind
or does it go to a file and you have to read the resultant file into a
tfilestream?

You simply call the "print" method. Originally the component would output it
to a file. I worked with the guys and got them to allow the programmer to
hand it a stream do it's "printing" and then programmer is free to do with
the stream what she pleases.

Quote:
suggested. Does it work ok under D5, I have never upgraded because I
haven't
found a reason to yet.

Yes, it does.

Quote:
Last but not lease, can I force it generate page breaks any where I want
and
page numbers that are entirely under my control, ie, dont number first
page
but number every page from 2 to the end of the document and put them on
the
bottom of the page, not right after the last line of text and dont make me
insert blank lines to get the number on the bottom of the page .. page
footers would be nice.

Its a report. In that you design it and you have full control over it. You
can force page breaks because RB allows you to do that. You can generate
your own page number wherever you want (place them where you want). And of
course, since it's a "report" at the end of the day, you can have headers,
footers etc.

I should let you know, I am no RB pro. In fact, I don't even build/design
the reports. There are people in my team that are a lot more knowledgeable
in RB (or any report writer for that matter) than I am. RB even has a news
group help. Once the reports are designed and tested in a regular GUI test
application, I simply pull it into my ISAPI applications. The only thing I
do know is building a report on the fly (the case I mentioned above). These
reports span between 3-62 pages as I mentioned earlier and are online
"forms". An object I built takes in the xml and generated an RB report on
the fly. The xml is proprietary in that it's my own design and won't help
you, but you could do a similar thing. If your html is xhtml you could use
the parser to parse it out and build the RB report, fill in the blanks etc.
as required, as if you were constructing html. The only glitch I was with RB
doing it this way, was that you had to construct the controls from top-left
to bottom-down. In other words in chronological order, even though you
provide exact co-ordinates for placing them when you create them.

In your case, I think, your "report" will be designed at design time and
some things will be added at run time. If you're familiar with RB (or have
someone with you who is), then I suggest attempting building this report and
trying it for yourself. If you can do it in RB, then converting it into PDF
is a simple matter of calling the print method.

You might want to download that project I mentioned earlier to see the code
for the stream part and print part. It's just 4 lines of code.

--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com




Back to top
Shiv Kumar
Guest





PostPosted: Fri Sep 19, 2003 3:58 am    Post subject: Re: activePDF and ISAPI Reply with quote

"Del Murray" <delm (AT) mchsi (DOT) com> wrote

Quote:
i declare them in the webmodulecreate section (constructor) but I think
that
the webmodule desctroys the "created" oleobjects when you exit the action
..


if you declare them in the OnCreate event of the web module their scope in
only in that method. Since they are interfaces they will be destroyed as
soon as they go out of scope.

--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Isapi-WebBroker All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.