#1 Re: PDF Engine » ViewerPreference not working properly? » 2022-07-22 20:33:40

....because it does not work. If done that way, it is not even at the end of the document.
I included the NewDoc only recently just to try, the TPDFdocumentGDI instance is created right before that.

And I found that snippet over at https://synopse.info/forum/viewtopic.php?id=781 where it is done that way. But either nobody checked, if that works or it once did.

The FitWindow preference should tell a viewer to open the document fit to the viewport width.


Thanks anyway
Stefan

#2 PDF Engine » ViewerPreference not working properly? » 2022-07-22 19:15:52

looseleaf
Replies: 3

I am trying to set the ViewerPreference to "fitWindow". Here's what I do (I also tried the very latest version from github):

      FPdfDoc.NewDoc;
      FPdfDoc.Root.ViewerPreference := [vpFitWindow];
      FPdfDoc.ScreenLogPixels      := dpi;
      FPdfDoc.DefaultPaperSize     := psA4;
      FPdfDoc.DefaultPageLandscape := false;
      for i := 1 to rvh.PagesCount do // RichView renders the pages
        begin
        FPdfDoc.AddPage;
        rvh.DrawPageAt(ALeft, ATop, i, FPdfDoc.VCLCanvas, false, DocHeight);
        end;
      FPdfDoc.SaveToFile(outname);

The expected PDF-items are added to the file, but after the pages. So neither Acrobat Reader nor PDFXChange View notices, that the setting is in that file.

How do I force SynPDF to put this information in front of the pages? Or is there something different that I am missing?

Thanks
Stefan

#3 Re: mORMot 1 » AppendRichEdit and background images » 2017-08-24 08:40:24

Hm, you mean transparency when rendering RTF controls? Because using Canvas.TextOut in a OnNewPage event handler works fine.

An alternative would be rendering the RTF to a TBitmap and then painting it to the PDF canvas. Of course, losing the plain text information...

I am currently fooling around with TRichView (not freeware) and its report helper. I am currently in the middle of the process, but the RTF is transparent with it (using synpdf as PDF-canvas). So I'll probably use RichView instead of the methods built around TRichEdit.

Thanks anyway, Stefan

#4 mORMot 1 » AppendRichEdit and background images » 2017-08-24 07:20:19

looseleaf
Replies: 3

Hi!

I just downloaded the latest version of the synpdf package and was trying to create background images for RTF output. The RichEdit in question renders fine using AppendRichEdit. The only problem is that the text is not rendered transparently, thus overwriting the background image.

I also tried modifying the TGDIPages.AppendRichEdit method th set the bkmode right before rendering the RichEdit.
        SetBkMode(hdc, TRANSPARENT);
        LastChar := SendMessage(RichEditHandle, EM_FORMATRANGE, 1, Integer(@Range));

Sadly, this fails. This is with Windows 10 and Delphi 10.2 Tokyo.

Any pointers or solutions?
Stefan

Board footer

Powered by FluxBB