What are options for creating PDF files?

General TRichView support forum. Please post your questions here
Post Reply
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

What are options for creating PDF files?

Post by toolwiz »

I need to create an app that converts RTF files to PDF format that can be read with Acrobat Reader.

I've been looking at several of the PDF libraries that have VCL support (no DLL or OCX wanted) and I also see from a message here that there's a RichViewPDF object somewhere.

The prices of the PDF VCL libs are all over the place, from about $200 to over $1000 for a single developer license!

I need to be able to take RTF files with font variations (size, color, styles), embedded images, tables, textboxes, and perhaps line art, usually created with MS Word, and generate PDFs from them. That's it. I don't need to generate documents dynamically, edit them, or anything else. Just convert an RTF to a PDF file. (Well, it also needs to support live hotlinks, but that's another matter, and the all seem to support this.)

I also need to be able to attach a zip file to the PDF that can be opened with another tool (not by the Acrobat Reader). Some libs let you do this, some don't. Some do but it's visible somehow, and some make it completely invisible. Nobody has explained what the controlling factors are.

I'd like to hear people's experiences in working with the various PDF libraries with RichView.

Thanks
-David
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Test LLPDFLib (www.llion.net), wPDF (www.wptools.com), eDocEngine (www.gnostice.com)
Other libraries that can be used with TRichView use DLLs, as far as I know.
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

Post by toolwiz »

Sergey Tkachenko wrote:Test LLPDFLib (www.llion.net), wPDF (www.wptools.com), eDocEngine (www.gnostice.com)
Other libraries that can be used with TRichView use DLLs, as far as I know.
I've done some basic testing with VisPDF and LLPDFLib. The demo for LLPDFLib is from here somewhere and it at least produced something resembling the original document, including most of the images. The basic VisPDF demo didn't include any of the images in the output, or tables, or much of anything besides the text.

Neither of them displayed page headers/footers, followed pagination like the original, or handled margins the same.

All I'm trying to do is take an existing document, saved in RTF format, and render it as a PDF file. This is new to me, and it's a little unexpected to think that I've got to require the user to explain his page layout details AGAIN to the page formatter when it ought to be able to infer everything needed from the source document.

I don't know if this might be a shortfall in TRichView, or the document I'm testing with, or the PDF library, or just the demo program not making the necessary calls when it reads the RTF document in.

Does anybody have the source code (Delphi) that I can license that does a basic RTF -> PDF rendering using TRichView and one of these libs?

The vendors all have something that does this, but it's usually a standalone app or a DLL/OCX, which I don't want. I need my app to do it all by itself. And they don't sell this code separately.

Thx
-David
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

PDF libs provide canvas where you can draw page image, page by page.
Then they convert your drawing to PDF. They can understand not all drawing operations, so not all drawing will be saved.
But as for pagination and headers/footers, this work should be implemented by TRVReportHelper and you.
Unfortunately, TRVReportHelper (what creates page images) does not support margins and headers/footers.
As for headers/footers from RTF, see this demo:
http://www.trichview.com/support/files/a4.zip
It draws page image on metafile, you need to change it to draw on PDF canvas.
As for reading page size and margins from RTF, it's possible in the latest version of TRichView. See DocParameters property.
If you need, I can update a4.zip to read this info from RTF.
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

Post by toolwiz »

Sergey Tkachenko wrote:PDF libs provide canvas where you can draw page image, page by page.
Then they convert your drawing to PDF. They can understand not all drawing operations, so not all drawing will be saved.
But as for pagination and headers/footers, this work should be implemented by TRVReportHelper and you.
Unfortunately, TRVReportHelper (what creates page images) does not support margins and headers/footers.
As for headers/footers from RTF, see this demo:
http://www.trichview.com/support/files/a4.zip
It draws page image on metafile, you need to change it to draw on PDF canvas.
As for reading page size and margins from RTF, it's possible in the latest version of TRichView. See DocParameters property.
If you need, I can update a4.zip to read this info from RTF.
Yes, that would probably be helpful to others as well. It's always good to keep the examples current with the release.

Pardon my ignorance, but I don't use the canvas very much. I did some stuff with it a few years ago, and I think it was treated like a bitmap. Is this true? If so, then why would PDF libs have trouble rendering a bitmap accurately?

I figured this would be a fairly simple task -- take a multi-page RTF file with images, links, some tables, and mostly text, read it in, and render it as a PDF file. It's turning out to be somewhat of an unpredictable thing.

Is this because of TRichView? I mean, the wPDF guys have their WordPro (?) library that supposedly does this very easily when coupled with their wPDF lib. But I hate the idea of having to buy another library just for this one purpose.

-David
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

As far as I know, all PDF libraries use not bitmap's, but metafile's canvas.
Page image is saved in metafile. Metafile is a sequence of drawing commands (like "set font", "draw text", "draw line", "draw bitmap") . When metafile is created, PDF library converts drawing commands to PDF commands. Better library understands more commands.
PDF library understands nothing about RTF or other formats. It just must understand drawing commands.
Post Reply