[Demo] Advanced RTF to PDF demo using LLPDFLib (open source)

Demos, code samples. Only questions related to the existing topics are allowed here.
Post Reply
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

[Demo] Advanced RTF to PDF demo using LLPDFLib (open source)

Post by Sergey Tkachenko »

Update 2017-Dec-4] TRichView setup now includes better version of this demo in <TRichViewDir>\ThirdParty\Export\LLPDFLib\Demos\RV2PDF\ folder. This better version reads all page properties from source RTF (or RVF) files and applies them to PDF, supports headers, footers, footnotes and endnotes, displays preview before exporting.
See http://www.trichview.com/forums/viewtop ... 951#p34100


The basic demo is here:
http://www.trichview.com/resources/llpd ... pdf_v4.zip (uses LLPDFLib v4 and v5)
http://www.trichview.com/resources/llpd ... pdf_v3.zip (uses LLPDFLib v3)

The new advanced demo is here:
http://www.trichview.com/resources/llpd ... _ex_v4.zip (uses LLPDFLib v4 and v5)
http://www.trichview.com/resources/llpd ... _ex_v3.zip (uses LLPDFLib v3)

This demo adds the following features:
- header and footer
- hyperlinks (both links to URL and to another page)
- reading margins, positions of header and footer, page orientation from RTF.

The demos use open source thirdparty components LLPDFLib,
http://www.sybrex.com

Updates:
2017-Dec-4: TRichView Setup now includes a better version of this demo
2016-Sep-8: LLPDFLib becomes open source
2015-Sep-23: compatibility with TRichView 16
2011-Oct-1: compatibility with TRichView 13.4
2009-Mar-14: version for LLPDFLib v4
2008-Dec-11: updated for compatibility with TRichView 11
Last edited by Sergey Tkachenko on Fri Sep 09, 2016 1:27 pm, edited 9 times in total.
jonjon
Posts: 432
Joined: Sat Aug 27, 2005 4:19 pm

Post by jonjon »

Does the same demo (with links) exists for Gnostice's eDocEngine ? That would be great!

John.
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

PDF export with eDocEngine was implemented by Gnostice. I did not tested it myself. I plan to review it and make improvements in future, but not right now, sorry.
jonjon
Posts: 432
Joined: Sat Aug 27, 2005 4:19 pm

Post by jonjon »

OK so I understand you wrote the llPdfLib one ?

Any chance you'd be able to give me your thoughts about both libraries regarding to PDF export from a TRichView document ?

On one hand I find the llPdfLib isn't really followed by its author (time between releases is really long and support has been criticized on the forums). On the other hand, it seems that it produces better looking and more customizable PDF documents coming from a TRichView source.

Thanks,

John.
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I never used any of these libraries myself in real applications.
By the way, a new version of LLPDFLib is just released, and these demos need to be checked for compatibility with it.

There is a different approach in TRichView PDF generation for eDocEngine and llPDFLib.
llPDFLib contains nothing special related to TRichView. It just provides a Canvas where you can draw anything that you want, including TRichView documents. This drawing will be saved in PDF. Since you can implement drawing yourself (like it is shown in this demo), you can create any complex page layout, but it requires writing code.

eDocEngine provides a component for exporting TRichView in PDF. It is easier to use - just place a component and set its properties. But this approach is limited to features included in this component. If it, for example, does not support headers and footers, you cannot add them. I do not know, may be eDocEngine can be used in a low-level way, like llPDFLib. When I'll have time, I'll test it.
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

The demo is updated for LLPDF v4 compatibility.

The following changes were made:
- "PDF" is removed from USES, "llPDFDocument, llPDFTypes, llPDFCanvas" is added there;
- assignment to Size and Orientation properties of PDF page is changed (since they are write-only properties in v4);
- CurrentPageIndex property is used instead of SetCurrentPage method.
ErichMorr
Posts: 2
Joined: Mon Mar 12, 2012 11:45 am
Contact:

Post by ErichMorr »

Most rtf to pdf converters do need a standalone program requires Adobe Acrobat software support. Is it the same about this demo?

Thanks,
Regards.
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

No, this demo does not use Acrobat. It uses only TRichView and LLPDFLib component, both are compiled inside the exe file, so no additional libraries or software are required.
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

We updated the demos for compatibility with TRichView 16: for report helpers, True is assigned to MetafileCompatibility property.

Since TRichView, TRichView draws text using glyph indexes in fonts instead of character codes. LLPDF processes such text output correctly, and PDF looks as expected. Also, fonts are embedded by default, so these PDF must look identically on all computers.
However, Adobe Reader cannot copy such text correctly to the Clipboard.

If MetafileCompatibility=True, TRichView draws text using character codes, like before. This mode is less efficient, however it helps to avoid problems with PDF export.
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Hot news: LLPDFLib becomes open source.

The license is GNU Affero General Public License (GNU AGPL), with the addendum, see LICENSE file on the link above.
A commercial license is still available, you can purchase it to release yourself from the requirements of GNU AGPL.

Disclaimer: LLPDFLib is developed and copyrighted by Sybrex Systems. We are not affiliated with Sybrex Systems, except for a possibility of using our programming libraries together.
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: [Demo] Advanced RTF to PDF demo using LLPDFLib (open source)

Post by Sergey Tkachenko »

TRichView setup now includes better version of this demo in <TRichViewDir>\ThirdParty\Export\LLPDFLib\Demos\RV2PDF\ folder. This better version reads all page properties from source RTF (or RVF) files and applies them to PDF, supports headers, footers, footnotes and endnotes, displays preview before exporting.
See http://www.trichview.com/forums/viewtop ... 951#p34100
Post Reply