Images not transparent in PDF export

  • Gets weirder. If I save either the 8bit or 32 bit versions of the PNG to a file and insert it into the WPRichText as a linked image, it works fine in the PDF (both are transparent). However, for signatures I insert them into the WPRichText as embedded images.

    So I guess that would be the difference, and would be why the sample PNG I had was working because it was a linked image and the signature testing was an embedded image.

    Something you may want to check out. Why an embedded PNG image needs to be 8bit to be transparent in a PDF but a 32bit PNG is not transparent in the PDF. Both are transparent in the editor and in Print Preview.

  • OK, but they come out transparent if added as linked images but not when added as embedded images. I have no problem making them 8bit since the signatures are a single color anyway. Just strange that there seems to be a difference between being embedded vs being linked.

    To make them linked in a test, I simply wrote the stream to a file and inserted the file as a linked image whereas for embedded I take the same stream and embed the image:

    Code
          var vWPObject := WPCreateObjectForExtension(WPRichText1, 'png');
          if vWPObject <> nil then
          begin
            try
              vWPObject.FileExtension := 'png';
              vWPObject.LoadFromStream(vImageStream);
              PasteSignature(WPRichText1, vWPObject);
            except
              FreeAndNil(vWPObject);
            end;

    And PasteSignature basically just does this (pWPObject is vWPObject passed in):

    vTextObj := pWPRichText.TextObjects.Insert(pWPObject, pWPObject.ContentsWidth, pWPObject.ContentsHeight);

  • Please ignore the 8bit version. I only mentioned that to indicate that it is fine and transparent even in the PDF for just that format when it is an embedded image.

    The 32bit versions should be the same. In testing, I simply write the stream to a file before writing the same stream to a WPRichText object for embedding. Both the embedded and linked image of the same stream show up as transparent in the editor and in the print preview, but only the linked image version is transparent in the PDF, the embedded version is not.