#1 Re: PDF Engine » htm2pdf free tool release » 2016-07-08 16:22:10

With respect to my three posts above, some more information, .... I have downloaded the latest HTMLViewer code from http://github.com/BerndGabriel/HtmlViewer and my problem still exists

#2 Re: PDF Engine » htm2pdf free tool release » 2016-07-08 12:50:37

With respect to my two posts above, some more information, .... setting the left margin to 1 and leaving the rest as 0 causes the tall compressed PDF output

#3 Re: PDF Engine » htm2pdf free tool release » 2016-07-08 12:22:13

With respect to my post above, some more information, .... I have worked out that the "ridiculous" PDF has it's image height too large causing the pdf to look compressed and tall thereby leaving out the bottom part of my HTML from the PDF completely.

I have also made the necessary changes to SynPdf.pas to support A2, A1 and A0 paper sizes if anyone is interested.  Similarly I have added A2, A1 and A0 options to htm2pdf.exe

Now I just need to resolve the non-zero (centimeters) margin value problem

#4 Re: PDF Engine » htm2pdf free tool release » 2016-07-08 11:51:06

I have been using nightlybuild version of the Synopse framework since last year on Delphi XE2 and only noticed the htm2pdf project today.  I was initially unable to compile because I did not have the THTMLViewer component installed. 

After getting that installed, I I got compile errors in that the TPrinterState constants could not be resolved  !!!  While TPrinterState itself could be resolved none of the psNoHandle, psHandleIC, psHandleDC contants were found !!!  I had to change all instances of these to TPrinterState(0), TPrinterState(1) and TPrinterState(2) respectively !!

Eventually was able to compile htm2pdf.exe.  However, when I use any non-zero (centimetrs) value for margins my resulting PDF looks ridiculous.

I eventually found http://blog.synopse.info/post/2010/07/1 … -free-tool page and downloaded the compiled version of htm2pdf.exe and that works correctly.

This leads me to think that either my $Defines for XE2 are incorrect OR the htm2pdf code in the nightlybuild is somehow incorrect.  Can anyone help on this?

#5 Re: PDF Engine » Adding an index at the end of a PDF document » 2015-03-05 11:55:02

ab,

I just want to be sure that you have received my emails.  First email with changes as discussed above.  Second email which also contains code for adding link support to DrawTextAcrossCols

Regards
Mike

#6 Re: PDF Engine » Adding an index at the end of a PDF document » 2015-03-05 08:17:56

Hi ab ...

I have succeeded in implementing multicolored lines by changing

procedure TGDIPages.DrawText(const s: string);

to

procedure TGDIPages.DrawText(const s: string; bWithNewLine : Boolean = TRUE);

and thereafter changing all subsequent calls to contain the bWithNewLine parameter as required.  I have also had to add a new class member variable that keeps the remembers the last leftOffset.

Question : would you be interested in these changes?  If so .... please email me and I will send you the original and changed mormotreport.pas files

#7 Re: PDF Engine » Adding an index at the end of a PDF document » 2015-03-04 16:17:40

Hi ab ...

I have been moving on with respect to replacing TRichEdit with TGDIPages ... still have not resolved the issue above ... but the next issue is DrawTextAcrossCols for my index, whereby I would like each index entry to hot link to a bookmark.  It turns out we need

   procedure DrawTextAcrossCols(const StringArray: array of SynUnicode; const BookmarkArray: array of string; BackgroundColor: TColor=clNone);

I am really trying my best to add this new methods to the as well as

   procedure DrawColouredText(const StringArray: array of SynUnicode; const Color: array of integer)

as mentioned previously but it I am really battling

Regards

and

#8 Re: PDF Engine » Adding an index at the end of a PDF document » 2015-03-04 06:21:21

Hi ab ... I decided to bite the bullet and bypass the TRichEdit component by writing directly to the TGDIPages component.  The issue I have at the moment is that I am unable to write multi-coloured lines.

I have lines that typically have red text followed by blue text followed black text .... but the DrawText() method always adds a new line and so each of my colored texts appear on a separate line.  Is there any way to achieve multicolored text lines? Essentially we need a new DrawText method that is able to able to draw text from the current YPos and XPos without adding a new line after each call.

The other thought I had was adding a method called:

DrawColouredText(const StringArray: array of SynUnicode; const Color: array of integer)

which could happily add a new line at the end

Are you able to do something along these lines for us?

Regards

#9 Re: PDF Engine » Adding an index at the end of a PDF document » 2015-03-03 13:02:35

Thanks AB .... downloaded your update and amended my code accordingly !!

#10 Re: PDF Engine » Adding an index at the end of a PDF document » 2015-03-03 11:19:30

Hi ab ... managed to get it all done!  The heart of the changes is redefining AppendRichEdit by adding an lst parameter as follows:

    procedure AppendRichEdit(RichEditHandle: HWnd; lst : TList = NIL);   // rev change by mogulza

The first line of AppendRichEdit() code has the following line added:

  if lst <> NIL then lst.Clear; // rev line added by mogulza

and further down

        LastChar := SendMessage(RichEditHandle, EM_FORMATRANGE, 1, Integer(@Range));
        if lst <> NIL then lst.Add(pointer(LastChar)); // rev line added by mogulza

On return from AppendRichEdit, each entry of the lst variable represents a page and each page value contains the lastchar value for the page i.e. the lastchar for page 1 would be integer(lst.Items[0]) and page 2 would be integer(lst.Items[1])  etc.

Hope this all makes sense

Thanks for your help

#12 Re: PDF Engine » Adding an index at the end of a PDF document » 2015-03-03 07:45:05

Thanks ab .... your suggestion can work for adding the entries.  The problem would then be ... how do I know on which page (or pages) each of the index entries has ended up on, after feeding the TRichEdit content to TGDIPages ..... ?

#13 PDF Engine » Adding an index at the end of a PDF document » 2015-03-02 11:10:58

mogulza
Replies: 13

Hi all,

I have been investigating the library for creating PDF documents of my TRichEdit content.  I came upon the sample at http://synopse.info/forum/viewtopic.php?id=76 and things seem to be good so far.

I would now like to add an index of selected words to the end of the PDF but I do not understand how to do this from any of the documentation and there does not seem to be any sample code.  Can anyone help me out with this please?

Regards

Board footer

Powered by FluxBB