Draw transparent image on PDF

Discussions about PDF management.
Post Reply
MarcVeit
Posts: 8
Joined: Tue Jan 24, 2012 9:25 pm

Draw transparent image on PDF

Post by MarcVeit » Fri Feb 03, 2012 4:45 pm

Hi,

I would like to draw a transparent image on a pdf. I'm using the following code:

Code: Select all

  Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("c:\test.jpg")
  oGdPicturePDF.SelectPage(1) 'Selecting first page
  oGdPictureImaging.SetTransparency(ImageID, -100)

  Dim image_res_name As String = oGdPicturePDF.AddImageFromGdPictureImage(ImageID, False, False)
  oGdPicturePDF.DrawImage(image_res_name, 10, 10, imageWidth, imageHeight)
  oGdPictureImaging.ReleaseGdPictureImage(ImageID)
  oGdPicturePDF.SaveToFileInc("c:\test.pdf")
  oGdPicturePDF.CloseDocument()

This draws the image on the pdf, however, the transparency is lost. What am I doing wrong?

Any help is appreciated. Best regards,

Marc

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Draw transparent image on PDF

Post by Loïc » Fri Feb 03, 2012 5:00 pm

Hello Marc,

The transparency model in PDF is not the same at all as in raster image. While in image you just "play' with an alpha channel, in PDF you have to deal with softmask, blending mode, groups, composting mode and some other hell.

Currently we support only mask image. Therefore, you will not blend your image to a PDF page in an other way than defining a single fully transparent color.

We are already working on the full transparency support since 6 months now ,for rasterization, printing & writing purpose. The task is 50-60% done, and we expect to be ready for GdPicture 9.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests