PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Apr 28, 2024 2:41 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Translucent JPEG images
PostPosted: Sat Sep 26, 2009 8:56 pm 
Offline
User avatar

Joined: Sat Sep 26, 2009 8:39 pm
Posts: 2
Hi,
I need to find a way to add a translucent JPEG image to a PDF. Basically, the image has to be drawn semi-transparently on top of whatever is "under" it. I tried to convert it to PNG, to get alpha channel support, but the resulting PDF becomes too large for this to be a satisfying solution.
I know that PDF >= 1.4 supports something like this feature. I was thinking that, maybe, I could load the JPEG image in a PdfImage object and use an equally sized soft mask filled with the alpha value I want, but I don't know if this is the best solution and I cannot even figure out how to add a PdfImage object to a page and how to position it. So far, I've used only PdfSharp's high-level functions.

I'm using the GDI+ build of PdfSharp 1.30.

Could someone help me?
Thanks in advance.


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 28, 2009 10:50 pm 
Offline
User avatar

Joined: Sat Sep 26, 2009 8:39 pm
Posts: 2
Ok, after reading some of the PDF specifications, my understanding is that the best way to accomplish what I need to do (draw a bitmap image with a constant alpha factor) is to save the current graphics state, set the alpha default value for nonstroke operations, draw the image and pop the graphics state.

I'd like to know if this is the most sensible way to do it, and I'd like to have a couple of lines of sample code to modify the graphics state and set the transformation matrix without using the high-level XGraphics object.

Thanks in advance.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 325 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group